コード例 #1
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_flash(pipeline_dir):
    # Test using FLASH and parsing its log output
    with chdir(pipeline_dir):
        modify_configuration(settings=[("merge_program", "flash")])
        run_snakemake(targets=["stats/reads.json"])
        # Ensure FLASH was actually run
        assert (pipeline_dir / "reads/2-flash.log").exists()
コード例 #2
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def init_testdata(directory):
    run_init(
        database="testdata/database",
        reads1="testdata/reads.1.fastq.gz",
        directory=str(directory),
    )
    with chdir(directory):
        modify_configuration([("barcode_length_3prime", "21")])
コード例 #3
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_primers(pipeline_dir):
    # Test whether specifying primer sequences leads to a SyntaxError
    with chdir(pipeline_dir):
        modify_configuration(settings=[
            ("forward_primers", "['CGTGA']"),
            ("reverse_primers", "['TTCAC']"),
        ], )
        run_snakemake(dryrun=True)
コード例 #4
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_modify_configuration(pipeline_dir):
    modify_configuration(
        settings=[("d_coverage", "12"), ("j_discovery.allele_ratio", "0.37")],
        path=str(pipeline_dir / "igdiscover.yaml"),
    )
    import ruamel.yaml
    with open(pipeline_dir / "igdiscover.yaml") as f:
        config = ruamel.yaml.safe_load(f)
    assert config["d_coverage"] == 12
    assert config["j_discovery"]["allele_ratio"] == 0.37
コード例 #5
0
def test_modify_configuration(pipeline_dir):
    modify_configuration(
        settings=[("d_coverage", "12"), ("j_discovery.allele_ratio", "0.37")],
        path=str(pipeline_dir / "igdiscover.yaml"),
    )
    from ruamel.yaml import YAML
    yaml = YAML(typ="safe", pure=True)
    with open(pipeline_dir / "igdiscover.yaml") as f:
        config = yaml.load(f)
    assert config["d_coverage"] == 12
    assert config["j_discovery"]["allele_ratio"] == 0.37
コード例 #6
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_fastq_input(has_filtered_tab, tmp_path):
    # Use merged reads from already-run pipeline as input for a new run
    single_reads = has_filtered_tab / "reads" / "2-merged.fastq.gz"
    directory = tmp_path / "singleend-fastq"
    run_init(
        database="testdata/database",
        single_reads=str(single_reads),
        directory=str(directory),
    )
    with chdir(directory):
        modify_configuration([("barcode_length_3prime", "21")])
        run_snakemake(targets=["stats/reads.json"])
コード例 #7
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_fasta_input(has_filtered_tab, tmp_path):
    fasta_path = tmp_path / "justfasta.fasta"
    convert_fastq_to_fasta(
        has_filtered_tab / "reads" / "2-merged.fastq.gz",
        fasta_path,
    )
    directory = tmp_path / "singleend-fasta"
    run_init(
        database="testdata/database",
        single_reads=str(fasta_path),
        directory=str(directory),
    )
    with chdir(directory):
        modify_configuration([("barcode_length_3prime", "21")])
        run_snakemake(targets=["stats/reads.json"])
コード例 #8
0
ファイル: test_commands.py プロジェクト: ressy/IgDiscover
def test_only_forward_primer(pipeline_dir):
    # issue #107 (broken symlink)
    with chdir(pipeline_dir):
        modify_configuration(settings=[("forward_primers", "['CGTGA']")])
        # Create some dummy files so we don’t need to run irrelevant steps of the pipeline
        r = Path("reads")
        r.mkdir()
        with xopen(r / "2-merged.fastq.gz", "w") as f:
            pass
        s = Path("stats")
        s.mkdir()
        with open(s / "merging-successful", "w") as f:
            pass
        with open(s / "reads.json", "w") as f:
            f.write('{"total": 0}')
        with open(s / "trimmed.json", "w") as f:
            f.write('{"trimmed": 0}')
        run_snakemake(targets=["reads/sequences.fasta.gz"])