Skip to content

Commit

Permalink
fix: correct some parameters of ppqt tagalign and ppqt
Browse files Browse the repository at this point in the history
  • Loading branch information
rroutsong committed Jan 3, 2025
1 parent 5d05803 commit ddbafc9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
13 changes: 10 additions & 3 deletions workflow/rules/paired/trim_align_dedup.smk
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,26 @@ rule ppqt:
tmpdir = tmpdir,
container:
config['images']['ppqt']
threads:
int(cluster['ppqt'].get('threads', cluster['__default__']['threads']))
shell:
"""
if [ ! -d "{params.tmpdir}" ]; then mkdir -p "{params.tmpdir}"; fi
tmp=$(mktemp -d -p "{params.tmpdir}")
trap 'rm -rf "${{tmp}}"' EXIT
samtools view -b \\
-@ {threads} \\
-f 66 \\
-o ${{tmp}}/bam1.f66.bam {input};
samtools index ${{tmp}}/bam1.f66.bam;
run_spp.R -c=${{tmp}}/bam1.f66.bam \
-savp={output.pdf} -out={output.ppqt} \
-tmpdir=${{tmp}} -rf
run_spp.R \\
-c=${{tmp}}/bam1.f66.bam \\
-savp={output.pdf} \\
-out={output.ppqt} \\
-tmpdir=${{tmp}} \\
-p={threads} \\
-rf
python {params.scriptPy} -i {output.ppqt} -o {output.txt}
"""
Expand Down
22 changes: 10 additions & 12 deletions workflow/rules/single/trim_align_dedup.smk
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ rule ppqt:
container:
config['images']['ppqt']
threads:
cluster['ppqt'].get('threads', cluster['__default__']['threads'])
int(cluster['ppqt'].get('threads', cluster['__default__']['threads']))
shell:
"""
if [ ! -d "{params.tmpdir}" ]; then mkdir -p "{params.tmpdir}"; fi
Expand All @@ -243,14 +243,14 @@ rule ppqt:
-c={input.bam} \\
-savp={output.pdf} \\
-out={output.ppqt} \\
-p={threads} \\
-tmpdir=${{tmp}}
-tmpdir=${{tmp}} \\
-p={threads}
"""


rule ppqt_tagalign:
input:
bam = join(bam_dir, "{name}.Q5DD_tagAlign.gz")
tagalign = join(bam_dir, "{name}.Q5DD_tagAlign.gz")
output:
ppqt = join(ppqt_dir, "{name}.Q5DD_tagAlign.ppqt.txt"),
pdf = join(ppqt_dir, "{name}.Q5DD_tagAlign.pdf"),
Expand All @@ -262,23 +262,21 @@ rule ppqt_tagalign:
tmpdir = tmpdir,
container:
config['images']['ppqt']
# "docker://seqeralabs/phantompeakqualtools:latest"
threads:
cluster['ppqt_tagalign'].get('threads', cluster['__default__']['threads'])
int(cluster['ppqt_tagalign'].get('threads', cluster['__default__']['threads']))
shell:
"""
if [ ! -d "{params.tmpdir}" ]; then mkdir -p "{params.tmpdir}"; fi
tmp=$(mktemp -d -p "{params.tmpdir}")
trap 'rm -rf "${{tmp}}"' EXIT
ln -s {input.bam} ${{tmp}}/{wildcards.name}.Q5DD_tagAlign.gz
zcat ${{tmp}}/{wildcards.name}.Q5DD_tagAlign.gz | head
# ppqt will not work unless file name ends with ".tagAlign"
# "Q5DD_tagAlign" will not work
gunzip -C {input.tagalign} > ${{tmp}}/{wildcards.name}.Q5DD.tagAlign
run_spp.R \\
-c=${{tmp}}/{wildcards.name}.Q5DD_tagAlign.gz \\
-c=${{tmp}}/{wildcards.name}.Q5DD.tagAlign \\
-savp={output.pdf} \\
-out={output.ppqt} \\
-p={threads} \\
-tmpdir=${{tmp}}
-p={threads}
"""


Expand Down

0 comments on commit ddbafc9

Please sign in to comment.