Hi Alex,
Would you suggest me a way to extract the uniquely mapped reads from the sample_Aligned.sortedByCoord.out.bam? There is a difference between the number (Uniquely mapped reads number 15988433) I found in the sample_Log.final.out file and the number (15916113) I obtained from the use of egrep or fgrep (samtools view -h sample_ Aligned.sortedByCoord.out.bam | fgrep -w NH:i:1 | samtools etc).
Thanks,
ERA
Thanks Alex. I do not think so because the number of reads (15916113) I got from the egrep or fgrep command is 1- lower than the number of the uniquely mapped reads (15988433) in the Log.final.out file; and then 2- the same as I got using samtools –q 255 (15916113). It tested that in two samples.
$samtools view -h -q 255 Aligned.sortedByCoord.out.bam | samtools view | wc -l
31832226, after dividing this number by 2 (pair-end samples), I got 15916113
My math is presently correct. Yes, STAR allowed SE alignment because some mates have different lengths after trimming. So according to you, I can use $samtools view -q 255 Aligned.out.bam to get all uniquely mapped reads. Please confirm if I am right.
Thanks