annotate change_o/define_clones.r @ 0:8a5a2abbb870 draft default tip

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