Skip to content

Commit

Permalink
adding GTF to uns field of h5ad for optimus (#154)
Browse files Browse the repository at this point in the history
updated warp-tools to 2.6.0 for modified h5ad scripts that add gtf file path into h5ad unstructured metadata
  • Loading branch information
ekiernan authored Jan 14, 2025
1 parent 47693d9 commit 05157c7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/scripts/create_h5ad_optimus.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ def create_h5ad_files(args):
# Set variable names
new_data.var_names = [x for x in new_data.var["Gene"]]

# Add GTF to uns field

gtf_path = args.gtf_path
new_data.uns["reference_gtf_file"] = gtf_path

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

Expand Down Expand Up @@ -458,6 +463,14 @@ def main():
help="annotation file in GTF format",
)

parser.add_argument(
"--gtf_path",
dest="gtf_path",
default=None,
required=False,
help="annotation file path",
)

parser.add_argument(
"--output_path_for_h5ad",
dest="output_h5ad_path",
Expand Down
17 changes: 17 additions & 0 deletions tools/scripts/create_snrna_optimus_exons_h5ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,15 @@ def create_h5ad_files(args):
# Set the layer = to the exon_counts csr matrix
new_data.layers["exon_counts"]=exon_counts

# Original path from args.annotation_file
# Add GTF to uns field

gtf_path = args.gtf_path
new_data.uns["reference_gtf_file"] = gtf_path

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

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

Expand Down Expand Up @@ -426,6 +435,14 @@ def main():
help="annotation file in GTF format",
)

parser.add_argument(
"--gtf_path",
dest="gtf_path",
default=None,
required=False,
help="annotation file path",
)

parser.add_argument(
"--output_path_for_h5ad",
dest="output_h5ad_path",
Expand Down
16 changes: 16 additions & 0 deletions tools/scripts/create_snrna_optimus_full_h5ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,14 @@ def create_h5ad_files(args):
# Set variable names
new_data.var_names = [x for x in new_data.var["Gene"]]

# Add GTF to uns field

gtf_path = args.gtf_path
new_data.uns["reference_gtf_file"] = gtf_path

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

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

Expand Down Expand Up @@ -390,6 +398,14 @@ def main():
help="annotation file in GTF format",
)

parser.add_argument(
"--gtf_path",
dest="gtf_path",
default=None,
required=False,
help="annotation file path",
)

parser.add_argument(
"--output_path_for_h5ad",
dest="output_h5ad_path",
Expand Down

0 comments on commit 05157c7

Please sign in to comment.