Skip to content

Commit

Permalink
fix: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
epruesse committed Oct 11, 2023
1 parent e6b3aca commit e66af2b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/ymp/rules/multiqc.rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ with Stage("qc_multiqc") as S:
sp = {}
module_order = []
sample_names_replace = {}
for conffile in input.conf:
for conffile in ensure_list(input.conf):
with open(conffile, "r") as fd:
data = yaml.load(fd)
run_modules.extend(data.get("run_modules", []))
Expand Down Expand Up @@ -53,7 +53,7 @@ with Stage("qc_multiqc") as S:
benchmark:
"benchmarks/{:name:}/{:this:}/all.txt",
params:
dirs = lambda wc, input: [os.path.dirname(p) for p in input.parts]
dirs = lambda wc, input: [os.path.dirname(p) for p in ensure_list(input.parts)]
log:
"{:this:}/multiqc.log"
resources:
Expand All @@ -70,6 +70,3 @@ with Stage("qc_multiqc") as S:
" --config {input.conf}"
" --filename {output.report}"
" {params.dirs}"



22 changes: 17 additions & 5 deletions src/ymp/rules/salmon.rules
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ with Stage("index_salmon_decoy") as S:
with Stage("quant_salmon_sa") as S:
S.doc("""
""")
S.add_param("L", typ="choice", name="libtype", default="A",
S.add_param("L", typ="choice", name="libtype", default="A",
value=["A", "IU", "MU", "OU", "ISF", "ISR", "MSF", "MSR", "OSF", "OSR",
"U", "SF", "SR"])
rule salmon_sa_quant:
Expand Down Expand Up @@ -154,8 +154,8 @@ with Stage("quant_salmon_sa") as S:
}
with open(output[0], "w") as out:
yaml.dump(data, out)


with Stage("quant_salmon") as S:
S.doc("""
""")
Expand Down Expand Up @@ -183,7 +183,9 @@ with Stage("quant_salmon") as S:
mem = "48G",
shell:
"exec >{log} 2>&1;"
"salmon quant"
"echo Launching salmon on $HOSTNAME;"
"set -x; "
"if ! salmon quant"
" --libType {params.libtype}"
" --threads {threads}"
" --seqBias"
Expand All @@ -193,7 +195,17 @@ with Stage("quant_salmon") as S:
" --targets {input.txfa}"
" --output $(dirname {output.quant})"
" --minAssignedFrags 0"
" {params.gencode}"
" {params.gencode}; then"
" echo Salmon or Samtools failed;"
" if tail -n1 $(dirname {output.quant})/logs/salmon_quant.log |"
" grep -qE ' [0-9]+ fragments were mapped, but the number of burn-in fragments'; then"
" echo Salmon found insufficient fragments. Faking output.;"
" touch {output.unmapped};"
" echo -e 'Name\tLength\tEffectiveLength\tTPM\tNumReads' > {output.quant};"
" exit 0;"
" fi;"
" exit 1;"
"fi;"

localrules: salmon_quant_multiqc_cfg
rule salmon_quant_multiqc_cfg:
Expand Down

0 comments on commit e66af2b

Please sign in to comment.