Skip to content

Commit 789c12e

Browse files
committed
bedtools: Add genome and sorted flags
1 parent 0e6d09c commit 789c12e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

main.nf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,8 +2054,12 @@ process bedtools {
20542054

20552055
script:
20562056
"""
2057-
bedtools coverage -nonamecheck -a ${anno_file} -b $bam | pigz -p ${task.cpus - 1} > "${bam.baseName}".breadth.gz
2058-
bedtools coverage -nonamecheck -a ${anno_file} -b $bam -mean | pigz -p ${task.cpus - 1} > "${bam.baseName}".depth.gz
2057+
## Create genome file from bam header
2058+
samtools view -H ${bam} | grep @SQ | sed 's/@SQ\tSN:\|LN://g' > genome.txt
2059+
2060+
## Run bedtools
2061+
bedtools coverage -nonamecheck -g genome.txt -sorted -a ${anno_file} -b ${bam} | pigz -p ${task.cpus - 1} > "${bam.baseName}".breadth.gz
2062+
bedtools coverage -nonamecheck -g genome.txt -sorted -a ${anno_file} -b ${bam} -mean | pigz -p ${task.cpus - 1} > "${bam.baseName}".depth.gz
20592063
"""
20602064
}
20612065

0 commit comments

Comments
 (0)