Skip to content

Commit

Permalink
fix: do not use asyncio.gather
Browse files Browse the repository at this point in the history
Using asyncio.gather seemed to cause a race condition where the proper number of reads was not always stored in the correct variable
  • Loading branch information
JoshLoecker committed Dec 9, 2024
1 parent f262624 commit 02e0a31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main/como/rnaseq_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ async def build_from_tab(cls, filepath: Path) -> _STARinformation:
raise ValueError(f"Building STAR information requires a '.tab' file; received: '{filepath}'")

async with aiofiles.open(filepath) as i_stream:
unmapped, multimapping, no_feature, ambiguous = await asyncio.gather(
*[i_stream.readline(), i_stream.readline(), i_stream.readline(), i_stream.readline()]
)
unmapped = await i_stream.readline()
multimapping = await i_stream.readline()
no_feature = await i_stream.readline()
ambiguous = await i_stream.readline()

num_unmapped = [int(i) for i in unmapped.rstrip("\n").split("\t")[1:]]
num_multimapping = [int(i) for i in multimapping.rstrip("\n").split("\t")[1:]]
num_no_feature = [int(i) for i in no_feature.rstrip("\n").split("\t")[1:]]
Expand Down

0 comments on commit 02e0a31

Please sign in to comment.