i have am working on a transcriptomics project of a non-model plant and i want to know from you how to count the uniquely mapped reads in sam format or the bam format. I have done the indexing of my file with BWA-mem algo for the paired end illumina data and generated the sam and bam file using samtools. I used the command $ cut -f1 myfile.sam | sort | uniq -u | wc -l
but i got zero for all the input file. After closely reading the BWA manual i noticed a TAG of XT which i guess will be used to distinguish unique/repeat/Mate -sw etc. but after using the grep in following command:
$ samtools view bwa.bam | grep "XT:A:U"
it yielded zero...
Now i am seriously doubting my commands and getting caught in the vicious circle of various commands including this one:
$ samtools view accepted_hits.bam | awk '$5==255{print $0}' > uniq_mapped_reads.sam
The samtools manual says NO alignment should be assigned a mapping quality of 255. I request you to look into the above query and throw some light on uniquely mapped reads and its searching?? I request you to mail the explanation or links on alok.helix@gmail.com. Thanking you Alok
Hi I have used the following command
This definately cannot be uniquley mapped. then I used
but all are in vain I guess....
kindly read my reply properly "it will only be present if the SAM record is for an aligned read and more than one alignment was found for the read".