Skip to content

Commit

Permalink
Merge pull request #539 from uclahs-cds/czhu-fix-call-noncoding
Browse files Browse the repository at this point in the history
fix the additional nucleotide issue during translation
  • Loading branch information
zhuchcn authored Jul 27, 2022
2 parents 457f744 + c3d88ba commit bc2f651
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion moPepGen/svgraph/TVGNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,10 @@ def append_right(self, other:TVGNode) -> None:

def translate(self) -> svgraph.PVGNode:
""" translate to a PVGNode """
seq = self.seq.translate()
if not self.out_edges:
seq = self.seq[:len(self.seq) - len(self.seq) % 3].translate()
else:
seq = self.seq.translate()

locations = []
for loc in self.seq.locations:
Expand Down
4 changes: 3 additions & 1 deletion moPepGen/util/brute_force_noncoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def brute_force_noncoding(args:argparse.Namespace):
for it in re.finditer('M', str(frame_seq.seq)):
i = it.start()
j = frame_seq.seq[i:].find('*')
if not j == -1:
if j == -1:
j = len(frame_seq.seq)
else:
j += i
aa_seq = frame_seq[i:j]
peptides = aa_seq.enzymatic_cleave(rule, exception)
Expand Down

0 comments on commit bc2f651

Please sign in to comment.