I want to get count of unmapped reads at specific position. After searching the google, I am able to do that using below command with
samtools view -f 4 [bam]
But this is not what I am looking for. It's because I wanted to find the count of unmapped reads at the specific positions , not all over the sequences, therefore I added other options and I finally got the unmapped reads at the specific positions as shown in command below.
samtools view -f 4 -L /DATA2/sclee1/URC_WES/ml/allel_info/ms/ms_AYA06_mpileup_modified.bed 01U_T_Filtered_Sorted_Makrdup_Readgroup_Realigned_Recal.bam
However, I have to do additional works to count reads at each site because command above just outputs a list of reads information (not total count). Therefore, it is a little nuisance and I didn't know how to do it in more sophisticated ways.
Could you give me any ideas or solutions for doing this?
Thank you for response.
Before answering, I am using the paired end reads.
My goal is that I would like to calculate the ratio between uniquely mapped reads and unmapped reads at specific positions. For example, at chr1:1000, there are total # of uniquely mapped reads are 50 while unmapped reads are 5, then the ratio should be 5/50 = 0.1
Anyway, I got to know that by using
samtools -foptions, I am able to get the unmapped reads...but I don't know how to check the reads are uniquely mapped or not.
Could you give me any advice for me?
There are multiple definitions of "uniquely mapped", you'll have to figure out a definition that makes sense for you.
Again, please state the biological goal. The ratio of mapped to unmapped alignments in a region is not a biological goal, it's a questionable method.