Skip to content
Snippets Groups Projects
Commit 297fb116 authored by Anne Frambourg's avatar Anne Frambourg
Browse files

[mcq.plot.peptide.reproducibility] => ggplot ok

parent ebb6bb46
No related branches found
No related tags found
No related merge requests found
......@@ -23,32 +23,24 @@ mcq.plot.peptide.reproducibility<- function (object, file=NULL) {
nb.prot.kept <- length(unique(object@proteins$protein[object@proteins$peptide %in% names.pep.kept]))
nb.prot.lost <- c(nb.prot.lost, nb.prot.tot-nb.prot.kept)
}
nb.prot.lost.norm <- floor(nb.prot.lost * max(nb.pepz.lost)/max(nb.prot.lost))
df1 <- data.frame(x=seq(0,100, by=5),y=nb.pepz.lost,z=rep("peptides-mz",length(nb.pepz.lost)))
df2 <- data.frame(x=seq(0,100, by=5),y=nb.prot.lost,z=rep("proteins",length(nb.prot.lost)))
df2 <- data.frame(x=seq(0,100, by=5),y=nb.prot.lost.norm,z=rep("proteins",length(nb.prot.lost.norm)))
df3 <- rbind(df1,df2)
if (is.null(file)){
par(ask=FALSE)
}
else{
pdf(file, title=gsub('.pdf$','',file), width=15)
}
#par(mfrow=c(1,2))
#hist(count, main=c("Distribution of the number of injections in which", "a peptide-mz was quantified"), xlab="Number of injections", nclass=nbsample, border="darkblue", ylab="Number of peptides-mz")
#par(mar=c(6,4,2,5))
#plot(nb.pepz.lost~seq(0,100, by=5), type="b", ylab="Number of peptides-mz lost", xlab=c("% of NA tolerated per peptide-mz"), col="red")
#par(new=TRUE)
#plot(nb.prot.lost~seq(0,100, by=5), axes=FALSE, xlab="", ylab="", col="blue", type="b")
#axis(4, labels=TRUE)
#mtext("Number of proteins lost",side=4, line=2.5)
#legend("topright", pch=1, col=c("red", "blue"), legend=c("Peptides-mz", "Proteins"), bty="n")
#par(mar=c(5,4,4,2))
#par(new=FALSE)
#par(mfrow=c(1,1))
# plots representation
# ggplot2
plot1 <- ggplot(df, aes(x=value)) +
geom_histogram(binwidth=0.5) +
theme(panel.background=element_blank(),plot.title = element_text(hjust=0.5)) +
......@@ -58,7 +50,11 @@ mcq.plot.peptide.reproducibility<- function (object, file=NULL) {
plot2 <- ggplot(df3, aes(x=x,y=y,colour=z)) +
geom_point() +
geom_line()
geom_line() +
scale_x_continuous("% of NA tolerated per peptide-mz") +
scale_y_continuous("Number of peptides-mz lost", sec.axis=sec_axis(~./(max(nb.pepz.lost)/max(nb.prot.lost)),name="Number of proteins lost")) +
theme(legend.position = "none", axis.title.y = element_text(color = "red"),axis.text.y = element_text(color = "red"), axis.text.y.right = element_text(color = "cyan3"),axis.title.y.right = element_text(color = "cyan3"))
grid.arrange(plot1, plot2, ncol=2, nrow = 1)
if (!is.null(file)){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment