|
| 1 | +# By Scott Teresi |
| 2 | +# Sample Pie Graph |
| 3 | +#============================================= |
| 4 | +library(ggplot2) |
| 5 | +library(RColorBrewer) |
| 6 | +library(plotrix) |
| 7 | +setwd("/home/scott/Documents/Uni/Research/transposon_2.0/Camarosa_TE/") |
| 8 | +#Type_TE_Data = read.csv2('Type_Table.csv', header=FALSE) |
| 9 | +#Family_TE_Data = read.csv2('Family_Table.csv', header=FALSE) |
| 10 | + |
| 11 | +Type_TE_Data <- data.frame( |
| 12 | + group = c("DNA", "LTR", "Unknown", "LINE"), |
| 13 | + value = c(82619, 314043, 45600, 15646) |
| 14 | +) |
| 15 | +head(Type_TE_Data) |
| 16 | + |
| 17 | +#colnames(Type_TE_Data) = c("Type","Number") |
| 18 | +#colnames(Family_TE_Data) = c("Family","Number") |
| 19 | + |
| 20 | +#bp<- ggplot(Type_TE_Data, aes(x="", y=value, fill=group))+ |
| 21 | +#geom_bar(width = 1, stat = "identity") # this step is required to get the colors and such |
| 22 | + |
| 23 | +#pie <- bp + coord_polar("y", start=0) |
| 24 | +#pie |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +slices = c(82619, 314043, 45600, 15646) |
| 36 | +lbls = c("DNA", "LTR", "Unknown", "LINE") |
| 37 | +pct <- round(slices/sum(slices)*100) |
| 38 | +lbls <- paste(lbls, pct) # add percents to labels |
| 39 | +lbls <- paste(lbls,"%",sep="") # ad % to labels |
| 40 | +pie(slices,labels = lbls, col=rainbow(length(lbls)), |
| 41 | + main="TE Percentages Genome-Wide by Type") |
| 42 | + |
| 43 | + |
| 44 | +png(file="Type_Pie.png",width=700,height=600) |
| 45 | +#plot(x=rnorm(10),y=rnorm(10),main="example") |
| 46 | +pie(slices,labels = lbls, col=rainbow(length(lbls)), |
| 47 | + main="TE Percentages Genome-Wide by Type") |
| 48 | +par(mar=c(4,4,4,6)) # bottom, left top right |
| 49 | +dev.off() |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +lbls = c("MULE","Gypsy (LTR)","Unknown LTR Family","CMC-EnSpm","Copia (LTR)","Unknown","LINE","hAT","PIF-Harbinger") |
| 54 | +slices = c(17424,98511,174430,17233,41100,65293,15646,18657,9609) |
| 55 | +pct <- round(slices/sum(slices)*100) |
| 56 | +lbls <- paste(lbls, pct) # add percents to labels |
| 57 | +lbls <- paste(lbls,"%",sep="") # ad % to labels |
| 58 | +pie(slices,labels = lbls, col=rainbow(length(lbls)), |
| 59 | + main="TE Percentages Genome-Wide by Family") |
| 60 | + |
| 61 | + |
| 62 | +png(file="Family_Pie.png",width=700,height=600) |
| 63 | +#plot(x=rnorm(10),y=rnorm(10),main="example") |
| 64 | +pie(slices,labels = lbls, col=rainbow(length(lbls)), |
| 65 | + main="TE Percentages Genome-Wide by Family") |
| 66 | +par(mar=c(4,4,4,6)) |
| 67 | +dev.off() |
| 68 | + |
0 commit comments