Skip to content

Commit

Permalink
fix index err in profiler constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoi committed Aug 22, 2024
1 parent 0362d98 commit 9433e29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/HogProf/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self,lshforestpath = None, hashes_h5=None, mat_path= None, oma = Fa
if oma:
h5_oma = open_file(oma, mode="r")
self.db_obj = db.Database(h5_oma)
self.treeweights = hashutils.generate_treeweights(self.tree , self.taxaIndex , None, None )
#self.treeweights = hashutils.generate_treeweights(self.tree , self.taxaIndex , None, None )
self.READ_ORTHO = functools.partial(pyhamutils.get_orthoxml_oma , db_obj=self.db_obj)
self.HAM_PIPELINE = functools.partial(pyhamutils.get_ham_treemap_from_row, tree=self.tree_string )
self.HASH_PIPELINE = functools.partial(hashutils.row2hash , taxaIndex=self.taxaIndex , treeweights=self.treeweights , wmg=None )
Expand Down
7 changes: 4 additions & 3 deletions src/HogProf/utils/hashutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def generate_treeweights( mastertree, taxaIndex , taxfilter, taxmask ):
:param taxmask: if this is not NONE taxmask, the DB is constructed with this subtree
:return: weights: a vector of weights for each tax level
"""

weights = np.zeros((3*len(taxaIndex),1))
#get max of taxa index
taxmax = max(taxaIndex.values())
weights = np.zeros((3*len(taxmax),1))
print(len(taxaIndex))
newtree = mastertree
for event in weights:
Expand All @@ -35,7 +36,7 @@ def generate_treeweights( mastertree, taxaIndex , taxfilter, taxmask ):
n.delete()
for i in range(3):
for n in newtree.traverse():
weights[len(taxaIndex)*i + taxaIndex[n.name] ] = 1
weights[len(taxmax)*i + taxaIndex[n.name] ] = 1
return weights

def hash_tree(tp , taxaIndex , treeweights , wmg , lossonly = False , duplonly = False ):
Expand Down
Loading

0 comments on commit 9433e29

Please sign in to comment.