From 6c2f89bb6d4a7a7c8fb4f2235d5c783a5b819ecc Mon Sep 17 00:00:00 2001 From: Ruben Vorderman <r.h.p.vorderman@lumc.nl> Date: Wed, 31 Jan 2018 11:25:59 +0100 Subject: [PATCH] add task to get contig with most coverage --- samtools.wdl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 samtools.wdl diff --git a/samtools.wdl b/samtools.wdl new file mode 100644 index 0000000..d3cd5f1 --- /dev/null +++ b/samtools.wdl @@ -0,0 +1,24 @@ +task getContigMostCoverage { + String? preCommand + File bamFile + String? outputFilePath = "output.bam" + command <<< + set -e -o pipefail + ${preCommand} + samtools view -hb wgs1.bam $( \ + samtools idxstats wgs1.bam \ + | grep -ve "^\*" \ + | awk '{ print $1"\t"($3/$2)}' \ + | sort -rnk2 \ + | head -n 1 \ + | cut -f1) \ + > ${outputFilePath} + samtools index ${outputFilePath} + >>> + + parameter_meta { + preCommand: "This command is run before running the samtools command. Can be used to set up environments such as conda." + bamFile: "Must be a sorted BAM file with an index" + outputFilePath: "where the output file is stored" + } +} \ No newline at end of file -- GitLab