Skip to content

Commit

Permalink
fix: localrules cannot use tmpdir as slurm job id
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Oct 15, 2024
1 parent ad38002 commit 7f25ec4
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions workflow/rules/post_findcircrna_processing.smk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def get_alignment_stats_input(wildcards):
d['star2bam']=join(WORKDIR,"results",sample,"STAR2p",sample+"_p2.bam")
d['star2bam_chimeric']=join(WORKDIR,"results",sample,"STAR2p",sample+"_p2.chimeric.bam")
d['star2bam_non_chimeric']=join(WORKDIR,"results",sample,"STAR2p",sample+"_p2.non_chimeric.bam")
d['filtered_bam']=join(WORKDIR,"results",sample,"circExplorer",sample+".bam")
d['filtered_bam']=join(WORKDIR,"results",sample,"circExplorer",sample+".bam")
d['linearbam']=join(WORKDIR,"results",sample,"circExplorer",sample+".linear.bam")
d['splicedbam']=join(WORKDIR,"results",sample,"circExplorer",sample+".spliced.bam")
d['BSJbam']=join(WORKDIR,"results",sample,"circExplorer",sample+".BSJ.bam")
Expand Down Expand Up @@ -108,21 +108,21 @@ python3 {params.scriptse} \\
fi
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o {output.plusBSJbam} {params.tmpdir}/{params.sample}.BSJ.plus.bam
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o {output.minusBSJbam} {params.tmpdir}/{params.sample}.BSJ.minus.bam
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o {output.plusBSJbam} {params.tmpdir}/{params.sample}.BSJ.plus.bam
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o {output.minusBSJbam} {params.tmpdir}/{params.sample}.BSJ.minus.bam
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o {output.BSJbam} {params.tmpdir}/{params.sample}.BSJ.bam
for b in {output.plusBSJbam} {output.minusBSJbam} {output.BSJbam}
for b in {output.plusBSJbam} {output.minusBSJbam} {output.BSJbam}
# for b in {output.plusBSJbam} {output.minusBSJbam}
do
bash {params.bam2bwscript} $b {params.tmpdir}
done
for i in $(echo {params.host}|tr ',' ' ');do
for i in $(echo {params.host}|tr ',' ' ');do
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o ${{outdir}}/{params.sample}.${{i}}.BSJ.bam {params.tmpdir}/{params.sample}.${{i}}.BSJ.bam
bash {params.bam2bwscript} ${{outdir}}/{params.sample}.${{i}}.BSJ.bam {params.tmpdir}
done
for i in $(echo {params.viruses}|tr ',' ' ');do
for i in $(echo {params.viruses}|tr ',' ' ');do
samtools sort -l 9 -T {params.tmpdir} --write-index -@{threads} -O BAM -o ${{outdir}}/{params.sample}.${{i}}.BSJ.bam {params.tmpdir}/{params.sample}.${{i}}.BSJ.bam
bash {params.bam2bwscript} ${{outdir}}/{params.sample}.${{i}}.BSJ.bam {params.tmpdir}
done
Expand Down Expand Up @@ -253,9 +253,6 @@ rm -rf {params.tmpdir}
# linear_spliced_BSJ_reads_same_strand
# linear_BSJ_reads_opposite_strand
# linear_spliced_BSJ_reads_opposite_strand
localrules:
create_circExplorer_merged_found_counts_table,


rule create_circExplorer_merged_found_counts_table:
input:
Expand Down Expand Up @@ -404,10 +401,6 @@ else:
"""


localrules:
merge_alignment_stats,


rule merge_alignment_stats:
input:
expand(
Expand All @@ -432,7 +425,7 @@ for f in {input};do
paste {output} {params.tmpdir}/${{count}} > {params.tmpdir}/${{count}}.tmp
mv {params.tmpdir}/${{count}}.tmp {output}
fi
done
done
"""


Expand Down

0 comments on commit 7f25ec4

Please sign in to comment.