Skip to content

Commit

Permalink
Contig stitcher: make sure that mappy coordinates are not reversed
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Jan 18, 2024
1 parent fe76e52 commit 3f89fe8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion micall/core/contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ def align_to_reference(contig) -> Iterable[GenotypedContig]:

aligner = Aligner(seq=contig.ref_seq, preset='map-ont')
alignments = list(aligner.map(contig.seq))
hits_array = [(CigarHit(Cigar(x.cigar), x.r_st, x.r_en - 1, x.q_st, x.q_en - 1),
hits_array = [(CigarHit(Cigar(x.cigar),
min(x.r_st, x.r_en - 1),
max(x.r_st, x.r_en - 1),
min(x.q_st, x.q_en - 1),
max(x.q_st, x.q_en - 1)),
"forward" if x.strand == 1 else "reverse") for x in alignments]

connected = connect_cigar_hits(list(map(lambda p: p[0], hits_array))) if hits_array else []
Expand Down

0 comments on commit 3f89fe8

Please sign in to comment.