def test_binASC(): '''This test should pass''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "binASC") main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path)
def test_mixed(): '''This test should fail, as we've given PFinder a non-morph model''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "wrongmodel") with pytest.raises(util.PartitionFinderError): main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path)
def test_clustering(folder_name): full_path = os.path.join(HERE, folder_name) error, kind, cmdline = test_container[folder_name] if error is None: main.call_main(kind, '"%s" --raxml %s' % (full_path, cmdline)) elif type(error) == type((0, 0)): pytest.xfail(error[1]) else: with pytest.raises(error): main.call_main(kind, '"%s" --raxml %s' % (full_path, cmdline))
def test_model(): '''This test should pass''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "aictest") main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path) new_file = os.path.join(full_path, "analysis/best_scheme.txt") txt = open(new_file) file_obj = txt.readlines() for x in file_obj: x = x.strip() if "1 |" in x: x = x.split('|') mod = x[1].strip() assert mod == 'MULTISTATE+G'
def test_bic(): '''This test should pass''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "bictest") main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path) new_file = os.path.join(full_path, "analysis/best_scheme.txt") txt = open(new_file) file_obj = txt.readlines() for x in file_obj: x = x.strip() if "Scheme BIC" in x: line = x.split(':') numspace = line[1] num = numspace.strip() num = float(num) num = int(num) assert num == 2
def test_model_greedy_phyml02(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s"' % path_from_function()) assert "only works with nucleotide models" in caplog.text()
def test_model_greedy_raxml02(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s" --raxml' % path_from_function()) assert "Expected ";" (at char 284), (line:9, col:22)" in caplog.text()
from partfinder import main, subset, scheme, config from pympler.classtracker import ClassTracker tracker = ClassTracker() # Plug it in here.. scheme.tracker = tracker scheme.tracker = tracker tracker.track_class(subset.Subset) tracker.track_class(scheme.Scheme) tracker.create_snapshot() main.call_main("DNA", "--raxml examples/nucleotide --cmd ' -T 2'") # main.call_main("DNA", "--raxml Li_2008") tracker.create_snapshot() tracker.stats.print_summary()
def test_greedy_phyml_protein(): main.call_main("protein", '"%s"' % path_from_function())
def test_clustering_phyml_dna(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '--no-ml-tree "%s"' % path_from_function()) assert "Clustering methods are only available when using raxml" in caplog.text()
def test_quick_analysis(test_folder): full_path = os.path.join(HERE, test_folder) main.call_main("DNA", "%s --force-restart" % full_path)
def test_prot(prot): full_path = os.path.join(HERE, prot) main.call_main("protein", '--compare "%s"' % full_path)
def test_greedy_raxml_protein(): main.call_main("protein", '--no-ml-tree "%s" --raxml' % path_from_function())
def test_multi(): '''This test should pass''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "multistate") main.call_main("morphology", '--min-subset-size 1 --raxml "%s"' % full_path)
def test_dna(dna): full_path = os.path.join(HERE, dna) main.call_main("DNA", '--compare "%s"' % full_path)
def test_model_greedy_raxml02(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s" --raxml' % path_from_function()) assert "Expected " " (at char 284), (line:9, col:22)" in caplog.text()
def test_model_greedy_raxml01(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s" --raxml' % path_from_function()) assert "WAG+F' is not a valid model for phylogeny program raxml" in caplog.text( )
def test_overlap_error(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("protein", '"%s"' % path_from_function()) assert "overlaps with previously defined partitions" in caplog.text()
def test_rerun_success(rerun_success): full_path = os.path.join(HERE, rerun_success) load_rerun(full_path) main.call_main("DNA", '"%s"' % full_path)
def test_1subset(): full_path = os.path.join(HERE, "1subset") main.call_main("DNA", '--raxml "%s"' % full_path)
def test_rerun_pf_error(rerun_pf_error): full_path = os.path.join(HERE, rerun_pf_error) load_rerun(full_path) with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s"' % full_path)
def test_alignment_error(caplog): with pytest.raises(alignment.AlignmentError): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "Site 1000 is specified in [data_blocks], but the alignment only has 949 sites." in caplog.text()
def test_rerun_analysis_error(rerun_ana_error): full_path = os.path.join(HERE, rerun_ana_error) load_rerun(full_path) with pytest.raises(analysis.AnalysisError): main.call_main("DNA", '"%s"' % full_path)
def test_morph_tiger(): full_path = os.path.join(HERE, "morph_tiger") main.call_main("morphology", '--raxml --kmeans tiger --min-subset-size 1 "%s"' % full_path)
def test_rerun_config_error(rerun_conf_error): full_path = os.path.join(HERE, rerun_conf_error) load_rerun(full_path) with pytest.raises(config.ConfigurationError): main.call_main("DNA", '"%s"' % full_path)
def test_overlapping_blocks(caplog): with pytest.raises(PartitionFinderError): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "following sites overlap" in caplog.text()
def test_clustering_raxml_dna(): main.call_main("DNA", '--no-ml-tree "%s" --raxml' % path_from_function())
def test_greedy_raxml_dna(): main.call_main("DNA", '"%s" --raxml' % path_from_function())
def test_alignment_error(caplog): with pytest.raises(alignment.AlignmentError): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "Site 1000 is specified in [data_blocks], but the alignment only has 949 sites." in caplog.text( )
def test_model_greedy_phyml03(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s"' % path_from_function()) assert "'WAG+LG+F+I' is not a valid model for phylogeny program phyml" in caplog.text()
def test_missing_sites_warning(caplog): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "These columns are missing from the block definitions" in caplog.text( )
def test_model_greedy_raxml03(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s" --raxml' % path_from_function()) assert "MtArt+I+G+F' is not a valid model for phylogeny program raxml" in caplog.text()
def test_bin(): '''This test should pass''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "bin_wrongdata") main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path)
def test_overlap_error(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "sites overlap in your block definitions" in caplog.text()
def test_grand(): full_path = os.path.join(HERE, "Grande_2013") main.call_main("DNA", '--no-ml-tree --raxml "%s"' % full_path)
def test_clustering_phyml_dna(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '--no-ml-tree "%s"' % path_from_function()) assert "Clustering methods are only available when using raxml" in caplog.text( )
def test_incmat(): '''This test should fail due to incorrect line length''' HERE = os.path.abspath(os.path.dirname(__file__)) full_path = os.path.join(HERE, "incmat") with pytest.raises(util.PartitionFinderError): main.call_main("morphology", '--no-ml-tree --min-subset-size 1 --raxml "%s"' % full_path)
def test_grand(): full_path = os.path.join(HERE, "Grande_2013") main.call_main("DNA", '--raxml "%s"' % full_path)
def test_greedy_phyml_dna(): main.call_main("DNA", '"%s"' % path_from_function())
def test_greedy_phyml_dna(): main.call_main("DNA", '--no-ml-tree "%s"' % path_from_function())
def test_greedy_raxml_protein(): main.call_main("protein", '"%s" --raxml' % path_from_function())
def test_morph_entropy(): full_path = os.path.join(HERE, "morph_entropy") main.call_main("morphology", '--raxml --kmeans entropy --min-subset-size 1 "%s"' % full_path)
def test_model_greedy_phyml03(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s"' % path_from_function()) assert "'WAG+LG+F+I' is not a model/list that is implemented in PartitionFinder." in caplog.text()
def test_DNA_entropy(): full_path = os.path.join(HERE, "DNA_entropy") with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '--raxml --kmeans entropy --min-subset-size 10 "%s"' % full_path)
def test_model_greedy_raxml03(caplog): with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '"%s" --raxml' % path_from_function()) assert "'MTART+I+G+F, WAG+I+G' is/are not a valid model(s)" in caplog.text()
def test_missing_sites_warning(caplog): main.call_main("protein", '--no-ml-tree "%s"' % path_from_function()) assert "These columns are missing from the block definitions" in caplog.text()
def test_grand(): full_path = os.path.join(HERE, "Grande_2013") with pytest.raises(util.PartitionFinderError): main.call_main("DNA", '--no-ml-tree --raxml "%s"' % full_path)
def test_quick_analysis(test_folder): full_path = os.path.join(HERE, test_folder) main.call_main("DNA", '--no-ml-tree "%s" --force-restart' % full_path)
def test_quick_analysis(test_folder): full_path = os.path.join(HERE, test_folder) main.call_main("DNA", '"%s" --force-restart' % full_path)