70377c624fdc514cd5897985c67c922cba613c1d,foreman/data_refinery_foreman/surveyor/transcriptome_index.py,TranscriptomeIndexSurveyor,discover_species,#TranscriptomeIndexSurveyor#,259

Before Change


        // If number_of_organisms isn"t specified, default to surveying
        // all organisms in the division.
        try:
            number_of_organisms = int(
                SurveyJobKeyValue
                .objects
                .get(survey_job_id=self.survey_job.id,
                     key__exact="number_of_organisms")
                .value
            )
        except SurveyJobKeyValue.DoesNotExist:
            number_of_organisms = -1

        logger.info("Surveying %s division of ensembl.",
                    ensembl_division,
                    survey_job=self.survey_job.id)

        // The main division has a different base URL for its REST API.
        if ensembl_division == "Ensembl":
            r = utils.requests_retry_session().get(MAIN_DIVISION_URL_TEMPLATE)

            // Yes I"m aware that specieses isn"t a word. However I need to
            // distinguish between a singlular species and multiple species.
            specieses = r.json()["species"]
        else:
            r = utils.requests_retry_session().get(DIVISION_URL_TEMPLATE.format(division=ensembl_division))
            specieses = r.json()

        try:
            organism_name = SurveyJobKeyValue.objects.get(survey_job_id=self.survey_job.id, key__exact="organism_name").value
            organism_name = organism_name.lower().replace(" ", "_")
        except SurveyJobKeyValue.DoesNotExist:
            organism_name = None

        // Survey jobs are on a per-organism basis.
        for species in specieses:
            if species["name"] == organism_name:
                specieses = [species]
                logger.info("Found species " + organism_name + " on Ensembl.",
                            survey_job=self.survey_job.id)
                break

        species_surveyed = 0
        all_new_species = []
        for species in specieses:
            if number_of_organisms != -1 and species_surveyed >= number_of_organisms:
                break

            all_new_species.append(self._generate_files(species))
            species_surveyed += 1

        return all_new_species

After Change


            for species in specieses:
                all_new_species.append(self._generate_files(species))

        if len(all_new_species) == 0:
            logger.error("Unable to find any species!",
                         ensembl_division=ensembl_division,
                         organism_name=organism_name)

        return all_new_species
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: AlexsLemonade/refinebio
Commit Name: 70377c624fdc514cd5897985c67c922cba613c1d
Time: 2018-08-27
Author: kurt.wheeler91@gmail.com
File Name: foreman/data_refinery_foreman/surveyor/transcriptome_index.py
Class Name: TranscriptomeIndexSurveyor
Method Name: discover_species


Project Name: AlexsLemonade/refinebio
Commit Name: bf4d4be450616eeb0252b276c9febc4a50e83ace
Time: 2020-07-06
Author: willvauclain.dev@gmail.com
File Name: api/data_refinery_api/views/dataset.py
Class Name:
Method Name: validate_dataset


Project Name: thenetcircle/dino
Commit Name: 6c2b0bc69e167dafec15ec3e66066be8ed41bf22
Time: 2016-11-02
Author: oscar.eriks@gmail.com
File Name: dino/validation/acl.py
Class Name: AclValidator
Method Name: is_acl_valid


Project Name: thenetcircle/dino
Commit Name: ed78eaeb5b0e66b6a003261669880ce443f3953d
Time: 2016-11-01
Author: oscar.eriks@gmail.com
File Name: dino/validation/acl.py
Class Name: AclValidator
Method Name: validate_acl_for_action