Skip to content

Commit

Permalink
Improve quality calculations in contig stitcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Oct 28, 2024
1 parent f934b37 commit d3b7658
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions micall/core/contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import logging
from fractions import Fraction
from operator import itemgetter
from aligntools import CigarHit, connect_nonoverlapping_cigar_hits, drop_overlapping_cigar_hits
from aligntools import CigarHit, connect_nonoverlapping_cigar_hits, drop_overlapping_cigar_hits, CigarActions

from micall.core.project_config import ProjectConfig
from micall.core.plot_contigs import plot_stitcher_coverage
Expand Down Expand Up @@ -193,7 +193,9 @@ def align_to_reference(contig: GenotypedContig) -> Iterable[GenotypedContig]:
log(events.InitialHit(contig, i, hit, strand))

def quality(x: CigarHit):
return x.ref_length
mlen = sum(1 for x in x.cigar.relax().iterate_operations()
if x == CigarActions.MATCH)
return 0.9 * mlen + 0.1 * x.ref_length

filtered = list(drop_overlapping_cigar_hits(hits, quality))
connected = list(connect_nonoverlapping_cigar_hits(filtered))
Expand Down

0 comments on commit d3b7658

Please sign in to comment.