comparison experimental_design/experimental_design.r @ 0:afe85eb6572e draft

Uploaded
author davidvanzessen
date Mon, 29 Aug 2016 05:41:20 -0400
parents
children 106275b54470
comparison
equal deleted inserted replaced
-1:000000000000 0:afe85eb6572e
1 args <- commandArgs(trailingOnly = TRUE)
2
3 print(args)
4
5 inputs = args[1:(length(args) - 1)]
6 output = args[length(args)]
7
8 current.id = ""
9 counter = 1
10
11 result = NULL
12
13 for(current in inputs){
14 if(grepl("/", current)){ #its a path to a file
15 print(paste("Adding file", counter, "to", current.id))
16 dat = read.table(current, sep="\t", header=T, quote="", fill=T)
17
18 #IMGT check
19
20 dat$Sample = current.id
21 dat$Replicate = counter
22
23 if(is.null(result)){
24 result = dat[NULL,]
25 }
26
27 result = rbind(result, dat)
28
29 counter = counter + 1
30
31 } else { #its an ID of a patient
32 print(paste("New patient", current))
33 current.id = current
34 counter = 1
35 }
36 }
37
38 write.table(result, output, sep="\t", quote=F, row.names=F, col.names=T)