Skip to content

Commit

Permalink
rename orfs method to find_orfs
Browse files Browse the repository at this point in the history
  • Loading branch information
trichter committed Oct 14, 2024
1 parent f01b6c7 commit 63d3402
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions sugar/core/seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ def matchall(self, *args, **kw):
kw['matchall'] = True
return self.match(*args, **kw)

def orfs(self, *args, **kw):
def find_orfs(self, *args, **kw):
"""
Find ORFS in the sequence, see `.find_orfs()`
Find ORFS in the sequence, see `~.cane.find_orfs()`
"""
from sugar.core.cane import find_orfs
return find_orfs(self, *args, **kw)
Expand Down Expand Up @@ -890,12 +890,12 @@ def matchall(self, *args, **kw):
kw['matchall'] = True
return self.match(*args, **kw)

def orfs(self, *args, **kw):
def find_orfs(self, *args, **kw):
"""
Find ORFS in sequences, see `.find_orfs()`
Find ORFS in sequences, see `~.cane.find_orfs()`
"""
return reduce(lambda orfs1, orfs2: orfs1 + orfs2,
[seq.orfs(*args, **kw) for seq in self])
[seq.find_orfs(*args, **kw) for seq in self])

def tofmtstr(self, fmt, **kw):
out = io.StringIO()
Expand Down
6 changes: 3 additions & 3 deletions sugar/tests/test_core_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ def test_match():

def test_orf():
seqs=read()
orfs = seqs[0].orfs()
orfs = seqs[0].find_orfs()
assert len(orfs) > 0
longest_orf = orfs.sort()[-1]
assert seqs[0][longest_orf] == seqs[0]['cds']

orfs2 = seqs[0].orfs(rf='both')
orfs2 = seqs[0].find_orfs(rf='both')
assert len(orfs2) > len(orfs)

orfs = seqs.orfs()
orfs = seqs.find_orfs()
for id_ in seqs.ids:
assert seqs.d[id_][orfs.d[id_].sort()[-1]] == seqs.d[id_]['cds']

0 comments on commit 63d3402

Please sign in to comment.