samtools view: failed to open "sort" for reading: No such file or directory
2
0
Entering edit mode
6.7 years ago
oars ▴ 200

I'm having an issue with the "SAM-BAM conversion and sorting steps together" command. After the following command...

bwa mem -t2 -R '@RG\tID:NA12878\tSM:NA12878\tLB:NA12878' genome.fa SRR1611183_1.fastq.gz `SRR1611183_2.fastq.gz |samtools view -u -samtools sort -@2 - > SRR1611183.bam`

...I get the following error:

E::hts_open_format] Failed to open file sort
samtools view: failed to open "sort" for reading: No such file or directory
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 200000 sequences (20000000 bp)...
[M::process] read 200000 sequences (20000000 bp)...
[M::mem_pestat] # candidate unique pairs for (FF, FR, RF, RR): (5, 72922, 1, 3)
[M::mem_pestat] skip orientation FF as there are not enough pairs
[M::mem_pestat] analyzing insert size distribution for orientation FR...
[M::mem_pestat] (25, 50, 75) percentile: (216, 239, 258)
[M::mem_pestat] low and high boundaries for computing mean and std.dev: (132, 342)
[M::mem_pestat] mean and std.dev: (235.53, 32.36)
[M::mem_pestat] low and high boundaries for proper pairs: (90, 384)
[M::mem_pestat] skip orientation RF as there are not enough pairs
[M::mem_pestat] skip orientation RR as there are not enough pairs
[M::mem_process_seqs] Processed 200000 reads in 32.785 CPU sec, 16.249 real sec

The command actually still runs but changes your SRR1611183.bam so that there is now 0 bytes on data in the file.

I'm a little scared to repeat this command since you need to reconstruct your SRR1611183.bam file which takes about 30-40 mins. I'd hate to wipe it out again.

Does anyone see a glaring error in my bwa mem script?

samtools • 5.2k views
ADD COMMENT
1
Entering edit mode

samtools view -u -samtools

Looks weird to me. Why's there a -samtools flag? Is it supposed to be a | samtools perhaps?

ADD REPLY
1
Entering edit mode

|samtools view -u -samtools sort

you are missing a pipe here.

ADD REPLY
3
Entering edit mode
6.7 years ago

the problem is here:

... |samtools view -u -samtools sort -@2

you want (with a recent version of samtools)

 .... | samtools sort -@2  -T SRR1611183tmp  -o SRR1611183.bam -
ADD COMMENT
0
Entering edit mode

Thanks - I see the pipe I missed. Many thanks to all!

ADD REPLY
1
Entering edit mode
6.7 years ago

Why not just this?

bwa mem -t2 -R '@RG\tID:NA12878\tSM:NA12878\tLB:NA12878' genome.fa SRR1611183_1.fastq.gz SRR1611183_2.fastq.gz | samtools sort -@2 - > SRR1611183.bam
ADD COMMENT

Login before adding your answer.

Traffic: 1659 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6