Beispiel #1
0
def test_tobam():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/tobam/data")
        expected_path = PurePosixPath(".tests/unit/tobam/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print("SLX-19014.ATACAd001.HYTFKDRXX.bam", file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "SLX-19014.ATACAd001.HYTFKDRXX.bam",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #2
0
def test_sklearn_glasso():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/sklearn_glasso/data")
        expected_path = PurePosixPath(".tests/unit/sklearn_glasso/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print(
            "results/adjmat_estimate/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/sklearn_glasso/alg_params=/mode=cd/alpha=0.05/tol=0.0004/enet_tol=0.0004/precmat_threshold=0.1/max_iter=100/verbose=False/assume_centered=False/seed=1/adjmat.csv results/time/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/sklearn_glasso/alg_params=/mode=cd/alpha=0.05/tol=0.0004/enet_tol=0.0004/precmat_threshold=0.1/max_iter=100/verbose=False/assume_centered=False/seed=1/time.txt",
            file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "results/adjmat_estimate/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/sklearn_glasso/alg_params=/mode=cd/alpha=0.05/tol=0.0004/enet_tol=0.0004/precmat_threshold=0.1/max_iter=100/verbose=False/assume_centered=False/seed=1/adjmat.csv results/time/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/sklearn_glasso/alg_params=/mode=cd/alpha=0.05/tol=0.0004/enet_tol=0.0004/precmat_threshold=0.1/max_iter=100/verbose=False/assume_centered=False/seed=1/time.txt",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #3
0
def test_mcmc_traj_plot():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/mcmc_traj_plot/data")
        expected_path = PurePosixPath(".tests/unit/mcmc_traj_plot/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print(
            "results/evaluation=/mcmc_traj_plots/burn_in=400/thinning=1000/functional=score/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/gt13_multipair/alg_params=/n_samples=1000000/datatype=continuous/randomits=1000/prior=mbc/ascore=None/bscore=None/clq=1/sep=1/penalty=None/mcmc_seed=1/seed=1/traj_plot.eps",
            file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "results/evaluation=/mcmc_traj_plots/burn_in=400/thinning=1000/functional=score/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/gt13_multipair/alg_params=/n_samples=1000000/datatype=continuous/randomits=1000/prior=mbc/ascore=None/bscore=None/clq=1/sep=1/penalty=None/mcmc_seed=1/seed=1/traj_plot.eps",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #4
0
def test_sample_intra_class_data():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/sample_intra_class_data/data")
        expected_path = PurePosixPath(".tests/unit/sample_intra_class_data/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print("results/data/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/n=1000/seed=1.csv", file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake", 
            "results/data/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/n=1000/seed=1.csv",
            "-F", 
            "-j1",
            "--keep-target-files",
    
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file), 
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #5
0
def test_adjmat_plot():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/adjmat_plot/data")
        expected_path = PurePosixPath(".tests/unit/adjmat_plot/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print(
            "results/adjmat_estimate/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/order_mcmc/alg_params=/startspace_algorithm=itsearch/alg_params=/estimate=endspace/MAP=False/plus1it=6/posterior=0.5/scoretype=bge/chi=None/edgepf=None/am=0.1/aw=None/softlimit=9/hardlimit=14/alpha=0.01/gamma=1/cpdag=False/mergetype=skeleton/plus1=True/scoretype=bge/chi=None/edgepf=None/aw=None/am=0.1/alpha=0.05/gamma=1/stepsave=None/iterations=None/MAP=False/cpdag=False/mcmc_seed=1/estimation_method/threshold=0.5/burnin=0/seed=1/adjmat.eps",
            file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "results/adjmat_estimate/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/order_mcmc/alg_params=/startspace_algorithm=itsearch/alg_params=/estimate=endspace/MAP=False/plus1it=6/posterior=0.5/scoretype=bge/chi=None/edgepf=None/am=0.1/aw=None/softlimit=9/hardlimit=14/alpha=0.01/gamma=1/cpdag=False/mergetype=skeleton/plus1=True/scoretype=bge/chi=None/edgepf=None/aw=None/am=0.1/alpha=0.05/gamma=1/stepsave=None/iterations=None/MAP=False/cpdag=False/mcmc_seed=1/estimation_method/threshold=0.5/burnin=0/seed=1/adjmat.eps",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
def test_index():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/index/data")
        expected_path = PurePosixPath(".tests/unit/index/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print(
            "Homo_sapiens_assembly38.fasta.fai Homo_sapiens_assembly38.rev.1.bt2 Homo_sapiens_assembly38.rev.2.bt2 Homo_sapiens_assembly38.1.bt2 Homo_sapiens_assembly38.2.bt2 Homo_sapiens_assembly38.3.bt2 Homo_sapiens_assembly38.4.bt2",
            file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "Homo_sapiens_assembly38.fasta.fai Homo_sapiens_assembly38.rev.1.bt2 Homo_sapiens_assembly38.rev.2.bt2 Homo_sapiens_assembly38.1.bt2 Homo_sapiens_assembly38.2.bt2 Homo_sapiens_assembly38.3.bt2 Homo_sapiens_assembly38.4.bt2",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #7
0
def test_trilearn():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/trilearn/data")
        expected_path = PurePosixPath(".tests/unit/trilearn/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print("results/adjvecs/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/trilearn/alg_params=/datatype=continuous/alpha=0.5/beta=0.5/radii=80/N=50/M=100/pseudo_obs=1/mcmc_seed=1/seed=1/adjvecs.csv results/time/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/trilearn/alg_params=/datatype=continuous/alpha=0.5/beta=0.5/radii=80/N=50/M=100/pseudo_obs=1/mcmc_seed=1/seed=1/time.txt", file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake", 
            "results/adjvecs/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/trilearn/alg_params=/datatype=continuous/alpha=0.5/beta=0.5/radii=80/N=50/M=100/pseudo_obs=1/mcmc_seed=1/seed=1/adjvecs.csv results/time/adjmat=/bdgraph_graphsim/p=50/graph=circle/class=None/size=None/prob=0.2/seed=1/parameters=/intra-class/rho=0.4/sigma2=1.0/seed=1/data=/iid/standardized=False/n=1000/algorithm=/trilearn/alg_params=/datatype=continuous/alpha=0.5/beta=0.5/radii=80/N=50/M=100/pseudo_obs=1/mcmc_seed=1/seed=1/time.txt",
            "-F", 
            "-j1",
            "--keep-target-files",
    
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file), 
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #8
0
def test_download():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/download/data")
        expected_path = PurePosixPath(".tests/unit/download/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print(
            "Homo_sapiens_assembly38.fasta Homo_sapiens_assembly38.dbsnp138.vcf Homo_sapiens_assembly38.known_indels.vcf.gz Mills_and_1000G_gold_standard.indels.hg38.vcf.gz Axiom_Exome_Plus.genotypes.all_populations.poly.hg38.vcf.gz 1000G_phase1.snps.high_confidence.hg38.vcf.gz 1000G_omni2.5.hg38.vcf.gz hapmap_3.3.hg38.vcf.gz",
            file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "Homo_sapiens_assembly38.fasta Homo_sapiens_assembly38.dbsnp138.vcf Homo_sapiens_assembly38.known_indels.vcf.gz Mills_and_1000G_gold_standard.indels.hg38.vcf.gz Axiom_Exome_Plus.genotypes.all_populations.poly.hg38.vcf.gz 1000G_phase1.snps.high_confidence.hg38.vcf.gz 1000G_omni2.5.hg38.vcf.gz hapmap_3.3.hg38.vcf.gz",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #9
0
def test_extendInterval():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = PurePosixPath(".tests/unit/extendInterval/data")
        expected_path = PurePosixPath(".tests/unit/extendInterval/expected")

        # Copy data to the temporary workdir.
        shutil.copytree(data_path, workdir)

        # dbg
        print("results/workflow/GRCh38/A.extended.bed", file=sys.stderr)

        # Run the test job.
        sp.check_output([
            "python",
            "-m",
            "snakemake",
            "results/workflow/GRCh38/A.extended.bed",
            "-F",
            "-j1",
            "--keep-target-files",
            "--directory",
            workdir,
        ])

        # Check the output byte by byte using cmp.
        # To modify this behavior, you can inherit from common.OutputChecker in here
        # and overwrite the method `compare_files(generated_file, expected_file),
        # also see common.py.
        common.OutputChecker(data_path, expected_path, workdir).check()
Beispiel #10
0
def test_all():

    with TemporaryDirectory() as tmpdir:
        workdir = Path(tmpdir) / "workdir"
        data_path = ".tests/unit/all/data"
        expected_path = ".tests/unit/all/expected"

        # copy data to the temporary workdir
        shutil.copytree(data_path, workdir)

        # run the test job
        sp.check_output([
            "snakemake", 
            "all", 
            "-F", 
            "-j1",
            "--directory",
            workdir,
        ])

        # check the output
        common.OutputChecker(data_path, expected_path, workdir).check()