Error Using Samtools To View Content In .Sam File
1
0
Entering edit mode
11.6 years ago
soosus ▴ 90

So I'm working with a .SAM file that looks a little like this:

~$ zcat myfile.sam.gz | head -n5

@HD    VN:1.0    SO:coordinate
@RG    ID:PI    SM:PI-887    
@PG    ID:SOLID-GffToSam    VN:1.2.1
61_1240_1410    105    chr1    453    255    37M    *    0    0    CCCTAACCCTAACCCTCGCGGTACCCTCAGCCGGCCC    IIIIIIIIIIIIIIIIIIIIIIHG<II%%IID-;9EI    RG:Z:PI    CS:Z:T20023010023010022333013100222230303001200332030122    CO:i:0    CQ:Z:;B>@<>A=;>?@<74A@3>:6B362+B4%A:>''5%A,%1->%2/)>'3=    MD:Z:37M    NM:i:0
891_487_1977    115    chr1    49291    255    47M    =    52033    2792    TGCAGTGACAATATACATAAACAGTGTATGAAAACTCAAGTAAAATC    5II0/FIEB22IIIIFIII@GIIIIIIIIIIIIIIIIIIIIIIIIII    RG:Z:PI    CS:Z:T12300031201221000213311121100331133331112111131101    CO:i:0    CQ:Z:<A?3>?A:4?:@=8<;>=4@?@64<<801@@9.?>>=26-98/0;<1%'8    MD:Z:47M    NM:i:0

and want to print reads that mapped in opposite orientation to the reference strand using this:

~$ samtools view -f 0x10 myfile.sam.gz

but I keep getting an error that looks like this:

[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
[main_samview] fail to read the header from "solid0388_20100319_1_887_Paired_8.mates.sortedFragments.sam.gz".

Any suggestions? For what it's worth, I'm using the latest version of samtools in Fedora.

sam samtools bash • 6.4k views
ADD COMMENT
3
Entering edit mode
11.6 years ago

your input is SAM , not BAM

use

 gunzip -c myfile.sam.gz | samtools view -S -f 0x10 -T reference.fa -
ADD COMMENT
0
Entering edit mode

I'm getting this:

[samopen] no @SQ lines in the header.
[sam_read1] missing header? Abort!
ADD REPLY
0
Entering edit mode

I've updated my answer.

ADD REPLY
0
Entering edit mode

Thanks very much!

ADD REPLY

Login before adding your answer.

Traffic: 1756 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