def test_correct_index_location_metazoa(self):
        """ Tests that the files returned actually exist.

        Tests the Metazoa division instead of the main division.
        """
        survey_job = SurveyJob(source_type="TRANSCRIPTOME_INDEX")
        survey_job.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="ensembl_division",
                                           value="EnsemblMetazoa")
        key_value_pair.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="organism_name",
                                           value="Octopus bimaculoides")
        key_value_pair.save()

        surveyor = TranscriptomeIndexSurveyor(survey_job)
        files = surveyor.discover_species()[0]

        for file in files:
            urllib.request.urlopen(file.source_url)

        # Make sure the organism object got created by making sure
        # this doesn't raise an exception.
        Organism.objects.get(name="OCTOPUS_BIMACULOIDES")
    def test_correct_index_location(self):
        """ Tests that the files returned actually exist.

        Uses an organism in the main division.
        """
        survey_job = SurveyJob(source_type="TRANSCRIPTOME_INDEX")
        survey_job.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="ensembl_division",
                                           value="Ensembl")
        key_value_pair.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="organism_name",
                                           value="Danio rerio")
        key_value_pair.save()

        surveyor = TranscriptomeIndexSurveyor(survey_job)
        files = surveyor.discover_species()[0]

        # Make sure the organism object got created by making sure
        # this doesn't raise an exception.
        Organism.objects.get(name="DANIO_RERIO")

        for file in files:
            urllib.request.urlopen(file.source_url)
    def test_single_plant(self):
        """ Tests that the files returned actually exist.

        Tests the Metazoa division instead of the main division.
        """
        survey_job = SurveyJob(source_type="TRANSCRIPTOME_INDEX")
        survey_job.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="ensembl_division",
                                           value="EnsemblPlants")
        key_value_pair.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="organism_name",
                                           value="Arabidopsis thaliana")
        key_value_pair.save()

        surveyor = TranscriptomeIndexSurveyor(survey_job)
        files = surveyor.discover_species()[0]

        for file in files:
            urllib.request.urlopen(file.source_url)

        # Make sure the organism object got created by making sure
        # this doesn't raise an exception.
        Organism.objects.get(name="ARABIDOPSIS_THALIANA")
    def test_correct_index_location_protist(self):
        """ Tests that the files returned actually exist.

        Tests the Metazoa division instead of the main division.
        """
        survey_job = SurveyJob(source_type="TRANSCRIPTOME_INDEX")
        survey_job.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="ensembl_division",
                                           value="EnsemblProtists")
        key_value_pair.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="organism_name",
                                           value="Leishmania major")
        key_value_pair.save()

        surveyor = TranscriptomeIndexSurveyor(survey_job)
        files = surveyor.discover_species()[0]

        for file in files:
            urllib.request.urlopen(file.source_url)
    def test_correct_index_location(self):
        """ Tests that the files returned actually exist.

        Uses an organism in the main division.
        """
        survey_job = SurveyJob(source_type="TRANSCRIPTOME_INDEX")
        survey_job.save()
        self.survey_job = survey_job

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="ensembl_division",
                                           value="Ensembl")
        key_value_pair.save()

        key_value_pair = SurveyJobKeyValue(survey_job=survey_job,
                                           key="organism_name",
                                           value="Danio rerio")
        key_value_pair.save()

        surveyor = TranscriptomeIndexSurveyor(self.survey_job)
        files = surveyor.discover_species()[0]

        for file in files:
            urllib.request.urlopen(file.source_url)