def test_spectral(): outfile = NamedTemporaryFile(suffix='.txt', delete=False) outfile.close() args = "--matrix {} --numberOfClusters {} --clusterMethod {} \ --outFileName {} -t {} ".format(ROOT + 'test_matrix.mcool', 3, 'spectral', outfile.name, 2).split() scHicClusterCompartments.main(args) assert are_files_equal( ROOT + "scHicClusterCompartments/cluster_spectral.txt", outfile.name)
def test_kmeans_norm_clustering(): outfile = NamedTemporaryFile(suffix='.txt', delete=False) outfile.close() args = "--matrix {} --numberOfClusters {} --clusterMethod {} \ --outFileName {} -t {} --binarization --norm".format( ROOT + 'test_matrix.mcool', 3, 'kmeans', outfile.name, 2).split() scHicClusterCompartments.main(args) assert are_files_equal_clustering( ROOT + "scHicClusterCompartments/cluster_kmeans_binarization_norm.txt", outfile.name)
def test_spectral_extraTrack_clustering(): outfile = NamedTemporaryFile(suffix='.txt', delete=False) outfile.close() args = "--matrix {} --numberOfClusters {} --clusterMethod {} \ --outFileName {} -t {} --binarization --extraTrack {} --norm".format( ROOT + 'test_matrix.mcool', 3, 'spectral', outfile.name, 2, ROOT + 'scHicClusterCompartments/mm9_gene.bed.gz').split() scHicClusterCompartments.main(args) assert are_files_equal_clustering( ROOT + "scHicClusterCompartments/cluster_spectral_binarization_norm_gene_track.txt", outfile.name)
def test_kmeans_histonmark(): outfile = NamedTemporaryFile(suffix='.txt', delete=False) outfile.close() args = "--matrix {} --numberOfClusters {} --clusterMethod {} \ --outFileName {} -t {} --histonMarkType {} --binarization --norm".format( ROOT + 'test_matrix.mcool', 3, 'kmeans', outfile.name, 2, ROOT + 'scHicClusterCompartments/mm9_H3K36me3.bed.gz').split() scHicClusterCompartments.main(args) assert are_files_equal( ROOT + "scHicClusterCompartments/cluster_kmeans_binarization_norm_histon_track.txt", outfile.name)
def test_help(): args = "--help".split() with pytest.raises(SystemExit) as pytest_wrapped_e: scHicClusterCompartments.main(args) assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 0