Skip to content

Commit

Permalink
Fix concurrency bug in spotrna
Browse files Browse the repository at this point in the history
If multiple processes called spotrna at the same time, spotrna internally would internally (over)write a file causing one or all of the predictions to use/return the wrong data
  • Loading branch information
luxaritas authored Jan 25, 2025
1 parent 0061259 commit 2b4b724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arnie/pk_predictors.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ def _run_spotrna(seq, cpu=32):
spotrna_conda_env = package_locs["spotrna_conda_env"]
out_folder = get_random_folder()
mkdir(out_folder)
fasta_file = f"{out_folder}/temp.fasta"
input_id = local_rand_filename()
fasta_file = f"{out_folder}/{input_id}.fasta"
f = open(fasta_file, "w")
f.write(">seq\n")
f.write(seq)
Expand Down Expand Up @@ -472,4 +473,3 @@ def _nupack_mfe_pk(seq):
remove(f'{fasta_file}.mfe')
rmdir(out_folder)
return struct

0 comments on commit 2b4b724

Please sign in to comment.