Skip to content

Commit

Permalink
sort by names
Browse files Browse the repository at this point in the history
  • Loading branch information
CChahrour committed Jun 28, 2024
1 parent 356479b commit 9dedba7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions seqnado/workflow/rules/pileup_default.smk
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,14 @@ rule fragment_bedgraph:
"seqnado_output/logs/bedgraphs/{sample}.log",
shell:
"""
samtools sort -@ {threads} -o {params.outdir}/{wildcards.sample}_sorted.bam {input.bam} -T {params.outdir}/tmp_{wildcards.sample} 2> {log}
samtools index {params.outdir}/{wildcards.sample}_sorted.bam 2>> {log}
samtools sort -n -@ {threads} -o {params.outdir}/{wildcards.sample}_sorted.bam {input.bam} -T {params.outdir}/tmp_{wildcards.sample} 2> {log}
bedtools bamtobed -bedpe -i {params.outdir}/{wildcards.sample}_sorted.bam > {params.outdir}/{wildcards.sample}.bedpe 2>> {log}
awk '$1 == $4 && $6 - $2 < 1000 {{print $1, $2, $6}}' {params.outdir}/{wildcards.sample}.bedpe > {params.outdir}/{wildcards.sample}_filtered.bed 2>> {log}
sort -k1,1 -k2,2n -k3,3n {params.outdir}/{wildcards.sample}_filtered.bed > {params.outdir}/{wildcards.sample}_sorted.bed 2>> {log}
bedtools genomecov -bg -i {params.outdir}/{wildcards.sample}_sorted.bed -g {params.genome} -threads {threads} > {output.bedgraph} 2>> {log}
bedtools genomecov -bg -i {params.outdir}/{wildcards.sample}_sorted.bed -g {params.genome} > {output.bedgraph} 2>> {log}
rm {params.outdir}/{wildcards.sample}.bedpe
rm {params.outdir}/{wildcards.sample}_filtered.bed
rm {params.outdir}/{wildcards.sample}_sorted.bed
rm {params.outdir}/{wildcards.sample}_sorted.bam
rm {params.outdir}/{wildcards.sample}_sorted.bam.bai
rm {params.outdir}/tmp*
"""

0 comments on commit 9dedba7

Please sign in to comment.