Thank you for your assistance!
Determing number of spliced alignments in a BAM file
What is the best way of determining the number of spiced alignments in a BAM file with SAMTOOLS? My research on the web shows that the character "N" in CIGAR string indicates a splice.
Thank you, Greg
• 4,311 views
•
link
1 answer
You can play with bash commands..
I don't remember the column that represents the CIGAR (I believe is column 7)
You can do the following
cat your_file.sam | cut -f 7 | grep "N" | wc -l
If playing with BAM files
samtools view your_file.bam | cut -f 7 | grep "N" | wc -l
With cat and samtools view you open the content of the file and pipe it to the cut command, which select column 7. With grep you select those lanes containing a N into the CIGAR string, and pipe it again to wc -l which count the lanes containing such a N
• 0 views
•
link
• 0 views
•
link
Actually, it's column -f6.
You've helped me too, thanks!!
• 0 views
•
link
Log in to answer this question.