Skip to content

Commit

Permalink
use np sum
Browse files Browse the repository at this point in the history
  • Loading branch information
wasade committed Jun 26, 2024
1 parent ca7ac23 commit 06c4ac4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bp/_conv.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def to_skbio_treenode(BP bp):
The tree represented as an skbio.TreeNode
"""
cdef int i

nodes = [skbio.TreeNode() for i in range(sum(bp.B))]

nodes = [skbio.TreeNode() for i in range(bp.B.sum())]
# skbio.TreeNode.append makes a very expensive call to
# invalidate_caches. Let's remove that from consideration
# temporarily while constructing the tree
Expand All @@ -41,7 +41,7 @@ def to_skbio_treenode(BP bp):

root = nodes[0]

for i in range(sum(bp.B)):
for i in range(bp.B.sum()):
node_idx = bp.preorderselect(i)
nodes[i].name = bp.name(node_idx)
nodes[i].length = bp.length(node_idx)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def run(self):

if USE_CYTHON:
from Cython.Build import cythonize
extensions = cythonize(extensions)
extensions = cythonize(extensions,
language_level=3)


setup(name='iow',
Expand Down

0 comments on commit 06c4ac4

Please sign in to comment.