From 18723959caee7602c2294b19e4b59c56f224a400 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Wed, 13 May 2020 14:01:04 -0400 Subject: [PATCH] fix cache for different zoomlevels --- src/epivizfileserver/parser/BigWig.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/epivizfileserver/parser/BigWig.py b/src/epivizfileserver/parser/BigWig.py index 4d0606a..f9fa484 100644 --- a/src/epivizfileserver/parser/BigWig.py +++ b/src/epivizfileserver/parser/BigWig.py @@ -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")): @@ -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 \ No newline at end of file + return result