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
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
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
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Thank you for your assistance!
Actually, it's column
-f6
.You've helped me too, thanks!!