Skip to content

Commit

Permalink
upgrade gsc_scran_normalize (#652)
Browse files Browse the repository at this point in the history
* upgrade scran conda package

* Install dynamicTreeCut conda package now required by scran

* replace deprecated "normalize" by logNormCounts function of scran

* Update scran-normalize.R

* update .shed.yml with repo url

* update all tests
  • Loading branch information
drosofff authored Dec 10, 2023
1 parent c394391 commit a14fb3d
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 255 deletions.
2 changes: 1 addition & 1 deletion tools/gsc_scran_normalize/.shed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ long_description: |
categories:
- Transcriptomics
homepage_url: http://artbio.fr
remote_repository_url: https://github.com/ARTbio/tools-artbio/tree/master/tools/gsc_scran_normalize
remote_repository_url: https://github.com/ARTbio/tools-artbio/tree/main/tools/gsc_scran_normalize
toolshed:
- toolshed
19 changes: 5 additions & 14 deletions tools/gsc_scran_normalize/scran-normalize.R
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -19,12 +19,6 @@ option_list <- list(
type = "character",
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,
Expand Down Expand Up @@ -53,18 +47,15 @@ option_list <- list(
)

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
Expand All @@ -81,7 +72,7 @@ if (opt$cluster) {
sce <- computeSumFactors(sce)
}

sce <- normalize(sce)
sce <- logNormCounts(sce)

logcounts <- data.frame(genes = rownames(sce), round(logcounts(sce), digits = 5), check.names = FALSE)

Expand Down
22 changes: 9 additions & 13 deletions tools/gsc_scran_normalize/scran_normalize.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<tool id="scran_normalize" name="scran_normalize" version="0.2.1">
<tool id="scran_normalize" name="scran_normalize" version="1.28.1+galaxy0">
<description>Normalize raw counts expression values using deconvolution size factors</description>
<requirements>
<requirement type="package" version="1.6.2">r-optparse</requirement>
<requirement type="package" version="1.12.1=r36he1b5a44_0">bioconductor-scran</requirement>
<requirement type="package" version="1.28.1">bioconductor-scran</requirement>
<requirement type="package" version="1.63_1">r-dynamictreecut</requirement>
<requirement type="package" version="1.7.3">r-optparse</requirement>
</requirements>
<stdio>
<exit_code range="1:" level="fatal" description="Tool exception" />
</stdio>
<command detect_errors="exit_code"><![CDATA[
Rscript $__tool_directory__/scran-normalize.R
--data '$input'
--sep '$input_sep'
#if $metacell.cluster == "Yes":
--cluster
--method '$metacell.method'
Expand All @@ -19,11 +19,7 @@
-o '${output}'
]]></command>
<inputs>
<param name="input" type="data" format="txt,tabular" label="Raw counts of expression data" help = "Must have an header"/>
<param name="input_sep" type="select" label="Input column separator">
<option value="tab" selected="true">Tabulation</option>
<option value=",">Comma</option>
</param>
<param name="input" type="data" format="tabular" label="Raw counts of expression data" help = "A tsv file that must have an header line"/>
<conditional name="metacell">
<param name="cluster" type="select" label = "Do you want to cluster cells ?" help="Perform scaling method on metacell, see Details">
<option value="Yes">Yes</option>
Expand All @@ -45,18 +41,18 @@
</outputs>
<tests>
<test>
<param name="input" value="counts.tab" ftype="tabular"/>
<output name="output" file="logcounts.tab" ftype="tabular"/>
<param name="input" value="counts.tsv" ftype="tabular"/>
<output name="output" file="logcounts.tsv" ftype="tabular"/>
</test>
<test>
<param name="input" value="counts.tab" ftype="tabular"/>
<param name="input" value="counts.tsv" ftype="tabular"/>
<param name="cluster" value="Yes"/>
<param name="method" value="igraph"/>
<param name="size" value="25"/>
<output name="output" file="logcounts_igraph.tsv" ftype="tabular"/>
</test>
<test>
<param name="input" value="counts.tab" ftype="tabular"/>
<param name="input" value="counts.tsv" ftype="tabular"/>
<param name="cluster" value="Yes"/>
<param name="method" value="hclust"/>
<param name="size" value="25"/>
Expand Down
Loading

0 comments on commit a14fb3d

Please sign in to comment.