Create a cases and populate it with individuals

            Args:
                variant_source (str): Path to vcf files
                case_lines (Iterable): Ped like lines
                case_type (str): Format of case lines

            Returns:
                case_objs (list(puzzle.models.Case))

def get_cases(variant_source, case_lines=None, case_type='ped',
              variant_type='snv', variant_mode='vcf'):
        """Create a cases and populate it with individuals

            Args:
                variant_source (str): Path to vcf files
                case_lines (Iterable): Ped like lines
                case_type (str): Format of case lines

            Returns:
                case_objs (list(puzzle.models.Case))
        """
        individuals = get_individuals(
            variant_source=variant_source,
            case_lines=case_lines,
            case_type=case_type,
            variant_mode=variant_mode
        )
        case_objs = []
        case_ids = set()

        compressed = False
        tabix_index = False
        #If no individuals we still need to have a case id
        if variant_source.endswith('.gz'):
            logger.debug("Found compressed variant source")
            compressed = True
            tabix_file = '.'.join([variant_source, 'tbi'])
            if os.path.exists(tabix_file):
                logger.debug("Found index file")
                tabix_index = True

        if len(individuals) > 0:
            for individual in individuals:
                case_ids.add(individual.case_id)
        else:
            case_ids = [os.path.basename(variant_source)]

        for case_id in case_ids:
            logger.info("Found case {0}".format(case_id))
            case = Case(
                case_id=case_id,
                name=case_id,
                variant_source=variant_source,
                variant_type=variant_type,
                variant_mode=variant_mode,
                compressed=compressed,
                tabix_index=tabix_index
                )

            # Add the individuals to the correct case
            for individual in individuals:
                if individual.case_id == case_id:
                    logger.info("Adding ind {0} to case {1}".format(
                        individual.name, individual.case_id
                    ))
                    case.add_individual(individual)

            case_objs.append(case)

        return case_objs