diff experimental_design/experimental_design.r @ 52:124b7fd92a3e draft

Uploaded
author davidvanzessen
date Thu, 25 Feb 2021 13:36:15 +0000
parents 106275b54470
children 81b3eb11ed2c
line wrap: on
line diff
--- a/experimental_design/experimental_design.r	Thu Aug 08 07:40:36 2019 -0400
+++ b/experimental_design/experimental_design.r	Thu Feb 25 13:36:15 2021 +0000
@@ -1,43 +1,43 @@
-args <- commandArgs(trailingOnly = TRUE)
-
-print(args)
-
-inputs = args[1:(length(args) - 1)]
-output = args[length(args)]
-
-current.id = ""
-counter = 1
-
-result = NULL
-
-for(current in inputs){
-	if(grepl("/", current)){ #its a path to a file
-		print(paste("Adding file", counter, "to", current.id))
-		dat = read.table(current, sep="\t", header=T, quote="", fill=T)
-		
-		if(nrow(dat) == 0){
-			print(paste(counter, "of", current.id, "has no sequences, skipping"))
-			next
-		}
-		
-		#IMGT check
-		
-		dat$Sample = current.id
-		dat$Replicate = counter
-		
-		if(is.null(result)){
-			result = dat[NULL,]
-		}
-		
-		result = rbind(result, dat)
-		
-		counter = counter + 1
-		
-	} else { #its an ID of a patient
-		print(paste("New patient", current))
-		current.id = current
-		counter = 1
-	}
-}
-
-write.table(result, output, sep="\t", quote=F, row.names=F, col.names=T)
+args <- commandArgs(trailingOnly = TRUE)
+
+print(args)
+
+inputs = args[1:(length(args) - 1)]
+output = args[length(args)]
+
+current.id = ""
+counter = 1
+
+result = NULL
+
+for(current in inputs){
+	if(grepl("/", current)){ #its a path to a file
+		print(paste("Adding file", counter, "to", current.id))
+		dat = read.table(current, sep="\t", header=T, quote="", fill=T)
+		
+		if(nrow(dat) == 0){
+			print(paste(counter, "of", current.id, "has no sequences, skipping"))
+			next
+		}
+		
+		#IMGT check
+		
+		dat$Sample = current.id
+		dat$Replicate = counter
+		
+		if(is.null(result)){
+			result = dat[NULL,]
+		}
+		
+		result = rbind(result, dat)
+		
+		counter = counter + 1
+		
+	} else { #its an ID of a patient
+		print(paste("New patient", current))
+		current.id = current
+		counter = 1
+	}
+}
+
+write.table(result, output, sep="\t", quote=F, row.names=F, col.names=T)