forked from gshattow/TCGA_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRscript.txt
More file actions
32 lines (21 loc) · 1012 Bytes
/
Copy pathRscript.txt
File metadata and controls
32 lines (21 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
data=read.table("kirch.maf",fill=T,head=T)
ref=as.character(data$Reference_Allele)
allele1=as.character(data$Tumor_Seq_Allele1)
allele2=as.character(data$Tumor_Seq_Allele2)
good_Hugo=which(ref!=allele2)
genes=as.character(unique(data$Hugo[good_Hugo]))
counts=0*c(1:length(genes))
chromosome=counts
for(i in 2:length(genes)){
ref=as.character(data$Reference_Allele[which(data$Hugo_Symbol==genes[i])])
allele1=as.character(data$Tumor_Seq_Allele1[which(data$Hugo_Symbol==genes[i])])
counts[i]=length(which(ref!=allele1))
chromosome[i]=as.character(data$Chromosome[which(data$Hugo_Symbol==genes[i])])[1]
}
f <- function(x) {
r <- quantile(x, probs = c(0.025, 0.1573, 0.5, 0.84, 0.975))
names(r) <- c("ymin", "lower", "middle", "upper", "ymax")
r
}
frame=data.frame(chromosome, counts, genes)
p <- ggplot(frame, aes(factor(chromosome), counts)) + theme_bw() + theme(legend.position="none") + geom_boxplot(aes(fill = factor(chromosome))) + ylim(0,2) + ylab("Variant Counts") + xlab("Chromosome")