Skip to content

Commit

Permalink
adding gs:// paths for gtf referencein h5ad
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiernan committed Jan 10, 2025
1 parent cd764a5 commit 44a2da1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/scripts/create_h5ad_optimus.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,18 @@ def create_h5ad_files(args):
new_data.var_names = [x for x in new_data.var["Gene"]]

# Add GTF to uns field
new_data.uns["GTF"] = str(args.annotation_file)

# Original path from args.annotation_file
annotation_gtf = args.annotation_file # e.g., '/cromwell_root/gcp-public-data--broad-references/hg38/v0/star/v2_7_10a/modified_v43.annotation.gtf'

# Transform the path
if annotation_gtf.startswith('/cromwell_root/'):
stripped_path = annotation_gtf[len('/cromwell_root/'):] # Remove '/cromwell_root/'
updated_path = f'gs://{stripped_path}' # Add 'gs://' prefix
else:
updated_path = str(args.annotation_file)

new_data.uns["reference_gtf_file"] = updated_path

# Write h5ad file
new_data.write(args.output_h5ad_path + ".h5ad")
Expand Down

0 comments on commit 44a2da1

Please sign in to comment.