def test_write_mapping_file(self): """ test_write_mapping_file: This function writes a QIIME-formatted mapping file """ # write minimal mapping file write_mapping_file(0,False,self.output_dir,True) open_fpath=open(join(self.output_dir,'study_0_run_Fasting_subset_mapping.txt')).read() # this will return just a mapping file with the header, since # study 0 is not assigned in the USER_STUDY table self.assertEqual(open_fpath,exp_mapping) # write full mapping file write_mapping_file(0,True,self.output_dir,True) open_fpath=open(join(self.output_dir,'study_0_run_Fasting_subset_mapping.txt')).read() # this will return just a mapping file with the header, since # study 0 is not assigned in the USER_STUDY table self.assertEqual(open_fpath,exp_full_mapping)
def main(): option_parser, opts, args =\ parse_command_line_parameters(**script_info) # create output directory if opts.output_dir: if path.exists(opts.output_dir): dir_path=opts.output_dir else: try: makedirs(opts.output_dir) dir_path=opts.output_dir except OSError: pass else: dir_path='./' get_from_test_db=opts.get_from_test_db study_id=opts.study_id write_full_mapping=opts.write_full_mapping run_prefixes=write_mapping_file(study_id,write_full_mapping,dir_path,get_from_test_db)