I am trying to run my nextflow pipeline, and have gotten this error:
samtools sort: failed to read header from "-"
I'm not sure why this error is occurring.
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
import groovy.io.*
params.t = 8
process joinFastq {
input:
path(ds_directory)
output:
tuple path("joined_${ds_directory.baseName}.fastq"), val("$ds_directory.baseName")
script:
"""
gunzip -c ${ds_directory}/*/fastq_pass/*.fastq.gz >
joined_${ds_directory.baseName}.fastq
"""
}
process minimap2 {
cpus 8
memory "20 GB"
input:
tuple path(fastq), val(baseName)
output:
tuple path("*.bam"), val(baseName)
script:
"""
minimap2 -ax splice -uf -k14 -t 8 ${params.genome} ${fastq} > mapped_${baseName}.sam
samtools view -h -b mapped_${baseName}.sam > ${baseName}.bam
samtools sort -o ${baseName}.bam > ${baseName}_sorted.bam
"""
}
I have tried applying the -h
flag to samtools sort
in the script
samtools sort -h -o ${baseName}.bam > ${baseName}_sorted.bam
and the same error is produced. I'm not sure why the header flag didn't solve this issue.