# HG changeset patch # User ebi-gxa # Date 1700165121 0 # Node ID e024d8280886db43519303653ee294cf3ab98931 # Parent 1e8697931d7304f7fc83ef9da11148cfb6b8e6c3 planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 56273bcfbc0de8f6ab093f1131a7d22c05a70f25 diff -r 1e8697931d73 -r e024d8280886 decoupler_aucell_score.py --- a/decoupler_aucell_score.py Thu Nov 09 11:36:08 2023 +0000 +++ b/decoupler_aucell_score.py Thu Nov 16 20:05:21 2023 +0000 @@ -109,15 +109,19 @@ if __name__ == "__main__": # Create command-line arguments parser parser = argparse.ArgumentParser(description="Score genes using Aucell") - parser.add_argument("--input_file", type=str, help="Path to input AnnData file") - parser.add_argument("--output_file", type=str, help="Path to output file") + parser.add_argument( + "--input_file", type=str, help="Path to input AnnData file", required=True + ) + parser.add_argument( + "--output_file", type=str, help="Path to output file", required=True + ) parser.add_argument("--gmt_file", type=str, help="Path to GMT file", required=False) # add argument for gene sets to score parser.add_argument( "--gene_sets_to_score", type=str, required=False, - help="Comma separated list of gene sets to score (the need to be in the gmt file)", + help="Optional comma separated list of gene sets to score (the need to be in the gmt file)", ) # add argument for gene list (comma separated) to score parser.add_argument( @@ -137,6 +141,7 @@ "--gene_symbols_field", type=str, help="Name of the gene symbols field in the AnnData object", + required=True, ) parser.add_argument("--use_raw", action="store_true", help="Use raw data") parser.add_argument( @@ -149,15 +154,15 @@ # Load input AnnData object adata = anndata.read_h5ad(args.input_file) - if args.gene_sets_to_score is not None and args.gmt_file is not None: + if args.gmt_file is not None: # Load MSigDB file in GMT format msigdb = read_gmt(args.gmt_file) - gene_sets_to_score = args.gene_sets_to_score.split(",") + gene_sets_to_score = args.gene_sets_to_score.split(",") if args.gene_sets_to_score else [] # Score genes by their ensembl ids using the score_genes_aucell function for _, row in msigdb.iterrows(): gene_set_name = row["gene_set_name"] - if gene_set_name in gene_sets_to_score: + if not gene_sets_to_score or gene_set_name in gene_sets_to_score: genes = row["genes"].split(",") # Convert gene symbols to ensembl ids by using the columns gene_symbols and index in adata.var specific to the gene set ens_gene_ids = adata.var[ diff -r 1e8697931d73 -r e024d8280886 decoupler_aucell_score.xml --- a/decoupler_aucell_score.xml Thu Nov 09 11:36:08 2023 +0000 +++ b/decoupler_aucell_score.xml Thu Nov 16 20:05:21 2023 +0000 @@ -1,5 +1,5 @@ - + scores cells using the AUCell method for gene sets. @@ -10,11 +10,13 @@ python '$__tool_directory__/decoupler_aucell_score.py' --input_file '$input_file' #if $gene_lists_source.source == "gmt" - --gmt_file '$gmt_file' - --gene_sets_to_score '$gene_sets_to_score' + --gmt_file '$gene_lists_source.gmt_file' + #if $gene_lists_source.gene_sets_to_score + --gene_sets_to_score '$gene_lists_source.gene_sets_to_score' + #end if #else: - --gene_lists_to_score '$gene_lists_to_score' - --score_names '$score_names' + --gene_lists_to_score '$gene_lists_source.gene_lists_to_score' + --score_names '$gene_lists_source.score_names' #end if --gene_symbols_field '$gene_symbols_field' $use_raw @@ -34,7 +36,7 @@ - + @@ -56,11 +58,11 @@ - - + + @@ -72,12 +74,27 @@ - - + + + + + + + + + + + + + + + + + @@ -88,12 +105,12 @@ - - + +