Skip to content
Snippets Groups Projects
Commit ab88bc1a authored by Ruben Vorderman's avatar Ruben Vorderman
Browse files

mergecounts to 1.0

parent 1dbfac51
No related branches found
No related tags found
1 merge request!34Move all files to version 1.0
task MergeCounts {
String? preCommand
Array[File] inputFiles
String outputFile
Int featureColumn
Int valueColumn
Boolean inputHasHeader
version 1.0
task MergeCounts {
input {
String? preCommand
Array[File] inputFiles
String outputFile
Int featureColumn
Int valueColumn
Boolean inputHasHeader
}
# Based on a script by Szymon Kielbasa/Ioannis Moustakas
command <<<
set -e -o pipefail
mkdir -p ${sub(outputFile, basename(outputFile) + "$", "")}
${preCommand}
mkdir -p ~{sub(outputFile, basename(outputFile) + "$", "")}
~{preCommand}
R --no-save <<CODE
library(dplyr)
library(reshape2)
listOfFiles <- c("${sep='", "' inputFiles}")
listOfFiles <- c("~{sep='", "' inputFiles}")
valueI <- ${valueColumn}
featureI <- ${featureColumn}
header <- ${true="TRUE" false="FALSE" inputHasHeader}
valueI <- ~{valueColumn}
featureI <- ~{featureColumn}
header <- ~{true="TRUE" false="FALSE" inputHasHeader}
d <- do.call(rbind, lapply(listOfFiles, function(file){
d <- read.table(file, sep="\t", header=header, comment.char="#")
......@@ -34,7 +37,7 @@ task MergeCounts {
}))
d <- d %>% dcast(feature ~ sample, value.var="count")
write.table(d, file="${outputFile}", sep="\t", quote=FALSE, row.names=FALSE)
write.table(d, file="~{outputFile}", sep="\t", quote=FALSE, row.names=FALSE)
CODE
>>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment