Ejemplo n.º 1
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.º 2
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.º 3
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.º 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_s_3_study_table(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, 's_BII-S-3.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-S-3',
                              's_BII-S-3.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 6
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.º 7
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.º 8
0
 def test_json2isatab_convert_bii_s_7_assay_table_Gx(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,
                            'a_matteo-assay-Gx.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir, 'BII-S-7',
                              'a_matteo-assay-Gx.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_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.º 10
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.º 11
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
     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_transcriptome.txt')) as out_fp:
         with open(
                 os.path.join(self._tab_data_dir,
                              'BII-I-1_written_by_isatab',
                              'a_transcriptome.txt')) as reference_fp:
             self.assertTrue(assert_tab_content_equal(out_fp, reference_fp))
Ejemplo n.º 12
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.º 13
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,
                            '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.º 14
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))