Skip to content

Commit 65f597a

Browse files
committed
only need checksum for cache
1 parent 506ba6f commit 65f597a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

gimmemotifs/scanner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,9 @@ def set_motifs(self, motifs):
220220
self.motifs = motifs
221221
motif_ids = sorted([m.id for m in read_motifs(open(motifs))])
222222
self.checksum = {}
223-
chksum = CityHash64("\n".join(motif_ids))
224-
self.checksum[self.motifs] = chksum
223+
if self.use_cache:
224+
chksum = CityHash64("\n".join(motif_ids))
225+
self.checksum[self.motifs] = chksum
225226

226227
def set_threshold(self):
227228
"""
@@ -389,7 +390,7 @@ def _scan_regions(self, regions, nreport, scan_rc, cutoff=0.95):
389390
job = pool.apply_async(scan_func, (scan_regions[i * chunksize:( i+ 1) * chunksize],))
390391
jobs.append(job)
391392

392-
# store values in cache
393+
# return values or store values in cache
393394
i = 0
394395
for job in jobs:
395396
for ret in job.get():
@@ -399,6 +400,7 @@ def _scan_regions(self, regions, nreport, scan_rc, cutoff=0.95):
399400
key = str((region, index_dir, motif_digest, nreport, scan_rc, cutoff))
400401
self.cache.set(key, ret)
401402
else:
403+
#return values
402404
yield ret
403405
i += 1
404406

0 commit comments

Comments
 (0)