美文网首页RNA-seqrice related analysisRNASeq 数据分析
估计很多人都像我一样一直没弄懂关于samtools flag 0

估计很多人都像我一样一直没弄懂关于samtools flag 0

作者: 热衷组培的二货潜 | 来源:发表于2019-03-15 20:50 被阅读17次

Question: In Sam Format, Clarify The Meaning Of The "0" Flag.

@Jts, can you comment on Devon Ryan's comment in the answer to my question? I actually realize I agree with him on it that FLAG 0 only mean it's not reverse complemented, not necessarily mapped to forward/+ strand.

A flag field of 0 may or may not mean that a read is actually mapped to the + strand. All it means is that it wasn't reverse complemented. Whether that means it should be assigned to one strand or the other or none at all is dependent on other factors and isn't encoded in BAM files. As an example, most common single-end RNAseq experiments use a stranded protocol wherein alignments with a flag of 0 come from the "-" strand.

Link is here: SAM flag and select reads that map uniquely

Question: SAM flag and select reads that map uniquely

  • Hi Devon, I've spend a lot of time this week trying to REALLY understand this strand, flag, mapping uniqueness issue. I think I'm finally getting my head around it and I have to say I disagree with your first point here on flag 0 meaning. I will outline my thoughts below and please feel free to comment on them. Thanks so much for all the discussions so far.

  • I think a flag field of 0 does mean a read is mapped to the +/forward strand. And flag field indicates where the read itself maps to, between + and - strand of the reference genome.

  • For dUTP-based stranded RNA-seq experiments (Illumina TruSeq stranded), alignments with flag of 0does mean the transcript/gene is on the -/reverse strand as you said, but at the same time, the read itself indeed maps to the +/forward strand, which is the antisense strand for a gene on the -/reverse strand. The "-"strand you mentioned is on the XS:A:-field (in Tophat or hisat2 output) and it's for which strand a transcript/gene (from which the read is derived) is on.It means the read is derived from a transcript/gene on the - strand (although it still maps to the + strand of the genome).

  • Lastly, flag value doesn't tell if a read maps uniquely or not. I need to look for NH:i:field to determine if a read is uniquely mapped.

samtools view bamfile.bam | awk '$2==0'  #will output all the primary alignments mapped to the + strand 
samtools view bamfile.bam | awk '$2==16'  #will output all the primary alignments mapped to the - strand
  • all the primary alignments contain uniquely mapped and primary alignments from multi-mapping reads.

  • uniquely mapped in the above sentence is determined by the aligner and I'm not sure what MAPQ value they have yet.

  • I think I did here in the end of the 3rd paragraph:

  • It means the read is derived from a transcript/gene on the - strand (although it still maps to the + strand of the genome).

  • I agree that for this particular RNA-seq strand thing, we care about where the transcript is located.

陈连福的生信博客 : samtools常用命令详解

Samtools 官方参数

最终我选择了手动提取

samtools view -h $bam | awk 'length($6) == 3 && $$2~/0/ && $5~/255/ || $0 ~/@/' \
  | samtools view -bS | samtools sort -@ 8 > ${sample}_uniq_sorted.bam

相关文章

  • 估计很多人都像我一样一直没弄懂关于samtools flag 0

    Question: In Sam Format, Clarify The Meaning Of The "0" F...

  • 从2017迈向2018

    2017 看到很多人在写2017总结,有的人像我一样,当初立的flag 遗憾都没有实现, 也有的人一直坚持,完成了...

  • 某校2017网安比赛wp

    misc 0x01 can you see the flag? 打开发现是一个pdf: 按照套路,flag估计是被...

  • 艰苦的f

    艰苦的f 26个字母,像我的孩子一样,都起了名字,伴我左左右右。f叫脱离,我一直认为他很高大上,立个flag,热情...

  • 写在“六万重金”之后

    其实我到现在还没明白“六万”是什么概念,就像我始终没弄懂简书里的积分兑换成“简书钻”之后又意味着什么一样。对于这个...

  • 答网友问:你最喜欢的明星是谁?

    其实,我从不追星,如果都像我一样估计明星都饿死了。但如果问你喜欢的演员是谁,我会回答:我最喜欢张国荣。很多人会认为...

  • 曾经立过的flag

    我相信,很多人都立过flag,当时十分有决心并且认为会成功的,想象很美好,现实很残酷!立下的flag终究没...

  • 家长控制脾气的3条建议

    为什么要生孩子呢? 估计很多人像我一样,都认真想过这个问题。生活里多了一个孩子,确实有很多欢笑,也有很多麻烦。 过...

  • 我一直没弄懂爱情

    什么是爱情对于没有一点恋爱经验的我来说,真是个迷,这个迷困了我好久,好久,我对爱情的了解只不过趋于书上那些文字...

  • samtools的flag代表什么

    这篇文章写的非常详细 samtools flags 的含义

网友评论

    本文标题:估计很多人都像我一样一直没弄懂关于samtools flag 0

    本文链接:https://www.haomeiwen.com/subject/cxfdmqtx.html