Newer
Older
# Based on a script by Szymon Kielbasa/Ioannis Moustakas
command <<<
library(dplyr)
library(reshape2)
listOfFiles <- c("${sep='", "' inputFiles}")
valueI <- ${valueColumn}
featureI <- ${featureColumn}
header <- ${true="TRUE" false="FALSE" inputHasHeader}
splitPath <- strsplit(file, "/")[[1]]
colnames(d)[valueI] <- sub("\\\.[^\\\.]*$", "",
splitPath[length(splitPath)])
colnames(d)[featureI] <- "feature"
d <- d %>% melt(id.vars=featureI, variable.name="sample", value.name="count")
write.table(d, file="${outputFile}", sep="\t", quote=FALSE, row.names=FALSE)