-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsubtype_summary.R
26 lines (24 loc) · 1.1 KB
/
subtype_summary.R
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
#' Define the row colours for the heatmap.
#'
#' @param m The final subtype summary dataframe
plot_summary=function(m,outDir){
print('Plotting summary...')
print(outDir)
print(head(m))
mm<-melt(m,id.vars=1,measure.var=c(5:9))
mm$value=factor(mm$value,levels=sort(levels(mm$value)))
pdf(paste0(outDir,"/subtype_summary_pc.pdf"))
g = ggplot(data = mm, aes(x = sub("_.*","",Sample), fill = value)) + geom_bar(position="fill")
g = g + labs(title = "Classification counts", y = "Classification Percentage", x = "Sample", fill = "PAM50 Subtype")
g = g + theme(text = element_text(size=10), axis.text.x = element_text(angle = 90, hjust = 1, size=4))
print(g)
dev.off()
pdf(paste0(outDir,"/subtype_summary_counts.pdf"))
g = ggplot(data = mm, aes(x = sub("_.*","",Sample), fill = value)) + geom_bar()
g = g + labs(title = "Classification counts", y = "Classification Counts", x = "Sample", fill = "PAM50 Subtype")
g = g + theme(text = element_text(size=10), axis.text.x = element_text(angle = 90, hjust = 1, size=4))
print(g)
dev.off()
}
#m=read.delim('subtype_summary.tsv')
#plot_summary(m,"...")