def test_raxml_convert_raw_ancestral_states_to_fasta(self): raxml = treebuilders.RAxML(8) raxml.convert_raw_ancestral_states_to_fasta(os.path.join(data_dir, 'raxml_ancestral.state'), os.path.join(data_dir, 'raxml_ancestral.fasta.actual')) assert filecmp.cmp(os.path.join(data_dir, 'raxml_ancestral.fasta.actual'), os.path.join(data_dir, 'raxml_ancestral.fasta.expected')) os.remove(os.path.join(data_dir, 'raxml_ancestral.fasta.actual'))
def test_raxml_treebuilding_command(self): raxml = treebuilders.RAxML(8) raxml.executable = 'DDD' raxml.tree_building_parameters = ['EEE'] assert raxml.tree_building_command( 'AAA', '', 'CCC') == 'DDD EEE -s AAA -n CCC -T 8 > /dev/null 2>&1' raxml.verbose = True raxml.threads = 1 assert raxml.tree_building_command( 'AAA', 'BBB', 'CCC') == 'DDD EEE -s AAA -n CCC -t BBB'
def test_raxml_select_executable_based_on_threads(self, mock_choice): self.assertIs(mock_choice, utils.choose_executable_based_on_processor) raxml = treebuilders.RAxML(8) raxml.single_threaded_executables = ['BBB', 'CCC'] raxml.multi_threaded_executables = ['DDD', 'EEE'] mock_choice.return_value = 'AAA' assert raxml.select_executable_based_on_threads() == 'AAA' mock_choice.assert_called_with(['DDD', 'EEE']) raxml.threads = 1 mock_choice.reset_mock() mock_choice.return_value = None assert raxml.select_executable_based_on_threads() is None mock_choice.assert_any_call(['BBB', 'CCC']) mock_choice.assert_any_call(['DDD', 'EEE'])
def test_raxml_sequence_reconstruction_command(self): raxml = treebuilders.RAxML(8) raxml.executable = 'DDD' raxml.internal_sequence_reconstruction_parameters = ['EEE'] assert raxml.internal_sequence_reconstruction_command('AAA', 'BBB', 'CCC') \ == 'DDD EEE -s AAA -n CCC -T 8 -t BBB > /dev/null 2>&1'
def test_raxml_replace_internal_node_label(self): raxml = treebuilders.RAxML(8, internal_node_prefix='AAA') assert raxml.replace_internal_node_label('Node20') == 'AAANode20'
def test_raxml_select_executable_based_on_threads(self): raxml_st = treebuilders.RAxML(1, model = 'GTRGAMMA') raxml_mt = treebuilders.RAxML(8, model = 'GTRGAMMA') assert (raxml_st.select_executable_based_on_threads() != raxml_mt.select_executable_based_on_threads() or raxml_st.threads > 1)