Mercurial > repos > iuc > edger
comparison edger.R @ 5:fb9b9f0f2f06 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 91bdcc6a5a46173be6546d590cdf3f311c2b1476
author | iuc |
---|---|
date | Tue, 05 Feb 2019 20:57:30 -0500 |
parents | 4730985c816f |
children | 555659de7321 |
comparison
equal
deleted
inserted
replaced
4:4730985c816f | 5:fb9b9f0f2f06 |
---|---|
259 countfiles <- lapply(sampleTable$filename, function(x){read.delim(x, row.names=1)}) | 259 countfiles <- lapply(sampleTable$filename, function(x){read.delim(x, row.names=1)}) |
260 counts <- do.call("cbind", countfiles) | 260 counts <- do.call("cbind", countfiles) |
261 | 261 |
262 } else { | 262 } else { |
263 # Process the single count matrix | 263 # Process the single count matrix |
264 counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE) | 264 counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", strip.white=TRUE, stringsAsFactors=FALSE) |
265 row.names(counts) <- counts[, 1] | 265 row.names(counts) <- counts[, 1] |
266 counts <- counts[ , -1] | 266 counts <- counts[ , -1] |
267 countsRows <- nrow(counts) | 267 countsRows <- nrow(counts) |
268 | 268 |
269 # Process factors | 269 # Process factors |
270 if (is.null(opt$factInput)) { | 270 if (is.null(opt$factInput)) { |
271 factorData <- read.table(opt$factFile, header=TRUE, sep="\t", strip.white=TRUE) | 271 factorData <- read.table(opt$factFile, header=TRUE, sep="\t", strip.white=TRUE) |
272 # check samples names match | |
273 if(!any(factorData[, 1] %in% colnames(counts))) | |
274 stop("Sample IDs in factors file and count matrix don't match") | |
272 # order samples as in counts matrix | 275 # order samples as in counts matrix |
273 factorData <- factorData[match(colnames(counts), factorData[, 1]), ] | 276 factorData <- factorData[match(colnames(counts), factorData[, 1]), ] |
274 factors <- factorData[, -1, drop=FALSE] | 277 factors <- factorData[, -1, drop=FALSE] |
275 } else { | 278 } else { |
276 factors <- unlist(strsplit(opt$factInput, "|", fixed=TRUE)) | 279 factors <- unlist(strsplit(opt$factInput, "|", fixed=TRUE)) |
291 } | 294 } |
292 } | 295 } |
293 | 296 |
294 # if annotation file provided | 297 # if annotation file provided |
295 if (haveAnno) { | 298 if (haveAnno) { |
296 geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", stringsAsFactors=FALSE) | 299 geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", quote= "", strip.white=TRUE, stringsAsFactors=FALSE) |
297 } | 300 } |
298 | 301 |
299 #Create output directory | 302 #Create output directory |
300 dir.create(opt$outPath, showWarnings=FALSE) | 303 dir.create(opt$outPath, showWarnings=FALSE) |
301 | 304 |