require(ggplot2)
dd = data.frame(x=1:10, y=11:20)
a = qcMetric$new(helpText="small help text",
## arbitrary arguments, matched during setData()
workerFcn=function(.self, data, gtitle)
{
## usually some code here to produce ggplots
pl = lapply(1:2, function(xx) {
ggplot(data) +
geom_point(aes(x=x*xx,y=y)) +
ggtitle(gtitle)
})
## add mzQC metric for count of identified clusters
template_proteinCount = rmzqc::getQualityMetricTemplate("MS:1002406")
mzqc = lapply(1:3, function(id){
out = template_proteinCount$copy();
out$value = id;
return(out) })
names(mzqc) = paste0("file", 1:3);
return(list(plots = pl, mzQC = mzqc))
},
qcCat="LC",
qcName="MS/MS Peak shape",
orderNr = 30)
## test some output
a$setData(dd, "my title")
a$plots ## the raw plots
a$getPlots(TRUE) ## same as above
a$getPlots(FALSE) ## plots without title
a$getTitles() ## get the titles of the all plots
a$helpText
a$qcName
a$mzQC
Run the code above in your browser using DataLab