Skip to content

Commit

Permalink
fixes #181: rna_duplex_multiple causes KeyError with parallel=True
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-doty committed Jun 24, 2022
1 parent a39f2ff commit a44a571
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nuad/vienna_nupack.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ def rna_duplex_multiple(seq_pairs: Sequence[Tuple[str, str]],
for i, energy, seq_pair in zip(idxs_to_calculate, energies_to_calculate, seq_pairs_to_calculate):
energies[i] = energy
if cache:
key = (seq_pair, temperature, parameters_filename)
_rna_duplex_cache[key] = energy

# clear out oldest cache key if _rna_duplex_queue is full
if len(_rna_duplex_queue) == _rna_duplex_queue.maxlen:
lru_item = _rna_duplex_queue[0]
del _rna_duplex_cache[lru_item]
if lru_item in _rna_duplex_cache:
del _rna_duplex_cache[lru_item]

key = (seq_pair, temperature, parameters_filename)
_rna_duplex_cache[key] = energy
_rna_duplex_queue.append(key)

return energies
Expand Down

0 comments on commit a44a571

Please sign in to comment.