diff scran-normalize.R @ 2:6864acb21714 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/main/tools/gsc_scran_normalize commit a14fb3d106b647c4f1dea2c8d3ac7c1e8848b21c
author artbio
date Sun, 10 Dec 2023 00:27:45 +0000
parents fb2f1b8b0013
children
line wrap: on
line diff
--- a/scran-normalize.R	Sun Dec 04 01:01:01 2022 +0000
+++ b/scran-normalize.R	Sun Dec 10 00:27:45 2023 +0000
@@ -1,15 +1,15 @@
-# load packages that are provided in the conda env
 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)
+library(dynamicTreeCut)
 
 # Arguments
 option_list <- list(
@@ -20,12 +20,6 @@
     help = "Input file that contains count values to transform"
   ),
   make_option(
-    c("-s", "--sep"),
-    default = "\t",
-    type = "character",
-    help = "File separator [default : '%default' ]"
-  ),
-  make_option(
     "--cluster",
     default = FALSE,
     action = "store_true",
@@ -53,18 +47,15 @@
 )
 
 opt <- parse_args(OptionParser(option_list = option_list),
-                 args = commandArgs(trailingOnly = TRUE))
+                  args = commandArgs(trailingOnly = TRUE))
 
-if (opt$sep == "tab") {
-  opt$sep <- "\t"
-  }
 
 data <- read.table(
   opt$data,
   check.names = FALSE,
   header = TRUE,
   row.names = 1,
-  sep = opt$sep
+  sep = "\t"
 )
 
 ## Import data as a SingleCellExperiment object
@@ -81,7 +72,7 @@
   sce <- computeSumFactors(sce)
 }
 
-sce <- normalize(sce)
+sce <- logNormCounts(sce)
 
 logcounts <- data.frame(genes = rownames(sce), round(logcounts(sce), digits = 5), check.names = FALSE)