Entering edit mode
7.4 years ago
jianzheng934963534
▴
20
Hi all! I want to compare the result of alignment of reads that has the same name in two .sam files, especially the difference in CIGAR flags.
Is there any fast way to implement?
You should try to explaing better what you wan't to do. CompareSAMs and CompareMetrics might be helpful. If you want more help, edit the question and explain better what you wanna do.
Thanks for your answer. To be more specific,first,I have an fastq file and I align it to the reference genome and get 1.sam, then I deal with some of the reads in the fastq file and align it to the reference genome again and get 2.sam, and now I want to compare the CIGAR flags of the reads with the same name between 1.sam and 2.sam to know the effect of alignment of my change in the fastq file.
Are you expecting there to be differences? Due to different options used during alignments (assuming everything else is identical)?
more simply.
I want to know how to extract the CIGAR flags of the same readID from two different sam files. Thanks.
do you know how to code in python?
P.D: Edit the original answer, this will allow others to search the question
I know how to simply achieve this but I want to find a fast way because the sam file can be huge.
You can achieve speed by sorting the bam files by query name, then, you can loop trough both files
And you still have not told us why you want to do this ..