Skip to content

Commit

Permalink
Fix alignment batch tagging (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
morsecodist authored Jul 12, 2024
1 parent ee513b4 commit 79f77cf
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/idseq_utils/idseq_utils/batch_run_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ def run_alignment(
aligner_wdl_version: str,
queries: List[str],
):
bucket, prefix = _bucket_and_key(db_path)
db_bucket, db_prefix = _bucket_and_key(db_path)
chunk_dir = os.path.join(input_dir, f"{aligner}-chunks")
_, chunk_prefix = _bucket_and_key(chunk_dir)
chunk_bucket, chunk_prefix = _bucket_and_key(chunk_dir)
chunks = (
[
input_dir,
Expand All @@ -318,9 +318,9 @@ def run_alignment(
aligner_wdl_version,
queries,
chunk_id,
f"s3://{bucket}/{db_chunk}",
f"s3://{db_bucket}/{db_chunk}",
]
for chunk_id, db_chunk in enumerate(_db_chunks(bucket, prefix))
for chunk_id, db_chunk in enumerate(_db_chunks(db_bucket, db_prefix))
)
with Pool(MAX_CHUNKS_IN_FLIGHT) as p:
p.starmap(_run_chunk, chunks)
Expand All @@ -332,11 +332,15 @@ def run_alignment(
for fn in listdir("chunks"):
if fn.endswith("json"):
os.remove(os.path.join("chunks", fn))
_s3_client.put_object_tagging(
Bucket=bucket,
Key=os.path.join(chunk_prefix, fn),
Tagging={"TagSet": [{"Key": "AlignmentCoordination", "Value": "True"}]},
)
try:
_s3_client.put_object_tagging(
Bucket=chunk_bucket,
Key=os.path.join(chunk_prefix, fn),
Tagging={"TagSet": [{"Key": "AlignmentCoordination", "Value": "True"}]},
)
except ClientError as e:
log.error(f"failed to tag 's3://{chunk_bucket}/{os.path.join(chunk_prefix, fn)}'")
raise e
if aligner == "diamond":
blastx_join("chunks", result_path, aligner_args, *queries)
else:
Expand Down

0 comments on commit 79f77cf

Please sign in to comment.