comparison experimental_design/experimental_design.r @ 5:bcec7bb4e089 draft

Uploaded
author davidvanzessen
date Mon, 12 Dec 2016 05:22:57 -0500
parents afe85eb6572e
children 106275b54470
comparison
equal deleted inserted replaced
4:5ffd52fc35c4 5:bcec7bb4e089
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)