annotate change_o/define_clones.r @ 12:6b66c1c57f22 draft

Uploaded
author davidvanzessen
date Thu, 10 Nov 2016 08:36:18 -0500
parents c33d93683a09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
1 args <- commandArgs(trailingOnly = TRUE)
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
2
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
3 input=args[1]
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
4 output=args[2]
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
5
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
6 change.o = read.table(input, header=T, sep="\t", quote="", stringsAsFactors=F)
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
7
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
8 freq = data.frame(table(change.o$CLONE))
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
9 freq2 = data.frame(table(freq$Freq))
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
10
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
11 freq2$final = as.numeric(freq2$Freq) * as.numeric(as.character(freq2$Var1))
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
12
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
13 names(freq2) = c("Clone size", "Nr of clones", "Nr of sequences")
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
14
c33d93683a09 Uploaded
davidvanzessen
parents:
diff changeset
15 write.table(x=freq2, file=output, sep="\t",quote=F,row.names=F,col.names=T)