def main(): option_parser, opts, args =\ parse_command_line_parameters(**script_info) if(opts.parallel): tmp_dir='jobs/' make_output_dir(tmp_dir) asr_table, ci_table =run_asr_in_parallel(tree=opts.input_tree_fp,table=opts.input_trait_table_fp,asr_method=opts.asr_method,parallel_method=opts.parallel_method, num_jobs=opts.num_jobs,tmp_dir=tmp_dir,verbose=opts.verbose) else: #call the apporpriate ASR app controller if(opts.asr_method == 'wagner'): asr_table = wagner_for_picrust(opts.input_tree_fp,opts.input_trait_table_fp,HALT_EXEC=opts.debug) elif(opts.asr_method == 'bayestraits'): pass elif(opts.asr_method == 'ace_ml'): asr_table,ci_table = ace_for_picrust(opts.input_tree_fp,opts.input_trait_table_fp,'ML',HALT_EXEC=opts.debug) elif(opts.asr_method == 'ace_pic'): asr_table,ci_table = ace_for_picrust(opts.input_tree_fp,opts.input_trait_table_fp,'pic',HALT_EXEC=opts.debug) elif(opts.asr_method == 'ace_reml'): asr_table,ci_table = ace_for_picrust(opts.input_tree_fp,opts.input_trait_table_fp,'REML',HALT_EXEC=opts.debug) #output the table to file make_output_dir_for_file(opts.output_fp) asr_table.writeToFile(opts.output_fp,sep='\t') #output the CI file (unless the method is wagner) if not (opts.asr_method == 'wagner'): make_output_dir_for_file(opts.output_ci_fp) ci_table.writeToFile(opts.output_ci_fp,sep='\t')
def test_wagner_for_picrust_with_funky_tip_labels(self): """ test_wagner_for_picrust for a tree with quoted tip labels """ actual = wagner_for_picrust(self.in_tree2_fp, self.in_trait3_fp) expected = Table(['nodes', 'trait1', 'trait2'], [['11', '1', '3'], ['12', '2', '3'], ['10', '5', '2'], ['14', '5', '3']]) self.assertEqual(actual.tostring(), expected.tostring())
def test_wagner_for_picrust(self): """ test_wagner_for_picrust functions as expected with valid input """ actual = wagner_for_picrust(self.in_tree1_fp, self.in_trait1_fp) expected = Table(['nodes', 'trait1', 'trait2'], [['11', '1', '3'], ['12', '2', '3'], ['10', '5', '2'], ['14', '5', '3']]) self.assertEqual(actual, expected)
def test_wagner_for_picrust_with_funky_tip_labels(self): """ test_wagner_for_picrust for a tree with quoted tip labels """ actual = wagner_for_picrust(self.in_tree2_fp, self.in_trait3_fp) expected = Table( ["nodes", "trait1", "trait2"], [["11", "1", "3"], ["12", "2", "3"], ["10", "5", "2"], ["14", "5", "3"]] ) self.assertEqual(actual.tostring(), expected.tostring())
def test_wagner_for_picrust(self): """ test_wagner_for_picrust functions as expected with valid input """ actual = wagner_for_picrust(self.in_tree1_fp, self.in_trait1_fp) expected = Table( ["nodes", "trait1", "trait2"], [["11", "1", "3"], ["12", "2", "3"], ["10", "5", "2"], ["14", "5", "3"]] ) self.assertEqual(actual, expected)
def test_wagner_for_picrust_with_funky_tip_labels(self): """ test_wagner_for_picrust for a tree with quoted tip labels """ actual= wagner_for_picrust(self.in_tree2_fp,self.in_trait3_fp) expected=Table(['nodes','trait1','trait2'],[['11','1','3'],['12','2','3'],['10','5','2'],['14','5','3']]) self.assertEqual(actual.tostring(),expected.tostring())
def test_wagner_for_picrust(self): """ test_wagner_for_picrust functions as expected with valid input """ actual= wagner_for_picrust(self.in_tree1_fp,self.in_trait1_fp) expected=Table(['nodes','trait1','trait2'],[['11','1','3'],['12','2','3'],['10','5','2'],['14','5','3']]) self.assertEqual(actual,expected)