changeset 1:2c338211927c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit b2e8dce6a2cebcc338b0f1b3acefd6ea01fbb418"
author iuc
date Thu, 23 Sep 2021 00:18:22 +0000
parents 206a71a69161
children 1906cb429215
files tximport.R tximport.xml
diffstat 2 files changed, 39 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/tximport.R	Wed Dec 04 05:57:26 2019 -0500
+++ b/tximport.R	Thu Sep 23 00:18:22 2021 +0000
@@ -1,5 +1,7 @@
 # setup R error handling to go to stderr
-options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
+options(show.error.messages = F, error = function() {
+    cat(geterrmessage(), file = stderr()); q("no", 1, F)
+})
 
 # we need that to not crash galaxy with an UTF8 error on German LC settings.
 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
@@ -19,46 +21,46 @@
   "gff_file", "H", 0, "character",
   "tx2gene", "f", 0, "character",
   "geneIdCol", "l", 0, "character",
-  "txIdCol" , "p", 1, "character",
+  "txIdCol", "p", 1, "character",
   "abundanceCol", "i", 0, "character",
   "countsCol", "y", 1, "character",
   "lengthCol", "x", 1, "character"),
-  byrow=TRUE, ncol=4)
+  byrow = TRUE, ncol = 4)
 
 opt <- getopt(spec)
 
 # if help was asked for print a friendly message
 # and exit with a non-zero error code
 if (!is.null(opt$help)) {
-  cat(getopt(spec, usage=TRUE))
-  q(status=1)
+  cat(getopt(spec, usage = TRUE))
+  q(status = 1)
 }
 	
 if (is.null(opt$gff_file) & is.null(opt$tx2gene)) {
   cat("A GFF/GTF file or a tx2gene table is required\n")
-  q(status=1)
+  q(status = 1)
 }
 
-if (opt$format == 'none'){  #custom format
+if (opt$format == "none") {  #custom format
     if (is.null(opt$txIdCol) | is.null(opt$abundanceCol) | is.null(opt$countsCol) | is.null(opt$lengthCol)) {
         cat("If you select a custom format for the input files you need to specify the column names\n")
-        q(status=1)
+        q(status = 1)
    }
 }
 
 if (is.null(opt$countsFiles)) {
   cat("'countsFiles' is required\n")
-  q(status=1)
+  q(status = 1)
 }
 
 
 # load samples from tab file
-samples_df <- read.table(opt$countsFiles, sep="\t", header=TRUE)
-colnames(samples_df) <- c("id","path")
+samples_df <- read.table(opt$countsFiles, sep = "\t", header = TRUE)
+colnames(samples_df) <- c("id", "path")
 rownames(samples_df) <- NULL
-# Prepare char vector with files and sample names 
-files <- file.path(samples_df[,"path"])
-names(files) <- samples_df[,"id"]
+# Prepare char vector with files and sample names
+files <- file.path(samples_df[, "path"])
+names(files) <- samples_df[, "id"]
 
 
 
@@ -71,30 +73,30 @@
     })
     txdb <- makeTxDbFromGFF(opt$gff_file)
     k <- keys(txdb, keytype = "TXNAME")
-    tx2gene <- select(txdb, keys=k, columns="GENEID", keytype="TXNAME")
+    tx2gene <- select(txdb, keys = k, columns = "GENEID", keytype = "TXNAME")
     # Remove 'transcript:' from transcript IDs (when gffFile is a GFF3 from Ensembl and the transcript does not have a Name)
-    tx2gene$TXNAME <- sub('^transcript:', '', tx2gene$TXNAME)
+    tx2gene$TXNAME <- sub("^transcript:", "", tx2gene$TXNAME)  # nolint
 
 } else {
-        tx2gene <- read.table(opt$tx2gene,header=FALSE)
+        tx2gene <- read.table(opt$tx2gene, header = FALSE)
     }
 
 
 
 ##
 if (is.null(opt$geneIdCol)) { ## there is a tx2gene table
-    if (opt$format == 'none'){  #predefined format 
-        txi_out <- tximport(files, type="none",txIdCol=opt$txIdCol,abundanceCol=opt$abundanceCol,countsCol=opt$countsCol,lengthCol=opt$lengthCol,tx2gene=tx2gene,countsFromAbundance=opt$countsFromAbundance)
+    if (opt$format == "none") {  #predefined format
+        txi_out <- tximport(files, type = "none", txIdCol = opt$txIdCol, abundanceCol = opt$abundanceCol, countsCol = opt$countsCol, lengthCol = opt$lengthCol, tx2gene = tx2gene, countsFromAbundance = opt$countsFromAbundance)
     } else {
-        txi_out <- tximport(files, type=opt$format, tx2gene=tx2gene,countsFromAbundance=opt$countsFromAbundance)
+        txi_out <- tximport(files, type = opt$format, tx2gene = tx2gene, countsFromAbundance = opt$countsFromAbundance)
     }
 } else {  # the gene_ID is a column in the counts table
-    if (opt$format == 'none'){  #predefined format
-        txi_out <- tximport(files, type="none",geneIdCol=opt$geneIdCol,txIdCol=opt$txIdCol,abundanceCol=opt$abundanceCol,countsCol=opt$countsCol,lengthCol=opt$lengthCol,tx2gene=tx2gene,countsFromAbundance=opt$countsFromAbundance)
+    if (opt$format == "none") {  #predefined format
+        txi_out <- tximport(files, type = "none", geneIdCol = opt$geneIdCol, txIdCol = opt$txIdCol, abundanceCol = opt$abundanceCol, countsCol = opt$countsCol, lengthCol = opt$lengthCol, tx2gene = tx2gene, countsFromAbundance = opt$countsFromAbundance)
     } else {
-        txi_out <- tximport(files, type=opt$format, geneIdCol=opt$geneIdCol,countsFromAbundance=opt$countsFromAbundance)
+        txi_out <- tximport(files, type = opt$format, geneIdCol = opt$geneIdCol, countsFromAbundance = opt$countsFromAbundance)
     }
 
 }
 # write count as table
-write.table(txi_out$counts, file=opt$out_file, row.names = TRUE, col.names = TRUE, quote = FALSE, sep = "\t")
+write.table(txi_out$counts, file = opt$out_file, row.names = TRUE, col.names = TRUE, quote = FALSE, sep = "\t")
--- a/tximport.xml	Wed Dec 04 05:57:26 2019 -0500
+++ b/tximport.xml	Thu Sep 23 00:18:22 2021 +0000
@@ -1,9 +1,15 @@
-<tool id="tximport" name="tximport" version="0.1">
+<tool id="tximport" name="tximport" version="@TOOL_VERSION@" profile="20.09">
+    <macros>
+        <token name="@TOOL_VERSION@">1.20.0</token>
+    </macros>
     <description>Summarize transcript-level estimates for gene-level analysis</description>
+    <xrefs>
+        <xref type="bio.tools">tximport</xref>
+    </xrefs>
     <requirements>
-        <requirement type="package">bioconductor-tximport</requirement>
-        <requirement type="package" version="1.34.1">bioconductor-genomicfeatures</requirement>
-        <requirement type="package" version="1.20.2">r-getopt</requirement>
+        <requirement type="package" version="@TOOL_VERSION@">bioconductor-tximport</requirement>
+        <requirement type="package" version="1.44.0">bioconductor-genomicfeatures</requirement>
+        <requirement type="package" version="1.20.3">r-getopt</requirement>
     </requirements>
 
     <stdio>
@@ -123,9 +129,9 @@
         </conditional>
         <param name="counts_from_abundance" type="select" label="Summarization using the abundance (TPM) values?">
             <option value="no">No</option>
-            <option value="scaled_TPM">Scaled up to library size</option>
-            <option value="length_scaled_TPM">Scaled using the avg. transcript legth over samples and then the library size</option>
-            <option value="dtu_scaled_TPM">Scaled using the median transcript length among isoforms of a gene, and then the library size</option>
+            <option value="scaledTPM">Scaled up to library size</option>
+            <option value="lengthScaledTPM">Scaled using the avg. transcript legth over samples and then the library size</option>
+            <option value="dtuScaledTPM">Scaled using the median transcript length among isoforms of a gene, and then the library size</option>
         </param>
     </inputs>
     <outputs>