|
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spacexr commit c6f85f5bd2c9dee114640a4e4007852c060e10ca |
|
added:
macros.xml spacexr_rctd.xml |
| b |
| diff -r 000000000000 -r acf15b2efe66 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Tue Jan 28 09:43:57 2025 +0000 |
| [ |
| @@ -0,0 +1,105 @@ +<macros> + <token name="@TOOL_VERSION@">2.2.1</token> + <token name="@VERSION_SUFFIX@">0</token> + <token name="@PROFILE@">23.0</token> + <xml name="requirements"> + <requirements> + <requirement type="package" version="@TOOL_VERSION@">r-spacexr</requirement> + <yield/> + </requirements> + </xml> + <xml name="edam"> + <edam_topics> + <edam_topic>topic_3308</edam_topic> + </edam_topics> + <edam_operations> + <edam_operation>operation_3223</edam_operation> + </edam_operations> + </xml> + <token name="CSIDE_COMMON_RUN"><![CDATA[ +#if str($type.cell_types) != '': +cell_types = c($cell_types), +#end if +cell_type_threshold = $type.cell_type_threshold, +gene_threshold = $type.gene_threshold, +doublet_mode = $type.doublet_mode, +#if str($type.weight_threshold) != '': +weight_threshold = $type.weight_threshold, +#end if +sigma_gene = $type.sigma_gene, +PRECISION.THRESHOLD = $type.precision_threshold, +#if str($type.cell_types_present) != '': +cell_types_present = c($cell_types_present), +#end if +fdr = $type.fdr, +test_genes_sig = $type.test_genes_sig, +#if 'log' in $output_selector: +logs = TRUE, +#else: +logs = FALSE, +#end if + ]]></token> + <token name="CSIDE_SINGLE_RUN"><![CDATA[ +myRCTD <- run.CSIDE.single(myRCTD, + explanatory.variable, + normalize_expr = $type.normalize_expr, + log_fc_thresh = $type.log_FC_thresh, + fdr_method = "BH", # default + medv = $type.medv, + CSIDE_COMMON_RUN + ) + ]]></token> + <xml name="sanitizer"> + <sanitizer invalid_char=""> + <valid initial="string.ascii_letters,string.digits"> + <add value="_" /> + <add value="-" /> + <add value="," /> + </valid> + </sanitizer> + </xml> + <xml name="barcodes_input" token_help="" token_label=""> + <param argument="barcodes" type="data" format="tabular" optional="false" label="@LABEL@" help="@HELP@" /> + </xml> + <xml name="radius"> + <param argument="radius" type="integer" min="0" value="50" label="Radius" help="The radius of the exponential filter. Approximately, the distance considered to be a relevant interaction."/> + </xml> + <xml name="cside_common_input"> + <param argument="cell_types" type="text" optional="true" label="Cell types used for CSIDE" help="(Comma separated) If null, cell types will be chosen with aggregate occurences of at least 'cell type threshold'."/> + <param argument="cell_type_threshold" type="integer" min="0" value="125" label="Cell type threshold" help="Min occurence of number of cells for each cell type to be used."/> + <param argument="gene_threshold" type="float" min="0" value="0.00005" label="Gene threshold" help="Minimum average normalized expression required for selecting genes."/> + <param argument="doublet_mode" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true" label="Use RCTD doublet mode weights?" help="Otherwise, uses RCTD full mode weights." /> + <param argument="weight_threshold" type="float" min="0" value="" optional="true" label="Weight threshold" help="The threshold of total normalized weights across all cell types in 'cell types' per pixel to be included in the model."/> + <param argument="sigma_gene" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true" label="Fit gene specific overdispersion parameter?" help="If FALSE, overdispersion parameter is same across all genes." /> + <param argument="precision_threshold" type="float" min="0" value="0.05" label="Precision threshold" help="For checking for convergence, the maximum parameter change per algorithm step."/> + <param argument="cell_types_present" type="text" optional="true" label="Cell types present" help="(Comma separeated) cell types (a superset of 'cell types') to be considered as occuring often enough to consider for gene expression contamination during the step filtering out marker genes of other cell types."/> + <param argument="fdr" type="float" min="0" value="0.01" label="FDR" help="False discovery rate for hypothesis testing."/> + <param argument="test_genes_sig" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true" label="Genes will be tested for significance."/> + </xml> + <xml name="cside_single_input"> + <expand macro="cside_common_input"/> + <param argument="normalize_expr" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Constrain total gene expression to sum to 1 in each condition?"/> + <param argument="log_FC_thresh" type="float" min="0" value="0.4" label="LogFC threshold" help="The natural log fold change cutoff for differential expression."/> + <param argument="medv" type="float" min="0" value="0.5" label="Explanatory.variable cutoff" help="For determining if enough pixels for each cell type have explanatory-variable greater than or less than this value."/> + </xml> + <xml name="output"> + <section name="output" title="Output Options"> + <param name="output_selector" type="select" multiple="true" optional="true" display="checkboxes" label="Select / Deselect all"> + <option value="rds">RDS file</option> + <option value="rscript">R script</option> + <yield/> + </param> + </section> + </xml> + <xml name="citations"> + <citations> + <citation type="doi">10.1038/s41587-021-00830-w</citation> + <citation type="doi">10.1038/s41592-022-01575-3</citation> + <citation type="bibtex">@Manual{github, + title = {SpatialeXpressionR: Cell type identification and cell type-specific differential expression in spatial transcriptomics.}, + author = {Dylan Cable}, + url = {https://github.com/dmcable/spacexr}} + </citation> + </citations> + </xml> +</macros> \ No newline at end of file |
| b |
| diff -r 000000000000 -r acf15b2efe66 spacexr_rctd.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spacexr_rctd.xml Tue Jan 28 09:43:57 2025 +0000 |
| [ |
| b'@@ -0,0 +1,377 @@\n+<tool id="spacexr_rctd" name="RCTD" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">\n+ <description>Cell type identification with RCTD</description>\n+ <macros>\n+ <import>macros.xml</import>\n+ </macros>\n+ <expand macro="edam"/>\n+ <expand macro="requirements"/>\n+ <command detect_errors="exit_code"><![CDATA[\n+ mkdir -p \'results\' \'figures\' \'inputs\' &&\n+ ln -s \'$sc_count\' \'inputs/sc_count.tabular\' &&\n+ ln -s \'$metadata\' \'inputs/metadata.tabular\' &&\n+ ln -s \'$st_count\' \'inputs/st_count.tabular\' &&\n+ ln -s \'$coord\' \'inputs/coords.tabular\' &&\n+ touch \'results/rctd_script.R\' &&\n+ cat \'$rctd_script\' > \'results/rctd_script.R\' &&\n+ Rscript \'$rctd_script\'\n+ ]]></command>\n+ <configfiles>\n+ <configfile name="rctd_script"><![CDATA[\n+# rctd script\n+# This file is used to specify the parameters for the rctd from spacexr package\n+\n+# Load the spacexr library\n+library(\'spacexr\')\n+library(\'Matrix\')\n+\n+### Load the scRNA-seq data\n+counts <- read.table(file = \'inputs/sc_count.tabular\', row.names = 1, sep = \'\\t\', header = T)\n+metadata <- read.table(file = \'inputs/metadata.tabular\', sep = \'\\t\', header = T)\n+\n+# create cell_types named list\n+cell_types <- metadata[,"annotation"]; names(cell_types) <- metadata[,"barcode"]\n+\n+# convert to factor data type\n+cell_types <- as.factor(cell_types)\n+\n+#if str($sc_umi_input) == \'True\':\n+# create nUMI named list\n+nUMI <- metadata[, "nUMI"]; names(nUMI) <- metadata[,"barcode"]\n+#end if\n+\n+# Create reference object\n+reference <- Reference(\n+ counts = counts,\n+ cell_types = cell_types,\n+ #if str($sc_umi_input) == \'True\':\n+ nUMI = nUMI,\n+ #end if\n+ n_max_cells = $n_max_cells,\n+ min_UMI = $min_UMI\n+ )\n+\n+### Load spatial data\n+counts <- read.table(file = \'inputs/st_count.tabular\', row.names = 1, sep = \'\\t\', header = T)\n+coords <- read.table(file = \'inputs/coords.tabular\', row.names = 1, sep = \'\\t\', header = T)\n+\n+nUMI <- colSums(counts) # In tutorials it is always the sum of counts\n+\n+# Create SpatialRNA object\n+puck <- SpatialRNA(\n+ coords = coords,\n+ counts = counts,\n+ nUMI= nUMI,\n+ )\n+\n+# provide a basic plot of the nUMI of each pixel on the plot:\n+pdf(\'figures/nUMI_plot.pdf\')\n+plot_puck_continuous(\n+ puck = puck,\n+ barcodes = colnames(puck@counts),\n+ plot_val = puck@nUMI,\n+ ylimit = c(0,round(quantile(puck@nUMI,0.9))),\n+ title =\'plot of nUMI\')\n+dev.off()\n+\n+### Run the RCTD\n+myRCTD <- create.RCTD(\n+ spatialRNA = puck,\n+ reference = reference,\n+ gene_cutoff = $gene_cutoff,\n+ fc_cutoff = $fc_cutoff,\n+ gene_cutoff_reg = $gene_cutoff_reg,\n+ fc_cutoff_reg = $fc_cutoff_reg,\n+ UMI_min = $umi_min,\n+ UMI_max = $umi_max,\n+ counts_MIN = $counts_min,\n+ UMI_min_sigma = $umi_min_sigma,\n+ class_df = NULL, # set as default\n+ CELL_MIN_INSTANCE = $cell_min_instance,\n+ #if str($cell_type_names) != "":\n+ cell_type_names = $cell_type_names,\n+ #end if \n+ MAX_MULTI_TYPES = $max_multi_types,\n+ keep_reference = F, # set as default\n+ cell_type_profiles = NULL, # set as default\n+ CONFIDENCE_THRESHOLD = $confidence_threshold,\n+ DOUBLET_THRESHOLD = $doublet_threshold,)\n+\n+myRCTD <- run.RCTD(\n+ myRCTD,\n+ doublet_mode = "$doublet_mode")\n+\n+\n+# save results\n+#if str($doublet_mode) == \'doublet\':\n+results <- myRCTD@results\n+\n+# save the data frame\n+result_df <- results["results_df"]\n+write.table(result_df, file = \'results/doublet_resul'..b' <not_has_text text="nUMI <- metadata[, "nUMI"]"/>\n+ <has_text text="doublet_mode = "full""/>\n+ </assert_contents>\n+ </output>\n+ </test>\n+ <test expect_num_outputs="4">\n+ <param name="sc_count" location="https://zenodo.org/records/14642119/files/sc_count.tabular"/>\n+ <param name="metadata" location="https://zenodo.org/records/14642119/files/metadata.tabular"/>\n+ <param name="sc_umi_input" value="False"/>\n+ <param name="st_count" location="https://zenodo.org/records/14642119/files/st_count.tabular"/>\n+ <param name="coord" location="https://zenodo.org/records/14642119/files/coords.tabular"/>\n+ <param name="doublet_mode" value="multi"/>\n+ <param name="output_selector" value="rds,rscript" />\n+ <output_collection name="out_fig" type="list">\n+ <element name="nUMI_plot" location="https://zenodo.org/records/14642119/files/nUMI_plot.pdf" ftype="pdf" compare="sim_size"/>\n+ </output_collection>\n+ <output name="out_multi">\n+ <assert_contents>\n+ <has_text text="Examining results on pixel / spot 1"/>\n+ <has_text text="Check convergence:"/>\n+ <has_text text="[1] TRUE"/>\n+ <has_text text="Check cell types:"/>\n+ <has_text text="[1] "type18" "type6""/>\n+ <has_text text="Check confidence:"/>\n+ <has_text text="Check weights:"/>\n+ </assert_contents>\n+ </output>\n+ <output name="out_rds" location="https://zenodo.org/records/14642119/files/rds_multi.rds" compare="sim_size"/>\n+ <output name="out_rscript">\n+ <assert_contents>\n+ <has_text text="library(\'spacexr\')"/>\n+ <not_has_text text="nUMI <- metadata[, "nUMI"]"/>\n+ <has_text text="doublet_mode = "multi""/>\n+ </assert_contents>\n+ </output>\n+ </test>\n+ </tests>\n+ <help><![CDATA[\n+\n+Robust Cell Type Decomposition, or **RCTD**, is an statistical method for learning cell types from spatial transcriptomics data.\n+\n+**Reference object**:\n+\n+To create the single-cell reference object, the following inputs are required:\n+ * counts: A matrix representing Digital Gene Expression (DGE). **Rownames** should be genes and **colnames** represent barcodes/cell names. Counts should be **untransformed** count-level data.\n+ * cell_types: A named (by cell barcode) factor of cell type for each cell.\n+ * nUMI: Optional, a named (by cell barcode) list of total counts or UMI's appearing at each cell. If not provided, nUMI will be assumed to be the total counts appearing on each cell. \n+\n+**SpatialRNA object**:\n+\n+To create the spatialRNA object, the following inputs are required:\n+ * coords: A numeric table representing the spatial pixel locations. **Rownames** are barcodes/pixel names, and there should be two columns for **x** and for **y**.\n+ * counts: A matrix representing Digital Gene Expression (DGE). **Rownames** should be genes and **colnames** represent barcodes/pixel names. Counts should be **untransformed** count-level data.\n+\n+-----\n+\n+RCTD has **three** modes:\n+ * **doublet mode**, which assigns 1-2 cell types per spot and is recommended for technologies with high spatial resolution such as Slide-seq and MERFISH.\n+ * **full mode**, which assigns any number of cell types per spot and is recommended for technologies with poor spatial resolution such as 100-micron resolution Visium.\n+ * **multi mode**, an extension of doublet mode that can discover more than two cell types per spot (3-4 cell types) as an alternative option to full mode.\n+\n+ ]]></help>\n+\n+ <expand macro="citations" />\n+</tool>\n\\ No newline at end of file\n' |