Ejemplo n.º 1
0
 def test_json2isatab_convert_sample_pool_assay_table(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'TEST-ISA-sample-pool.json')), self._tmp_dir,
                         validate_first=False)
     self.assertTrue(assert_tab_content_equal(
         open(os.path.join(self._tmp_dir, 'a_test-template3-splitting_transcription_profiling_DNA_microarray.txt')),
         open(os.path.join(self._tab_data_dir, 'TEST-ISA-sample-pool',
                           'a_test-template3-splitting_transcription_profiling_DNA_microarray.txt'))))
Ejemplo n.º 2
0
 def test_assert_tab_content_equal_assay_table(self):
     with open(os.path.join(utils.TAB_DATA_DIR, 'BII-I-1',
                            's_BII-S-1.txt')) as s_tab1:
         with open(
                 os.path.join(utils.TAB_DATA_DIR, 'BII-I-1',
                              's_BII-S-1.txt')) as s_tab2:
             self.assertTrue(utils.assert_tab_content_equal(s_tab1, s_tab2))
Ejemplo n.º 3
0
 def test_mzml2isa_convert_investigation(self):
     study_id = 'MTBLS267'
     report = mzml2isa.convert(os.path.join(self._mzml_data_dir,
                                            study_id + '-partial'),
                               self._tmp_dir,
                               study_id,
                               validate_output=True)
     self.assertTrue(report['validation_finished'])
     self.assertEqual(len(report['errors']), 0)
     # Strip out the line with Comment[Created With Tool] to avoid changes in version number generated by mzml2isa
     with open(os.path.join(self._tmp_dir, study_id, 'i_Investigation.txt')
               ) as in_fp, StringIO() as stripped_actual_file:
         stripped_actual_file.name = 'i_Investigation.txt'
         for row in in_fp:
             if row.startswith('Comment[Created With Tool]'):
                 pass
             else:
                 stripped_actual_file.write(row)
         stripped_actual_file.seek(0)
         with open(
                 os.path.join(self._tab_data_dir, study_id + '-partial',
                              'i_Investigation.txt')) as reference_fp:
             self.assertTrue(
                 assert_tab_content_equal(stripped_actual_file,
                                          reference_fp))
Ejemplo n.º 4
0
 def test_assert_tab_content_equal_investigation(self):
     with open(
             os.path.join(utils.TAB_DATA_DIR, 'BII-I-1',
                          'i_investigation.txt')) as i_tab1:
         with open(
                 os.path.join(utils.TAB_DATA_DIR, 'BII-I-1',
                              'i_investigation.txt')) as i_tab2:
             self.assertTrue(utils.assert_tab_content_equal(i_tab1, i_tab2))
Ejemplo n.º 5
0
 def test_json2isatab_convert_bii_i_1_study2_table(self):
     with open(os.path.join(self._json_data_dir, 'BII-I-1',
                            'BII-I-1.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir)
     with open(os.path.join(self._tmp_dir, 's_BII-S-2.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-I-1',
                              's_BII-S-2.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 6
0
 def test_json2isatab_convert_bii_s_7_study_table(self):
     with open(os.path.join(self._json_data_dir, 'BII-S-7',
                            'BII-S-7.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir, validate_first=False)
     with open(os.path.join(self._tmp_dir, 's_BII-S-7.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-S-7',
                              's_BII-S-7.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 7
0
 def test_json2isatab_convert_bii_i_1_study2_table(self):
     json2isatab.convert(
         open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')),
         self._tmp_dir)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 's_BII-S-2.txt')),
             open(
                 os.path.join(self._tab_data_dir, 'BII-I-1',
                              's_BII-S-2.txt'))))
Ejemplo n.º 8
0
 def test_json2isatab_convert_source_split_study_table(self):
     with open(
             os.path.join(self._json_data_dir,
                          'TEST-ISA-source-split.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir, validate_first=False)
     with open(os.path.join(self._tmp_dir,
                            's_TEST-Template1-Splitting.txt')) as out_fp:
         with open(os.path.join(self._tab_data_dir, 'TEST-ISA-source-split', 's_TEST-Template1-Splitting.txt')) \
                 as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 9
0
 def test_json2isatab_convert_bii_i_1_assay_table_metabolome(self):
     with open(os.path.join(self._json_data_dir, 'BII-I-1',
                            'BII-I-1.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir)
     with open(os.path.join(self._tmp_dir, 'a_metabolome.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_metabolome.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 10
0
 def test_json2isatab_convert_bii_s_3_assay_table_Gx(self):
     with open(os.path.join(self._json_data_dir, 'BII-S-3',
                            'BII-S-3.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir, validate_first=False)
     with open(os.path.join(self._tmp_dir,
                            'a_gilbert-assay-Gx.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-S-3',
                              'a_gilbert-assay-Gx.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 11
0
 def test_json2isatab_convert_bii_s_3_study_table(self):
     json2isatab.convert(open(
         os.path.join(self._json_data_dir, 'BII-S-3', 'BII-S-3.json')),
                         self._tmp_dir,
                         validate_first=False)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 's_BII-S-3.txt')),
             open(
                 os.path.join(self._tab_data_dir, 'BII-S-3',
                              's_BII-S-3.txt'))))
Ejemplo n.º 12
0
 def test_json2isatab_convert_bii_s_7_assay_table_Gx(self):
     json2isatab.convert(open(
         os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')),
                         self._tmp_dir,
                         validate_first=False)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'a_matteo-assay-Gx.txt')),
             open(
                 os.path.join(self._tab_data_dir, 'BII-S-7',
                              'a_matteo-assay-Gx.txt'))))
Ejemplo n.º 13
0
 def test_json2isatab_convert_bii_i_1_investigation(self):
     json2isatab.convert(
         open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')),
         self._tmp_dir)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'i_investigation.txt')),
             open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'i_investigation.txt'))))
Ejemplo n.º 14
0
 def test_json2isatab_convert_bii_i_1_assay_table_proteome(
         self):  # FIXME: Same duplication problem as above
     with open(os.path.join(self._json_data_dir, 'BII-I-1',
                            'BII-I-1.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir)
     with open(os.path.join(self._tmp_dir, 'a_proteome.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_proteome.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 15
0
 def test_json2isatab_convert_bii_i_1_assay_table_metabolome(self):
     json2isatab.convert(
         open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')),
         self._tmp_dir)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'a_metabolome.txt')),
             open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_metabolome.txt'))))
Ejemplo n.º 16
0
 def test_json2isatab_convert_bii_s_3_investigation(self):
     json2isatab.convert(open(
         os.path.join(self._json_data_dir, 'BII-S-3', 'BII-S-3.json')),
                         self._tmp_dir,
                         i_file_name='i_gilbert.txt',
                         validate_first=False)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'i_gilbert.txt')),
             open(
                 os.path.join(self._tab_data_dir, 'BII-S-3',
                              'i_gilbert.txt'))))
Ejemplo n.º 17
0
 def test_json2isatab_convert_bii_i_1_assay_table_microarray(
     self
 ):  # FIXME: ArrayExpress comments come out twice (on Assay AND Derived Data File output from assay), missing Data Transformation Name and Factor Values
     with open(os.path.join(self._json_data_dir, 'BII-I-1',
                            'BII-I-1.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir)
     with open(os.path.join(self._tmp_dir, 'a_microarray.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_microarray.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 18
0
 def test_json2isatab_convert_bii_i_1_assay_table_proteome(
         self):  # FIXME: Same duplication problem as above
     json2isatab.convert(
         open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')),
         self._tmp_dir)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'a_proteome.txt')),
             open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_proteome.txt'))))
Ejemplo n.º 19
0
 def test_json2isatab_convert_bii_s_3_investigation(self):
     with open(os.path.join(self._json_data_dir, 'BII-S-3',
                            'BII-S-3.json')) as json_fp:
         json2isatab.convert(json_fp,
                             self._tmp_dir,
                             i_file_name='i_gilbert.txt',
                             validate_first=False)
     with open(os.path.join(self._tmp_dir, 'i_gilbert.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-S-3',
                              'i_gilbert.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 20
0
 def test_json2isatab_convert_bii_i_1_assay_table_transcriptome(
     self
 ):  # FIXME: Has inserted Protocol REFs but Array Design REF, Scan Name, Factor Values
     json2isatab.convert(
         open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')),
         self._tmp_dir)
     self.assertTrue(
         assert_tab_content_equal(
             open(os.path.join(self._tmp_dir, 'a_transcriptome.txt')),
             open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_transcriptome.txt'))))
Ejemplo n.º 21
0
 def test_json2isatab_convert_sample_pool_study_table(self):
     json2isatab.convert(open(
         os.path.join(self._json_data_dir, 'TEST-ISA-sample-pool.json')),
                         self._tmp_dir,
                         validate_first=False)
     self.assertTrue(
         assert_tab_content_equal(
             open(
                 os.path.join(self._tmp_dir,
                              's_TEST-Template3-Splitting.txt')),
             open(
                 os.path.join(self._tab_data_dir, 'TEST-ISA-sample-pool',
                              's_TEST-Template3-Splitting.txt'))))
Ejemplo n.º 22
0
 def test_mzml2isa_convert_study_table(self):
     study_id = 'MTBLS267'
     report = mzml2isa.convert(os.path.join(self._mzml_data_dir,
                                            study_id + '-partial'),
                               self._tmp_dir,
                               study_id,
                               validate_output=True)
     self.assertTrue(report['validation_finished'])
     self.assertEqual(len(report['errors']), 0)
     with open(
             os.path.join(self._tmp_dir, study_id,
                          's_{}.txt'.format(study_id))) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, study_id + '-partial',
                              's_{}.txt'.format(study_id))) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 23
0
 def test_json2isatab_convert_source_split_assay_table(self):
     with open(
             os.path.join(self._json_data_dir,
                          'TEST-ISA-source-split.json')) as json_fp:
         json2isatab.convert(json_fp, self._tmp_dir, validate_first=False)
     with open(
             os.path.join(
                 self._tmp_dir,
                 'a_test-template1-splitting_transcription_profiling_DNA_microarray.txt'
             )) as out_fp:
         with open(
                 os.path.join(
                     self._tab_data_dir, 'TEST-ISA-source-split',
                     'a_test-template1-splitting_transcription_profiling_DNA_microarray.txt'
                 )) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 24
0
 def test_json2isatab_convert_bii_s_7_assay_table_Gx(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_matteo-assay-Gx.txt')),
                                              open(os.path.join(self._tab_data_dir, 'BII-S-7',
                                                                'a_matteo-assay-Gx.txt'))))
     
 # def test_json2isatab_convert_bii_i_1_investigation(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'i_investigation.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1', 'i_investigation.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_study_table(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 's_BII-S-1.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1', 's_BII-S-1.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_study2_table(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 's_BII-S-2.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1', 's_BII-S-2.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_assay_table_metabolome(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_metabolome.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1',
 #                                                                'a_metabolome.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_assay_table_microarray(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_microarray.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1',
 #                                                                'a_microarray.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_assay_table_proteome(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_proteome.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1',
 #                                                                'a_proteome.txt'))))
 #
 # def test_json2isatab_convert_bii_i_1_assay_table_transcriptome(self):
 #     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-I-1', 'BII-I-1.json')), self._tmp_dir)
 #     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_transcriptome.txt')),
 #                                              open(os.path.join(self._tab_data_dir, 'BII-I-1',
 #                                                                'a_transcriptome.txt'))))
Ejemplo n.º 25
0
 def test_mzml2isa_convert_assay_table(self):
     study_id = 'MTBLS267'
     report = mzml2isa.convert(os.path.join(self._mzml_data_dir,
                                            study_id + '-partial'),
                               self._tmp_dir,
                               study_id,
                               validate_output=True)
     self.assertTrue(report['validation_finished'])
     self.assertEqual(len(report['errors']), 0)
     self.assertTrue(
         assert_tab_content_equal(
             open(
                 os.path.join(
                     self._tmp_dir, study_id,
                     'a_{}_metabolite_profiling_mass_spectrometry.txt'.
                     format(study_id))),
             open(
                 os.path.join(
                     self._tab_data_dir, study_id + '-partial',
                     'a_{}_metabolite_profiling_mass_spectrometry.txt'.
                     format(study_id)))))
Ejemplo n.º 26
0
    def test_isatab_dump_source_sample_split(self):
        i = Investigation()
        uberon = OntologySource(
            name="UBERON",
            description="Uber Anatomy Ontology",
            version="216",
            file="http://data.bioontology.org/ontologies/UBERON",
        )
        ncbitaxon = OntologySource(
            name="NCBITAXON",
            description="National Center for Biotechnology Information (NCBI) Organismal Classification",
            version="2",
            file="http://data.bioontology.org/ontologies/NCBITAXON",
        )
        i.ontology_source_references.append(uberon)
        i.ontology_source_references.append(ncbitaxon)

        s = Study(filename="s_pool.txt")

        sample_collection_protocol = Protocol(
            name="sample collection", protocol_type=OntologyAnnotation(term="sample collection")
        )
        s.protocols.append(sample_collection_protocol)

        reference_descriptor_category = OntologyAnnotation(term="reference descriptor")
        material_type_category = OntologyAnnotation(term="material type")
        organism_category = OntologyAnnotation(term="organism")

        source1 = Source(name="source1")
        source1.characteristics = [
            Characteristic(category=reference_descriptor_category, value="not applicable"),
            Characteristic(category=material_type_category, value="specimen"),
            Characteristic(
                category=organism_category,
                value=OntologyAnnotation(
                    term="Human", term_source=ncbitaxon, term_accession="http://purl.bioontology.org/ontology/STY/T016"
                ),
            ),
        ]

        sample1 = Sample(name="sample1")
        organism_part = OntologyAnnotation(term="organism part")
        sample1.characteristics.append(
            Characteristic(
                category=organism_part,
                value=OntologyAnnotation(
                    term="liver", term_source=uberon, term_accession="http://purl.obolibrary.org/obo/UBERON_0002107"
                ),
            )
        )

        sample2 = Sample(name="sample2")
        sample2.characteristics.append(
            Characteristic(
                category=organism_part,
                value=OntologyAnnotation(
                    term="heart", term_source=uberon, term_accession="http://purl.obolibrary.org/obo/UBERON_0000948"
                ),
            )
        )

        sample3 = Sample(name="sample3")
        sample3.characteristics.append(
            Characteristic(
                category=organism_part,
                value=OntologyAnnotation(
                    term="blood", term_source=uberon, term_accession="http://purl.obolibrary.org/obo/UBERON_0000178"
                ),
            )
        )

        sample4 = Sample(name="sample4")
        sample4.characteristics.append(
            Characteristic(
                category=organism_part,
                value=OntologyAnnotation(
                    term="blood", term_source=uberon, term_accession="http://purl.obolibrary.org/obo/UBERON_0000178"
                ),
            )
        )

        sample_collection_process = Process(executes_protocol=sample_collection_protocol)

        sample_collection_process.inputs = [source1]
        sample_collection_process.outputs = [sample1, sample2, sample3, sample4]
        s.process_sequence = [sample_collection_process]
        from isatools.model.v1 import _build_assay_graph

        s.graph = _build_assay_graph(s.process_sequence)
        i.studies = [s]
        isatab.dump(i, self._tmp_dir)
        self.assertTrue(
            assert_tab_content_equal(
                open(os.path.join(self._tmp_dir, "s_pool.txt")),
                open(os.path.join(self._tab_data_dir, "TEST-ISA-source-split", "s_TEST-Template1-Splitting.txt")),
            )
        )
Ejemplo n.º 27
0
    def test_isatab_dump_source_sample_split(self):
        i = Investigation()
        uberon = OntologySource(
            name='UBERON',
            description="Uber Anatomy Ontology",
            version='216',
            file='http://data.bioontology.org/ontologies/UBERON')
        ncbitaxon = OntologySource(
            name='NCBITAXON',
            description=
            "National Center for Biotechnology Information (NCBI) Organismal Classification",
            version='2',
            file='http://data.bioontology.org/ontologies/NCBITAXON')
        i.ontology_source_references.append(uberon)
        i.ontology_source_references.append(ncbitaxon)

        s = Study(filename='s_pool.txt')

        sample_collection_protocol = Protocol(
            name='sample collection',
            protocol_type=OntologyAnnotation(term='sample collection'))
        s.protocols.append(sample_collection_protocol)

        reference_descriptor_category = OntologyAnnotation(
            term='reference descriptor')
        material_type_category = OntologyAnnotation(term='material type')
        organism_category = OntologyAnnotation(term='organism')

        source1 = Source(name='source1')
        source1.characteristics = [
            Characteristic(category=reference_descriptor_category,
                           value='not applicable'),
            Characteristic(category=material_type_category, value='specimen'),
            Characteristic(
                category=organism_category,
                value=OntologyAnnotation(
                    term='Human',
                    term_source=ncbitaxon,
                    term_accession=
                    'http://purl.bioontology.org/ontology/STY/T016')),
        ]

        sample1 = Sample(name='sample1')
        organism_part = OntologyAnnotation(term='organism part')
        sample1.characteristics.append(
            Characteristic(category=organism_part,
                           value=OntologyAnnotation(
                               term='liver',
                               term_source=uberon,
                               term_accession=
                               'http://purl.obolibrary.org/obo/UBERON_0002107',
                           )))

        sample2 = Sample(name='sample2')
        sample2.characteristics.append(
            Characteristic(category=organism_part,
                           value=OntologyAnnotation(
                               term='heart',
                               term_source=uberon,
                               term_accession=
                               'http://purl.obolibrary.org/obo/UBERON_0000948',
                           )))

        sample3 = Sample(name='sample3')
        sample3.characteristics.append(
            Characteristic(category=organism_part,
                           value=OntologyAnnotation(
                               term='blood',
                               term_source=uberon,
                               term_accession=
                               'http://purl.obolibrary.org/obo/UBERON_0000178',
                           )))

        sample4 = Sample(name='sample4')
        sample4.characteristics.append(
            Characteristic(category=organism_part,
                           value=OntologyAnnotation(
                               term='blood',
                               term_source=uberon,
                               term_accession=
                               'http://purl.obolibrary.org/obo/UBERON_0000178',
                           )))

        sample_collection_process = Process(
            executes_protocol=sample_collection_protocol)

        sample_collection_process.inputs = [source1]
        sample_collection_process.outputs = [
            sample1, sample2, sample3, sample4
        ]
        s.process_sequence = [sample_collection_process]
        from isatools.model.v1 import _build_assay_graph
        s.graph = _build_assay_graph(s.process_sequence)
        i.studies = [s]
        isatab.dump(i, self._tmp_dir)
        self.assertTrue(
            assert_tab_content_equal(
                open(os.path.join(self._tmp_dir, 's_pool.txt')),
                open(
                    os.path.join(self._tab_data_dir, 'TEST-ISA-source-split',
                                 's_TEST-Template1-Splitting.txt'))))
Ejemplo n.º 28
0
 def test_json2isatab_convert_source_split_study_table(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'TEST-ISA-source-split.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 's_TEST-Template1-Splitting.txt')),
                                              open(os.path.join(self._tab_data_dir, 'TEST-ISA-source-split',
                                                                's_TEST-Template1-Splitting.txt'))))
Ejemplo n.º 29
0
 def test_assert_tab_content_equal_assay_table(self):
     self.assertTrue(utils.assert_tab_content_equal(self.s_tab1, self.s_tab2))
Ejemplo n.º 30
0
 def test_assert_tab_content_equal_investigation(self):
     self.assertTrue(utils.assert_tab_content_equal(self.i_tab1, self.i_tab2))
Ejemplo n.º 31
0
 def test_json2isatab_convert_bii_s_7_study_table(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 's_BII-S-7.txt')),
                                              open(os.path.join(self._tab_data_dir, 'BII-S-7', 's_BII-S-7.txt'))))
Ejemplo n.º 32
0
 def test_json2isatab_convert_bii_s_7_investigation(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')), self._tmp_dir,
                         i_file_name='i_matteo.txt')
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'i_matteo.txt')),
                                              open(os.path.join(self._tab_data_dir, 'BII-S-7', 'i_matteo.txt'))))
Ejemplo n.º 33
0
 def test_json2isatab_convert_bii_s_3_assay_table_Gx(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'BII-S-3', 'BII-S-3.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 'a_gilbert-assay-Gx.txt')),
                                              open(os.path.join(self._tab_data_dir, 'BII-S-3',
                                                                'a_gilbert-assay-Gx.txt'))))
Ejemplo n.º 34
0
 def test_json2isatab_convert_sample_pool_assay_table(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'TEST-ISA-sample-pool.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(
         open(os.path.join(self._tmp_dir, 'a_test-template3-splitting_transcription_profiling_DNA_microarray.txt')),
         open(os.path.join(self._tab_data_dir, 'TEST-ISA-sample-pool',
                           'a_test-template3-splitting_transcription_profiling_DNA_microarray.txt'))))
Ejemplo n.º 35
0
 def test_json2isatab_convert_sample_pool_study_table(self):
     json2isatab.convert(open(os.path.join(self._json_data_dir, 'TEST-ISA-sample-pool.json')), self._tmp_dir)
     self.assertTrue(assert_tab_content_equal(open(os.path.join(self._tmp_dir, 's_TEST-Template3-Splitting.txt')),
                                              open(os.path.join(self._tab_data_dir, 'TEST-ISA-sample-pool',
                                                                's_TEST-Template3-Splitting.txt'))))