Hi,everyone
I am new to RNA_seq.
I have used tophat to map the reads to the reference,and got the accepted_hits.bam.Now I want to extract the uniquely mapped reads from the bam file.After searching the Internet and discussing with other people,I know that if the MAPQ field(5 column) in the bam file is 255,it means the read is uniquely mapped.Also it will contain a "NH:i:1" in the optional field.So I use the following command to extract the uniquely mapped reads:
Am I right? Do I miss some point?
I am new to RNA_seq.
I have used tophat to map the reads to the reference,and got the accepted_hits.bam.Now I want to extract the uniquely mapped reads from the bam file.After searching the Internet and discussing with other people,I know that if the MAPQ field(5 column) in the bam file is 255,it means the read is uniquely mapped.Also it will contain a "NH:i:1" in the optional field.So I use the following command to extract the uniquely mapped reads:
Code:
samtools view accepted_hits.bam | awk '$5==255{print $0}' > unique_mapped_reads.sam