diff --git a/samtools.wdl b/samtools.wdl new file mode 100644 index 0000000000000000000000000000000000000000..d3cd5f18e1f409f15b0e81d2e52a2fc5877d5d52 --- /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