Skip to content

Commit 44a2da1

Browse files
committed
adding gs:// paths for gtf referencein h5ad
1 parent cd764a5 commit 44a2da1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tools/scripts/create_h5ad_optimus.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,18 @@ def create_h5ad_files(args):
391391
new_data.var_names = [x for x in new_data.var["Gene"]]
392392

393393
# Add GTF to uns field
394-
new_data.uns["GTF"] = str(args.annotation_file)
394+
395+
# Original path from args.annotation_file
396+
annotation_gtf = args.annotation_file # e.g., '/cromwell_root/gcp-public-data--broad-references/hg38/v0/star/v2_7_10a/modified_v43.annotation.gtf'
397+
398+
# Transform the path
399+
if annotation_gtf.startswith('/cromwell_root/'):
400+
stripped_path = annotation_gtf[len('/cromwell_root/'):] # Remove '/cromwell_root/'
401+
updated_path = f'gs://{stripped_path}' # Add 'gs://' prefix
402+
else:
403+
updated_path = str(args.annotation_file)
404+
405+
new_data.uns["reference_gtf_file"] = updated_path
395406

396407
# Write h5ad file
397408
new_data.write(args.output_h5ad_path + ".h5ad")

0 commit comments

Comments
 (0)