changeset 1:fb2f1b8b0013 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/gsc_scran_normalize commit e0357f07fdabee1ec6614aca6f7b51095111e0d5
author artbio
date Sun, 04 Dec 2022 01:01:01 +0000
parents 252eded61848
children 6864acb21714
files scran-normalize.R scran_normalize.xml
diffstat 2 files changed, 32 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/scran-normalize.R	Thu Sep 26 10:50:55 2019 -0400
+++ b/scran-normalize.R	Sun Dec 04 01:01:01 2022 +0000
@@ -1,59 +1,65 @@
 # load packages that are provided in the conda env
-options( show.error.messages=F,
-       error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
+options(show.error.messages = FALSE,
+  error = function() {
+    cat(geterrmessage(), file = stderr())
+    q("no", 1, FALSE)
+    }
+)
 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
 warnings()
 
 library(optparse)
 library(scran)
 
-#Arguments
-option_list = list(
+# Arguments
+option_list <- list(
   make_option(
     c("-d", "--data"),
     default = NA,
-    type = 'character',
+    type = "character",
     help = "Input file that contains count values to transform"
   ),
   make_option(
     c("-s", "--sep"),
-    default = '\t',
-    type = 'character',
+    default = "\t",
+    type = "character",
     help = "File separator [default : '%default' ]"
   ),
   make_option(
     "--cluster",
-    default=FALSE,
-    action="store_true",
-    type = 'logical',
+    default = FALSE,
+    action = "store_true",
+    type = "logical",
     help = "Whether to calculate the size factor per cluster or on all cell"
   ),
   make_option(
     c("-m", "--method"),
-    default = 'hclust',
-    type = 'character',
+    default = "hclust",
+    type = "character",
     help = "The clustering method to use for grouping cells into cluster : hclust or igraph [default : '%default' ]"
   ),
   make_option(
     "--size",
     default = 100,
-    type = 'integer',
+    type = "integer",
     help = "Minimal number of cells in each cluster : hclust or igraph [default : '%default' ]"
   ),
   make_option(
     c("-o", "--out"),
     default = "res.tab",
-    type = 'character',
+    type = "character",
     help = "Output name [default : '%default' ]"
   )
 )
 
-opt = parse_args(OptionParser(option_list = option_list),
+opt <- parse_args(OptionParser(option_list = option_list),
                  args = commandArgs(trailingOnly = TRUE))
 
-if (opt$sep == "tab") {opt$sep = "\t"}
+if (opt$sep == "tab") {
+  opt$sep <- "\t"
+  }
 
-data = read.table(
+data <- read.table(
   opt$data,
   check.names = FALSE,
   header = TRUE,
@@ -62,10 +68,9 @@
 )
 
 ## Import data as a SingleCellExperiment object
-sce <- SingleCellExperiment(list(counts=as.matrix(data)))
+sce <- SingleCellExperiment(list(counts = as.matrix(data)))
 
-
-if(opt$cluster){
+if (opt$cluster) {
   clusters <- quickCluster(sce, min.size = opt$size, method = opt$method)
 
   ## Compute sum factors
@@ -78,14 +83,14 @@
 
 sce <- normalize(sce)
 
-logcounts <- data.frame(genes = rownames(sce), round(logcounts(sce), digits=5), check.names = F)
+logcounts <- data.frame(genes = rownames(sce), round(logcounts(sce), digits = 5), check.names = FALSE)
 
 
 write.table(
   logcounts,
   opt$out,
-  col.names = T,
-  row.names = F,
-  quote = F,
+  col.names = TRUE,
+  row.names = FALSE,
+  quote = FALSE,
   sep = "\t"
 )
--- a/scran_normalize.xml	Thu Sep 26 10:50:55 2019 -0400
+++ b/scran_normalize.xml	Sun Dec 04 01:01:01 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="scran_normalize" name="scran_normalize" version="0.2.0">
+<tool id="scran_normalize" name="scran_normalize" version="0.2.1">
     <description>Normalize raw counts expression values using deconvolution size factors</description>
     <requirements>
         <requirement type="package" version="1.6.2">r-optparse</requirement>
@@ -16,7 +16,7 @@
                 --method '$metacell.method'
                 --size '$metacell.size'
             #end if
-            -o ${output}
+            -o '${output}'
 ]]></command>
     <inputs>
         <param name="input" type="data" format="txt,tabular" label="Raw counts of expression data" help = "Must have an header"/>
@@ -92,16 +92,6 @@
 
     </help>
     <citations>
-        <citation type="bibtex">
-            @Article{,
-                author = {Aaron T. L. Lun and Davis J. McCarthy and John C. Marioni},
-                title = {A step-by-step workflow for low-level analysis of single-cell RNA-seq data with Bioconductor},
-                journal = {F1000Res.},
-                year = {2016},
-                volume = {5},
-                pages = {2122},
-                doi = {10.12688/f1000research.9501.2},
-            }
-        </citation>
+        <citation type="doi">10.12688/f1000research.9501.2</citation>
     </citations>
 </tool>