예제 #1
0
 def test_convert_miniml_control():
     geo_id = 'GSE99650'
     gsm_id = 'GSM2649283'
     test_data_dir = f'docs/example_data/{geo_id}' # created by this in test environment
     testargs = ["__program__", '-i', geo_id, '-d', test_data_dir, '-k', 'SKTR']
     with patch.object(sys, 'argv', testargs):
         convert_miniml(
             geo_id,
             data_dir=test_data_dir,
             merge=True,
             download_it=True,
             extract_controls=True,
             require_keyword=None,
             sync_idats=True,
             remove_tgz=True,
             verbose=True)
         files_found = list(Path(test_data_dir).rglob('*'))
         if len(files_found) != 3:
             raise AssertionError("Did not download all the files.")
         samplesheet = pd.read_csv(Path(test_data_dir,f'{geo_id}_GPL13534_samplesheet.csv'))
         if samplesheet['GSM_ID'][0] != gsm_id:
             raise AssertionError("Samplesheet did not contain the right data.")
         if len(samplesheet['GSM_ID']) != 1:
             raise AssertionError("Control filtering failed")
         for file in Path(test_data_dir).rglob('*.xml'):
             file.unlink()
         for file in Path(test_data_dir).rglob('*.pkl'):
             file.unlink()
         for file in Path(test_data_dir).rglob('*.csv'):
             file.unlink()
         for file in Path(test_data_dir).rglob('*.tgz'):
             file.unlink()
         Path(test_data_dir).rmdir()
예제 #2
0
 def test_convert_miniml():
     geo_id = 'GSE17769'
     test_data_dir = f'docs/example_data/{geo_id}'  # created by this in test environment
     testargs = ["__program__", '-i', geo_id, '-d', test_data_dir]
     with patch.object(sys, 'argv', testargs):
         convert_miniml(geo_id,
                        data_dir=test_data_dir,
                        merge=True,
                        download_it=True,
                        extract_controls=False,
                        require_keyword=None,
                        sync_idats=True,
                        remove_tgz=True,
                        verbose=True)
         #for file in Path(test_data_dir).rglob('*.xml'):
         #    file.unlink()
         shutil.rmtree(test_data_dir)