Skip to content
Snippets Groups Projects
Commit 97491a26 authored by Thierry Balliau's avatar Thierry Balliau
Browse files

modification nom de fonction mcq.plot.area.triplex.effect vers mcq.plot.area.multiplex.effect

parent bcaef1ea
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@
export("mcq.get.protlist")
# Functions mcq.plot
export("mcq.plot.aera.triplex.effect")
export("mcq.plot.aera.multiplex.effect")
export("mcq.plot.cluster")
export("mcq.plot.counts.per.injection")
export("mcq.plot.global.intensity")
......
### method to plot area in log by triplex to show if there is a specifique effect for each triplex
mcq.plot.aera.multiplex.effect <- function(object, file=NULL, binwidth=0.25, type="histogram") {
error_messages <- list()
j=1
# if (!is.numeric(class)&!is.null(class)){
# error_messages[[j]] <- "class argument must be numeric"
# j=j+1
# }
if (!is.numeric(binwidth)){
error_messages[[j]] <- "binwidth argument must be numeric"
j=j+1
}
if(!is.character(file)&!is.null(file)){
error_messages[[j]] <- "file argument must be characters"
j=j+1
}
if (!(type %in% c("histogram", "density", "experimental"))){
error_messages[[j]] <- "file argument must be characters"
j=j+1
}
if (length(error_messages) != 0){
stop(paste("Error on argument format:\n", paste(error_messages, collapse="\n"), sep=""))
}
# if(class(object) == "cmcq.pepq.sds"){
# if(class(object[[1]]) %in% c("cmcq.pepq.masschroq.labeling","cmcq.pepq.masschroq")){
# ## preparing data
# data <- mcq.union.fraction.sds.corrected(object, verbose=FALSE)[[1]]
# inj <- data@metadata@injections
# meta <- data@metadata@metadata
# ### workaround because meta contains fraction column if generated with mcq.union.fraction.sds
# if("fraction" %in% colnames(meta)){
# meta <- meta[,-which(colnames(meta) %in% "fraction")]
# }
# inj$msrun_label <- paste(inj$msrun, inj$label, sep="_")
# meta <- cbind(inj, meta)
# pep <- as.data.table(data@peptides)
# meta <- as.data.table(meta)
# pep <- merge(pep, meta)
# }
# }else
if (class(object) == "cmcq.pepq.masschroq.labeling"){
inj <- object@metadata@injections
meta <- object@metadata@metadata
### workaround because meta contains fraction column if generated with mcq.union.fraction.sds
if("fraction" %in% colnames(meta)){
meta <- meta[,-which(colnames(meta) %in% "fraction")]
}
inj$msrun_label <- paste(inj$msrun, inj$label, sep="_")
meta <- cbind(inj, meta)
pep <- as.data.table(object@peptides)
meta <- as.data.table(meta)
pep <- merge(pep, meta)
}else{
stop(paste("the class \"", class(object),"\" is not taken into account by mcq.plot.aera.triplex.effect",sep=""))
}
p<- list()
if(type == "histogram"){
temp <- ggplot(pep, aes(x=logarea, fill=track))+geom_histogram(position= position_dodge2(padding= 0.1), binwidth = binwidth)+xlab("log10(area)")
temp <- temp + ggtitle("Distribution of log10(area) by triplex")
p[[1]] <- temp
}else if(type == "density"){
temp <- ggplot(pep, aes(x=logarea, fill=track, color=track))+geom_density(alpha=0.1)
temp <- temp + ggtitle("Distribution of log10(area) by triplex")
p[[1]] <- temp
}else if(type == "experimental"){
toplot <- priv.mcq.compute.hist(as.data.frame(pep), class=20, by="track", value="logarea")
temp <-ggplot(toplot, aes(x=mids, y=count, fill=track))+geom_bar(stat="identity", position=position_dodge2(padding=0.2))+ theme(axis.text.x = element_text(angle = 90, hjust = 1))+xlab("log10(area)")+ylab("count")
temp <- temp + ggtitle("Distribution of log10(area) by triplex")
p[[1]] <- temp
}
priv.mcq.visualisation.graph(p, file)
}
\ No newline at end of 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