This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools error when using pipeline view/sort/index

Hi,

I have tried to use the below pipeline based on the suggestion in this post.

$BWAPATH/bwa mem $REFPATH/hg19 $DATPATH/R1.fastq.gz $DATPATH/R2.fastq.gz | $SAMPATH/samtools view -Sb - | $SAMPATH/samtools sort - sorted && $SAMPATH/samtools index - > $DATPATH/sorted.bam

The subsequent step is failing with error message sorted.bam is not coordinate sorted.

To my surprise, though the above step has completed successfully, it created an empty file.

Could you please help me understand what might be the reason?

pipeline snp next-gen-sequencing samtools

1 answer

One problem is that last line should be something like:

$SAMPATH/samtools index sorted.bam

(I haven't tested the rest but looks ok)

Log in to answer this question.