nf-core_modules/software/hisat2/main.nf

59 lines
1.6 KiB
Text
Raw Normal View History

2020-03-20 11:04:25 +00:00
nextflow.preview.dsl=2
params.genome = ''
process HISAT2 {
// depending on the genome used one might want/need to adjust the memory settings.
// For the E. coli test data this is probably not required
// label 'bigMem'
// label 'multiCore'
input:
tuple val(name), path(reads)
val (outdir)
val (hisat2_args)
val (verbose)
output:
path "*bam", emit: bam
2020-07-11 11:42:13 +00:00
path "*stats.txt", emit: stats
2020-03-20 11:04:25 +00:00
publishDir "$outdir/hisat2",
mode: "copy", overwrite: true
script:
2020-07-11 11:42:13 +00:00
2020-03-20 11:04:25 +00:00
if (verbose){
println ("[MODULE] HISAT2 ARGS: " + hisat2_args)
}
2020-07-11 11:42:13 +00:00
2020-03-20 11:04:25 +00:00
cores = 4
readString = ""
hisat_options = hisat2_args
// Options we add are
hisat_options = hisat_options + " --no-unal --no-softclip "
if (reads instanceof List) {
readString = "-1 "+reads[0]+" -2 "+reads[1]
hisat_options = hisat_options + " --no-mixed --no-discordant"
}
else {
readString = "-U "+reads
}
index = params.genome["hisat2"]
2020-07-11 11:42:13 +00:00
2020-03-20 11:04:25 +00:00
splices = ''
if (params.genome.containsKey("hisat2_splices")){
splices = " --known-splicesite-infile " + params.genome["hisat2_splices"]
}
else{
println ("No key 'hisat2_splices' was supplied. Skipping...")
}
hisat_name = name + "_" + params.genome["name"]
"""
hisat2 -p ${cores} ${hisat_options} -x ${index} ${splices} ${readString} 2>${hisat_name}_hisat2_stats.txt | samtools view -bS -F 4 -F 8 -F 256 -> ${hisat_name}_hisat2.bam
"""
2020-07-11 11:28:41 +00:00
}