wally icon indicating copy to clipboard operation
wally copied to clipboard

Discrepancies between pysam and wally

Open MJoseMo opened this issue 10 months ago • 6 comments

Hi, I've been using pysam to extract positions in my target sequence. However, I've encountered some discrepancies when visualizing these alignment positions with Wally. Some positions are not equal. Did I need to consider the orientation of alignments when working with pysam or did it encounter problems when extracting positions of long-read sequences IMG_20241220_093844.jpg

MJoseMo avatar Dec 20 '24 08:12 MJoseMo

For wally, forward matches are in blue, reverse matches in orange. I haven't used pysam.

tobiasrausch avatar Dec 20 '24 08:12 tobiasrausch

Hi, my concern lies in the fact that both procedures should yield similar results

MJoseMo avatar Dec 20 '24 09:12 MJoseMo

Does pysam report relative to the match (just the given SAM record) or relative to the primary alignment?

tobiasrausch avatar Dec 20 '24 10:12 tobiasrausch

Can you try this with pysam:

echo -e ">ref\nATCTTTGGTGTCTGTGTGTGTGCGCGCGCACGTGCATGTGTGTGAGTTGTCATTGTTTTTGTTTGTTTTG\nTATTCCTCAGAAATAGAAAGCTCCCATTAGG" > ref.fa
echo -e ">query\nATCTTTGGTGTCTGTGTGTGTGCGCGCGCACGTGCATGTGTGTGAGTTGTCATTGTTTTTGTTTGTTTTG\nCCTAATGGGAGCTTTCTATTTCTGAGGAATA" > query.fa
bwa index ref.fa
bwa mem ref.fa query.fa | samtools sort -o query.bam -
samtools index query.bam
wally matches -x 600 -r query -g ref.fa query.bam

tobiasrausch avatar Dec 20 '24 13:12 tobiasrausch

Dear @tobiasrausch, I get the following results:

Forward:

Reference Name: ref Reference Start: 0 Reference End: 70 Query Start: 0 Query End: 70

Reverse:

Reference Name: ref Reference Start: 70 Reference End: 101 Query Start: 0 Query End: 31

IMG_20250103_181045.jpg

MJoseMo avatar Jan 03 '25 17:01 MJoseMo

Dear Tobias, I know it's been a while since my last interaction, but I still don't understand the discrepancies between wally's and pysam's results, specially for reverse matches.

MJoseMo avatar Mar 21 '25 16:03 MJoseMo