RNA-seqrice related analysisRNASeq 数据分析

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

2019-03-15  本文已影响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

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

陈连福的生信博客 : 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
上一篇 下一篇

猜你喜欢

热点阅读