Skip to content

Commit

Permalink
Another projection function and indel related fix. Now that in the pr…
Browse files Browse the repository at this point in the history
…ojection I loop over all indels, and not just tied to a specific match, extra if statements were required to ensure only relevant indels were being considered.
  • Loading branch information
babayagaofficial committed Feb 20, 2024
1 parent ca2be28 commit 76e2680
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pling/align_snakemake/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,29 @@ def projection(self, coord, indels, ref_bool): #if ref_bool=True, project from r
if ref_bool:
dist = coord - self.rstart
for indel in indels:
if indel.rstart<=coord<indel.rend:
return indel.qstart
elif self.rstart<=indel.rstart<coord:
if indel.type == "INS":
dist += indel.len
elif indel.type == "DEL":
dist -= indel.len
if self.qstart<=indel.qstart and indel.qend<=self.qend:
if self.rstart<=indel.rstart<=coord<indel.rend:
return indel.qstart
elif self.rstart<=indel.rstart<coord:
if indel.type == "INS":
dist += indel.len
elif indel.type == "DEL":
dist -= indel.len
if self.strand == 1:
projected_coord = self.qstart + dist
else:
projected_coord = self.qend - dist
else:
dist = coord - self.qstart
for indel in indels:
if indel.qstart<=coord<indel.qend:
return indel.rstart
elif self.qstart<=indel.qstart<coord:
if indel.type == "INS":
dist -= indel.len
elif indel.type == "DEL":
dist += indel.len
if self.rstart<=indel.rstart and indel.rend<=self.rend:
if indel.qstart<=coord<indel.qend and self.rstart<=indel.rstart:
return indel.rstart
elif self.qstart<=indel.qstart<coord:
if indel.type == "INS":
dist -= indel.len
elif indel.type == "DEL":
dist += indel.len
if self.strand == 1:
projected_coord = self.rstart + dist
else:
Expand Down

0 comments on commit 76e2680

Please sign in to comment.