diff decoupler_pathway_inference.py @ 8:9864fd2cc1f0 draft

planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 03b4d647e2dd8a333f347d3cfbe3dd5c7b407f61
author ebi-gxa
date Wed, 30 Oct 2024 14:01:19 +0000
parents c6787c2aee46
children
line wrap: on
line diff
--- a/decoupler_pathway_inference.py	Sun Oct 27 20:39:33 2024 +0000
+++ b/decoupler_pathway_inference.py	Wed Oct 30 14:01:19 2024 +0000
@@ -79,6 +79,14 @@
     default="mlm",
     required=True,
 )
+
+# add activity inference method option
+parser.add_argument(
+    "-g",
+    "--var_gene_symbols_field",
+    help="Gene symbols field",
+    default=None,
+)
 args = parser.parse_args()
 
 # check that either -o or --output is specified
@@ -103,6 +111,12 @@
 
 print(type(args.min_n))
 
+if args.var_gene_symbols_field and args.var_gene_symbols_field in adata.var.columns:
+    # Storing index in a column called 'index_bak'
+    adata.var['index_bak'] = adata.var.index
+    adata.var.set_index(args.var_gene_symbols_field, inplace=True)
+
+
 if args.method == "mlm":
     dc.run_mlm(
         mat=adata,