annotate tximport.R @ 0:206a71a69161 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
author iuc
date Wed, 04 Dec 2019 05:57:26 -0500
parents
children 2c338211927c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
1 # setup R error handling to go to stderr
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
3
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
4 # we need that to not crash galaxy with an UTF8 error on German LC settings.
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
5 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
6
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
7 library("getopt")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
8 options(stringAsFactors = FALSE, useFancyQuotes = FALSE)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
9 args <- commandArgs(trailingOnly = TRUE)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
10
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
11 # get options, using the spec as defined by the enclosed list.
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
12 # we read the options from the default: commandArgs(TRUE).
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
13 spec <- matrix(c(
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
14 "help", "h", 0, "logical",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
15 "out_file", "o", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
16 "countsFiles", "n", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
17 "countsFromAbundance", "r", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
18 "format", "v", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
19 "gff_file", "H", 0, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
20 "tx2gene", "f", 0, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
21 "geneIdCol", "l", 0, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
22 "txIdCol" , "p", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
23 "abundanceCol", "i", 0, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
24 "countsCol", "y", 1, "character",
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
25 "lengthCol", "x", 1, "character"),
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
26 byrow=TRUE, ncol=4)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
27
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
28 opt <- getopt(spec)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
29
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
30 # if help was asked for print a friendly message
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
31 # and exit with a non-zero error code
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
32 if (!is.null(opt$help)) {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
33 cat(getopt(spec, usage=TRUE))
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
34 q(status=1)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
35 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
36
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
37 if (is.null(opt$gff_file) & is.null(opt$tx2gene)) {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
38 cat("A GFF/GTF file or a tx2gene table is required\n")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
39 q(status=1)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
40 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
41
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
42 if (opt$format == 'none'){ #custom format
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
43 if (is.null(opt$txIdCol) | is.null(opt$abundanceCol) | is.null(opt$countsCol) | is.null(opt$lengthCol)) {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
44 cat("If you select a custom format for the input files you need to specify the column names\n")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
45 q(status=1)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
46 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
47 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
48
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
49 if (is.null(opt$countsFiles)) {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
50 cat("'countsFiles' is required\n")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
51 q(status=1)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
52 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
53
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
54
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
55 # load samples from tab file
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
56 samples_df <- read.table(opt$countsFiles, sep="\t", header=TRUE)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
57 colnames(samples_df) <- c("id","path")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
58 rownames(samples_df) <- NULL
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
59 # Prepare char vector with files and sample names
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
60 files <- file.path(samples_df[,"path"])
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
61 names(files) <- samples_df[,"id"]
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
62
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
63
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
64
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
65 library(tximport)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
66
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
67 ### if the input is a gff/gtf file first need to create the tx2gene table
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
68 if (!is.null(opt$gff_file)) {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
69 suppressPackageStartupMessages({
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
70 library("GenomicFeatures")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
71 })
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
72 txdb <- makeTxDbFromGFF(opt$gff_file)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
73 k <- keys(txdb, keytype = "TXNAME")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
74 tx2gene <- select(txdb, keys=k, columns="GENEID", keytype="TXNAME")
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
75 # Remove 'transcript:' from transcript IDs (when gffFile is a GFF3 from Ensembl and the transcript does not have a Name)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
76 tx2gene$TXNAME <- sub('^transcript:', '', tx2gene$TXNAME)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
77
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
78 } else {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
79 tx2gene <- read.table(opt$tx2gene,header=FALSE)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
80 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
81
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
82
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
83
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
84 ##
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
85 if (is.null(opt$geneIdCol)) { ## there is a tx2gene table
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
86 if (opt$format == 'none'){ #predefined format
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
87 txi_out <- tximport(files, type="none",txIdCol=opt$txIdCol,abundanceCol=opt$abundanceCol,countsCol=opt$countsCol,lengthCol=opt$lengthCol,tx2gene=tx2gene,countsFromAbundance=opt$countsFromAbundance)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
88 } else {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
89 txi_out <- tximport(files, type=opt$format, tx2gene=tx2gene,countsFromAbundance=opt$countsFromAbundance)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
90 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
91 } else { # the gene_ID is a column in the counts table
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
92 if (opt$format == 'none'){ #predefined format
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
93 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)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
94 } else {
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
95 txi_out <- tximport(files, type=opt$format, geneIdCol=opt$geneIdCol,countsFromAbundance=opt$countsFromAbundance)
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
96 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
97
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
98 }
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
99 # write count as table
206a71a69161 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/tximport commit 66c3b86403faa115751332ea8e0383e26b9ee599"
iuc
parents:
diff changeset
100 write.table(txi_out$counts, file=opt$out_file, row.names = TRUE, col.names = TRUE, quote = FALSE, sep = "\t")