Skip to content

Commit

Permalink
more formatting fixes and debugging
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsochat@stanford.edu>
  • Loading branch information
vsoch committed Aug 25, 2020
1 parent 9969c05 commit 68bb917
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions bio/benchmark/chm-eval-sample/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
pipefail = "set +o pipefail"

os.system(
f'/bin/bash -c "{pipefail} '
f"{pipefail} "
f"samtools view {fmt} {url} {prefix} > {snakemake.output.bam} "
f"samtools index {snakemake.output.bam} "
f'{log}"'
f"{log}"
)
else:
os.system(
Expand Down
6 changes: 3 additions & 3 deletions bio/bismark/bismark2report/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def answer2bool(v):
skip_optional_reports = answer2bool(
snakemake.params.get("skip_optional_reports", False)
)

for report_name in reports:
path = snakemake.input.get(report_name, "")
if path:
locals()[report_name] = path
cmds.append("--{0} {{{1}}}".format(report_name, report_name))
cmds.append("--%s %s" % (report_name, path))
elif skip_optional_reports:
cmds.append("--{0} 'none'".format(report_name))
cmds.append("--%s 'none'" % report_name)

# log
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
Expand Down
5 changes: 3 additions & 2 deletions bio/bwa/samse/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
__license__ = "MIT"


import os
from os import path


Expand Down Expand Up @@ -50,10 +51,10 @@

# Run command.
os.system(
f"(bwa samse"
f'/bin/bash -c "(bwa samse'
f" {extra}"
f" {snakemake.params.index}"
f" {snakemake.input.sai}"
f" {snakemake.input.fastq}"
f" | " + pipe_cmd + f") {log}"
f" | " + pipe_cmd + f') {log}"'
)
2 changes: 1 addition & 1 deletion bio/fgbio/filterconsensusreads/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)

# Dump the list into three integers
min_reads = " ".join(min_reads)
min_reads = " ".join([str(x) for x in min_reads])

ref = snakemake.params.get("ref", None)
if ref is None:
Expand Down
6 changes: 2 additions & 4 deletions bio/gatk/variantrecalibrator/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,17 @@ def fmt_res(resname, resparams):
"--resource {}".format(fmt_res(resname, resparams))
for resname, resparams in snakemake.params["resources"].items()
]
resources = " ".join(resources)
annotation = " ".join(list(map("-an {}".format, snakemake.params.annotation)))
tranches = ""
if snakemake.output.tranches:
tranches = "--tranches-file " + snakemake.output.tranches

log = snakemake.log_fmt_shell(stdout=True, stderr=True)
command = (
os.system(
f"gatk --java-options '{java_opts}' VariantRecalibrator {extra} {resources} "
f"-R {snakemake.input.ref} -V {snakemake.input.vcf} "
f"-mode {snakemake.params.mode} "
f"--output {snakemake.output.vcf} "
f"{tranches} {annotation} {log}"
)
print("COMMAND")
print(command)
os.system(command)
3 changes: 2 additions & 1 deletion bio/multiqc/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from os import path


input_dirs = set(path.dirname(fp) for fp in snakemake.input)
input_dirs = list(set(path.dirname(fp) for fp in snakemake.input))
input_dirs = " ".join(input_dirs)
output_dir = path.dirname(snakemake.output[0])
output_name = path.basename(snakemake.output[0])
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
Expand Down
9 changes: 4 additions & 5 deletions bio/varscan/mpileup2indel/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
)

# Building output directories
os.makedirs(op.dirname(snakemake.output[0]))
output_dir = op.dirname(snakemake.output[0])
if not os.path.exists(output_dir):
os.makedirs(output_dir)

command = (
os.system(
f'/bin/bash -c "varscan mpileup2indel ' # Tool and its subprocess
f"{extra} " # Extra parameters
f"<( {pileup} ) "
f"> {snakemake.output[0]} " # Path to vcf file
f'{log}"' # Logging behaviour
)

print(command)
os.system(command)
4 changes: 3 additions & 1 deletion bio/varscan/mpileup2snp/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
)

# Building output directories
os.makedirs(op.dirname(snakemake.output[0]))
output_dir = op.dirname(snakemake.output[0])
if not os.path.exists(output_dir):
os.makedirs(output_dir)

os.system(
f'/bin/bash -c "varscan mpileup2snp ' # Tool and its subprocess
Expand Down

0 comments on commit 68bb917

Please sign in to comment.