Skip to content

Instantly share code, notes, and snippets.

@brwnj
Last active December 4, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brwnj/ff417957337e63314215ac38ce90cb7b to your computer and use it in GitHub Desktop.
Save brwnj/ff417957337e63314215ac38ce90cb7b to your computer and use it in GitHub Desktop.
params.bams
// mosdepth is going to need a prefix, a bam, and its index
bams_ch = Channel
// grab the bams and/or crams
.fromPath(params.bams, checkIfExists: true)
// set the first element to the basename of the file without its extension
// the second element to the alignments (bam or cram)
// and the third element to the index
.map { file -> tuple(file.baseName, file, file + ("${file}".endsWith('.cram') ? '.crai' : '.bai')) }
process mosdepth {
publishDir "./results"
cpus 3
memory 4.GB
time '12h'
container 'quay.io/biocontainers/mosdepth:0.2.6--hfb13731_0'
input:
set sample, file(bam), file(bai) from bams_ch
output:
file("${sample}.mosdepth.summary.txt")
script:
"""
mosdepth -n -t 3 ${sample} $bam
"""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment