Question: Error Using Samtools To View Content In .Sam File
0
gravatar for soosus
6.6 years ago by
soosus80
soosus80 wrote:

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.

samtools sam bash • 4.3k views
ADD COMMENTlink modified 6.0 years ago by Biostar ♦♦ 20 • written 6.6 years ago by soosus80
3
gravatar for Pierre Lindenbaum
6.6 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum124k wrote:

your input is SAM , not BAM

use

 gunzip -c myfile.sam.gz | samtools view -S -f 0x10 -T reference.fa -
ADD COMMENTlink modified 6.6 years ago • written 6.6 years ago by Pierre Lindenbaum124k

I'm getting this:

[samopen] no @SQ lines in the header.
[sam_read1] missing header? Abort!
ADD REPLYlink written 6.6 years ago by soosus80

I've updated my answer.

ADD REPLYlink written 6.6 years ago by Pierre Lindenbaum124k

Thanks very much!

ADD REPLYlink modified 6.6 years ago • written 6.6 years ago by soosus80
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1836 users visited in the last hour