Skip to content

Commit

Permalink
Merge pull request #7 from PennChopMicrobiomeProgram/VT_edit
Browse files Browse the repository at this point in the history
Moved coordinate change to matcher.py
  • Loading branch information
vitu1 authored Jun 23, 2021
2 parents dab46e1 + c07cfed commit be037e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions primertrim/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,4 @@ def parse(self, f):
for field in self.fields:
fcn = BLAST_FIELD_TYPES[field]
res[field] = fcn(res[field])
if res["qstrand"] == "-":
qstart_temp = res["qlen"]-res["qend"]+1
res["qend"] = res["qlen"]-res["qstart"]+1
res["qstart"] = qstart_temp
yield res
3 changes: 3 additions & 0 deletions primertrim/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def find_in_seqs(self, seqs):
# Vsearch indexes positions starting with 1
start_idx = hit["qstart"] - 1
end_idx = hit["qend"]
if hit["qstrand"] == "-":
start_idx = hit["qlen"]-hit["qend"]
end_idx = hit["qlen"]-hit["qstart"]+1
assert(start_idx < end_idx)
seq = seqs[seq_id]
primerseq = seq[start_idx:end_idx]
Expand Down

0 comments on commit be037e7

Please sign in to comment.