Skip to content

Commit

Permalink
fix cache for different zoomlevels
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche authored May 13, 2020
1 parent 3dfcc96 commit 1872395
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/epivizfileserver/parser/BigWig.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,16 @@ def traverseRtreeNodes(self, node, zoomlvl, chrmId, start, end, result = []):
"""
offset = node.get("rOffset")

if self.cacheData.get(str(offset)):
tree = self.cacheData.get(str(offset))
if self.cacheData.get(str(zoomlvl) + "-" + str(offset)):
tree = self.cacheData.get(str(zoomlvl) + "-" + str(offset))
else:
if node.get("rIsLeaf"):
# print("leaf")
tree = self.getTreeBytes(zoomlvl, offset, node.get("rCount") * 32)
else:
# print("not leaf")
tree = self.getTreeBytes(zoomlvl, offset, node.get("rCount") * 24)
self.cacheData[str(offset)] = tree
self.cacheData[str(zoomlvl) + "-" + str(offset)] = tree

if node.get("rIsLeaf"):
for i in range(0, node.get("rCount")):
Expand Down Expand Up @@ -649,4 +651,4 @@ def parseLeafDataNode(self, chrmId, start, end, zoomlvl, rStartChromIx, rStartBa
if endv >= start and startv <= end and chromId == chrmId:
result.append((chromId, startv, endv, valuev))

return result
return result

0 comments on commit 1872395

Please sign in to comment.