def getTotalAltered(self, gene_list, study=None, study_name=None, case_set_id=None, genetic_profile_id=None, threshold=2):

        study = self._getStudyId(study, study_name)
        case_set_id = self._getCaseListId(case_set_id, study)
        genetic_profile_id = self._getAndCheckGeneticProfiles(
            genetic_profile_id, study)

        if study == self.study:
            profiles = self.profiles
            case_list = [x['case_ids']
                         for x in self.cases if x['case_list_id'] == case_set_id][0]
        else:
            profiles = self.getGeneticProfiles(study)
            case_list = [x['case_ids'] for x in self.getCaseLists(
                study) if x['case_list_id'] == case_set_id][0]
        case_list = case_list.split(" ")

        data = []

        # data[gene][profile][case]
        cases_altered = 0.0
        for gene in gene_list:
            data.append(self.getProfileData(
                gene_list=[gene], case_set_id=case_set_id,
                genetic_profile_id=genetic_profile_id))
            # catch special case where only a single
            # genetic_profile_id is passed in, so the query is single
            # gene and single profile and returns genes as columns
            # format.
            if len(genetic_profile_id) == 1 and len(data[0]) == 1:
                data[0][0]['GENETIC_PROFILE_ID'] = genetic_profile_id[0]

        for case_id in set(data[0][0]) - set(
                ["GENETIC_PROFILE_ID", "ALTERATION_TYPE",
                 "GENE_ID", "COMMON"]):

            case_altered = False
            for gene in data:

                altered = len([x for x in gene
                              if self._guessAlteration(x[case_id],
                                                       x['GENETIC_PROFILE_ID'],
                                                       profiles, threshold)])
                if (altered > 0):
                    case_altered = True

            if case_altered is True:
                cases_altered += 1.0

        return cases_altered * 100 / len(case_list)
This parses the lines of a batchfile according to the following
dataset/ETHPy150Open CGATOxford/cgat/CGAT/CBioPortal.py/CBioPortal.getTotalAltered--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/utils/batchprocessors.py/BatchCodeProcessor.parse_file