strand identification from sam file
2
0
Entering edit mode
5.5 years ago
alireza346 ▴ 10

I have .sam files from RNAseq alignment. the alignment was done using Tophat. now, I am trying to split the forward and reverse strands and make two sam files for forward and reverse strands separately. in my sam file I found 4 numbers (codes) to identify strands. the numbers are 0, 16, 272, 256. I used the following link to see which strand they are representing:

https://broadinstitute.github.io/picard/explain-flags.html

I realized that 272 represents reverse strand but for the other 3 codes I got bit confused. can you help me to understand every number represents which strand?

RNA-Seq alignment • 1.7k views
ADD COMMENT
0
Entering edit mode

the sam flag is a bit array : https://en.wikipedia.org/wiki/Bit_array packed in an integer (4 bytes)

A bit array is a mapping from some domain (almost always a range of integers) to values in the set {0, 1}. The values can be interpreted as dark/light, absent/present, locked/unlocked, valid/invalid, etcetera. The point is that there are only two possible values, so they can be stored in one bit

ADD REPLY
1
Entering edit mode
5.3 years ago
cmdcolin ★ 3.8k

To be clear, you should perform a bitwise AND operation on any given number from the flag field so if your flag field is 272, then you say

272 AND 16 which is in binary

  0100010000
& 0000010000
= 0000010000

which is "true", and in this case, means the read is reverse strand. if it was positive strand it might have flag value of say 256 and then the bitwise operation is

  0100000000
& 0000010000
= 0000000000

and that is "false", so this read is not reverse strand

Also note that the strand that a given RNA-seq read does not necessarily indicate that it came from a transcript of that strand (unless you have a stranded rna-seq protocol, in which case it does, but even then if you have a stranded paired-end sequencing protocol, then the mate pair is flipped relative to the actual strand orientation)

ADD COMMENT
0
Entering edit mode
5.3 years ago

Have you googled "explain sam flags"?

Since these is RNAseq, are you sure that knowing the orientation on the genome is really that important?

ADD COMMENT

Login before adding your answer.

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