Dear Bioc team, The isobar package doesn't build. Attached is a patch that fixes the build errors and some namespace related warnings. There are still many notes when checking, though.
Hope someone is happy to apply the patch. Best wishes, Laurent
Index: DESCRIPTION =================================================================== --- DESCRIPTION (revision 122074) +++ DESCRIPTION (working copy) @@ -5,7 +5,7 @@ proteomics data labeled with isobaric tags, such as iTRAQ and TMT. Features modules for integrating and validating PTM-centric datasets (isobar-PTM). More information on http://www.ms-isobar.org. -Version: 1.19.0 +Version: 1.19.1 Author: Florian P Breitwieser <florian...@gmail.com> and Jacques Colinge <jacques.coli...@inserm.fr>, with contributions from Alexey Stukalov <stuka...@biochem.mpg.de>, @@ -13,8 +13,8 @@ Maintainer: Florian P Breitwieser <florian...@gmail.com> biocViews: Proteomics, MassSpectrometry, Bioinformatics, MultipleComparisons, QualityControl Depends: R (>= 2.10.0), Biobase, stats, methods -Imports: distr, plyr -Suggests: MSnbase, OrgMassSpecR, XML, biomaRt, ggplot2, RJSONIO, Hmisc, gplots, RColorBrewer, gridExtra, limma, boot, distr, DBI, MASS +Imports: distr, plyr, biomaRt, ggplot2 +Suggests: MSnbase, OrgMassSpecR, XML, RJSONIO, Hmisc, gplots, RColorBrewer, gridExtra, limma, boot, DBI, MASS LazyLoad: yes License: LGPL-2 URL: https://github.com/fbreitwieser/isobar Index: NAMESPACE =================================================================== --- NAMESPACE (revision 122074) +++ NAMESPACE (working copy) @@ -1,13 +1,30 @@ -# IMPORT import("methods") -importClassesFrom(Biobase, AnnotatedDataFrame, AssayData, eSet, - Versioned, VersionedBiobase, Versions) -import("distr") +importFrom("grDevices", "boxplot.stats", "dev.off", "pdf", "png") +importFrom("graphics", "abline", "axTicks", "axis", "hist", "legend", + "lines", "pairs", "par", "points", "rect", "strwidth", + "text") +importFrom("stats", "IQR", "confint", "dcauchy", "dnorm", "dt", + "hclust", "integrate", "lm", "mad", "median", "nlminb", + "p.adjust", "p.adjust.methods", "pchisq", "pnorm", "pt", + "qnorm", "qt", "quantile", "reshape", "rt", "setNames", + "summary.lm", "t.test", "var") +importFrom("utils", "Sweave", "URLdecode", "URLencode", + "capture.output", "combn", "compareVersion", + "download.file", "head", "packageDescription", "read.delim", + "read.table", "setTxtProgressBar", "tail", "txtProgressBar", + "write.table", "zip") + +importFrom("biomaRt", useMart, getBM) +importFrom("distr", Norm, df, location, "df<-", "location<-", "scale", + "scale<-") +import("Biobase") import("plyr") +import("ggplot2") +importFrom("graphics", "plot") +importFrom("stats", "sd") -# EXPORT -exportClasses(IBSpectra,ProteinGroup) +exportClasses(IBSpectra, ProteinGroup) exportMethods("as.data.frame") export(IBSpectraTypes) Index: NEWS =================================================================== --- NEWS (revision 122074) +++ NEWS (working copy) @@ -1,3 +1,8 @@ +CHANGES IN VERSION 1.19.1 +------------------------- + - Fix error in subsetIBSpectra and exclude and namespace imports + (Laurent Gatto <2016-10-07 Fri>) + CHANGES IN VERSION 1.17.1 ------------------------- - Fixed critical bug in isotope impurity correction method. Index: R/IBSpectra-class.R =================================================================== --- R/IBSpectra-class.R (revision 122074) +++ R/IBSpectra-class.R (working copy) @@ -737,8 +737,9 @@ # specificity=c(REPORTERSPECIFIC,GROUPSPECIFIC,UNSPECIFIC)) # remove spectra from assayData - for (aden in assayDataElementNames(x)) { - assayDataElement(x,aden) <- assayDataElement(x,aden)[sel.spectra,] + for (aden in assayDataElementNames(x)) { + xel <- assayDataElement(x,aden)[sel.spectra,] + x <- assayDataElementReplace(x, aden, xel, FALSE) } # remove from featureData @@ -757,7 +758,6 @@ subsetIBSpectra <- function(x, protein=NULL, peptide=NULL, direction="exclude", specificity=c(REPORTERSPECIFIC,GROUPSPECIFIC,UNSPECIFIC),...) { - if ((is.null(protein) && is.null(peptide)) || (!is.null(protein) && !is.null(peptide))) stop("define either protein or peptide to include or exclude") @@ -772,7 +772,8 @@ stop("direction must be either 'exclude' or 'include'.")) for (aden in assayDataElementNames(x)) { - assayDataElement(x,aden) <- assayDataElement(x,aden)[sel.spectra,] + xel <- assayDataElement(x, aden)[sel.spectra, ] + x <- assayDataElementReplace(x, aden, xel, validate = FALSE) } pg.df <- as.data.frame(proteinGroup(x)) Index: R/IBSpectra-plots.R =================================================================== --- R/IBSpectra-plots.R (revision 122074) +++ R/IBSpectra-plots.R (working copy) @@ -29,7 +29,6 @@ melt.masses$mass.difference <- melt.masses$observed.moz - rep(reporterTagMasses(x),each=nrow(masses)) if (plot) { - require(ggplot2) melt.masses$reporter <- factor(melt.masses$reporter, levels=reporterTagNames(x), @@ -72,7 +71,6 @@ setMethod("reporterIntensityPlot", signature=c(x="IBSpectra"),function(x) { - require(ggplot2) intensities <- reporterIntensities(x) intensities.nn <- reporterData(x,element="ions_not_normalized") # null if not normalized Index: R/MSnSet-methods.R =================================================================== --- R/MSnSet-methods.R (revision 122074) +++ R/MSnSet-methods.R (working copy) @@ -37,7 +37,7 @@ }) setAs("IBSpectra","MSnSet",function(from) { - library(MSnbase) + requireNamespace("MSnbase") ## based on quantify.MSnExp from MSnbase elems <- assayDataElementNames(from) Index: R/ProteinGroup-class.R =================================================================== --- R/ProteinGroup-class.R (revision 122074) +++ R/ProteinGroup-class.R (working copy) @@ -419,7 +419,6 @@ protein.info <- data.frame(accession=c(),name=c(),protein_name=c(), gene_name=c(),organism=c()) if (database == "Uniprot") { - #require(biomaRt) tryCatch({ mart <- biomaRt::useMart("uniprot_mart",dataset="UNIPROT", host="www.ebi.ac.uk",path="/uniprot/biomart/martservice") @@ -499,7 +498,7 @@ } getProteinInfoFromEntrez <- function(x,splice.by=200) { - require(XML) + requireNamespace("XML") eutils.url <- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=" if (is.character(x)) @@ -568,7 +567,7 @@ getProteinInfoFromBioDb <- function(x,...,con=NULL) { - library(DBI) + requireNamespace("DBI") if (is.null(con)) { con <- dbConnect(...) do.disconnect <- TRUE @@ -656,7 +655,7 @@ nextprot.url="http://www.nextprot.org/rest/entry/NX_XXX/ptm?format=json", url.wildcard="XXX") { protein.acs <- unique(protein.group@isoformToGeneProduct$proteinac.wo.splicevariant) - require(RJSONIO) + requireNamespace("RJSONIO") pb <- txtProgressBar(max=length(protein.acs),style=3) nextprot.ptmInfo <- @@ -1759,8 +1758,8 @@ if (is.na(seq) || length(seq)==0 || nchar(seq) == 0) return(0) seq <- gsub("[ ,]","",seq) - require(OrgMassSpecR) - pep <- Digest(seq,missed=nmc,custom=custom,...) + requireNamespace("OrgMassSpecR") + pep <- OrgMassSpecR::Digest(seq,missed=nmc,custom=custom,...) min.length.ok <- nchar(pep[,"peptide"]) >= min.length mass.ok <- pep[,"mz1"] >= min.mass & pep[,"mz3"] <= max.mass pep[min.length.ok & mass.ok,] @@ -1767,7 +1766,7 @@ } .calculate.mw <- function(protein.group,protein.g,combine.f=mean) { - require(OrgMassSpecR) + requireNamespace("OrgMassSpecR") sequences <- proteinInfo(protein.group)$sequence ip <- indistinguishableProteins(protein.group) names(sequences) <- proteinInfo(protein.group)$accession Index: R/distr-methods.R =================================================================== --- R/distr-methods.R (revision 122074) +++ R/distr-methods.R (working copy) @@ -10,7 +10,6 @@ return(rep(NA,seq_along(mu_Y))) } - require(distr) if (!is(X,"Distribution")) stop("X has to be of class Distribution (is ",class(X),")") if (length(mu_Y) != length(sd_Y)) @@ -44,10 +43,8 @@ p.values } -calcProbXGreaterThanY <- function(X, Y, rel.tol=.Machine$double.eps^0.25, subdivisions=100L) -{ +calcProbXGreaterThanY <- function(X, Y, rel.tol=.Machine$double.eps^0.25, subdivisions=100L) { # numerically calculates P(X>=Y) - require(distr) if (!is(X,"Distribution")) stop("X has to be of class Distribution") if (!is(Y,"Distribution")) stop("Y has to be of class Distribution") # return ( distr::p(Y-X)(0) ) # the easiest way, but it does not seem to give accurate results for Norm+Tlsd @@ -60,7 +57,6 @@ .calcProbXGreaterThanY.orig <- function(X,Y,min.q=10^-6, subdivisions=100L) { # numerically calculates P(X>=Y) - require(distr) if (!is(X,"Distribution")) stop("X has to be of class Distribution") if (!is(Y,"Distribution")) stop("Y has to be of class Distribution") @@ -96,7 +92,6 @@ alternative <- match.arg(alternative) # cumulative Y distribution is Gaussian with explicitly calculated parameters - require(distr) inv_vars <- sd_Ys^(-2) var_Cum <- 1 / sum( inv_vars ) mu_cum_Y <- sum( as.numeric( mu_Ys %*% inv_vars ) * var_Cum ) @@ -137,9 +132,6 @@ } twodistr.plot <- function(X,Y,n.steps=1000,min.q=10^-3) { - require(distr) - require(ggplot2) - steps.seq <- seq(from=0,to=1,length.out=n.steps) steps <- sort(unique(c(q(X)(steps.seq),q(Y)(steps.seq)))) ggplot(rbind(data.frame(x=steps,Distribution=paste0("X ~ ",distrprint(X)),density=d(X)(steps)), Index: R/isobar-import.R =================================================================== --- R/isobar-import.R (revision 122074) +++ R/isobar-import.R (working copy) @@ -529,7 +529,7 @@ ### READ MzID read.mzid <- function(filename) { - library(XML) + requireNamespace("XML") doc <- xmlInternalTreeParse(filename) ns <- c(x=xmlNamespace(xmlRoot(doc))[[1]]) Index: R/metareport-utils.R =================================================================== --- R/metareport-utils.R (revision 122074) +++ R/metareport-utils.R (working copy) @@ -1,7 +1,7 @@ create.meta.reports <- function(properties.file="meta-properties.R", global.properties.file=system.file("report","meta-properties.R",package="isobar"), args=NULL,include.not.localized=FALSE,...) { - require(ggplot2) + requireNamespace(ggplot2) if (!exists("properties.env")) { properties.env <- load.properties(properties.file,global.properties.file, args=args,...) @@ -251,7 +251,7 @@ } .plot.heatmaps.gd <- function(ratio.matrix,variance.matrix,name) { - require(gplots) + requireNamespace(gplots) breaks <- seq(from=-max(abs(ratio.matrix)),to=max(abs(ratio.matrix)),length.out=51) pdf(sprintf("heatmap_%s.pdf",name),width=15,height=30,title=name) min.max <- quantile(ratio.matrix,probs=c(0.0005,0.9995)) @@ -272,7 +272,7 @@ } dev.off() - library(boot) + requireNamespace("boot") cols <- colnames(ratio.matrix) correlation.matrix <- sapply(cols ,function(i) sapply(cols,function(j) boot::corr(ratio.matrix[,c(i,j)], @@ -287,7 +287,7 @@ .plot.heatmaps <- function(ratio.matrix,normalized.ratio.matrix,variance.matrix,name) { - require(gplots) + requireNamespace(gplots) breaks <- seq(from=-max(abs(ratio.matrix)),to=max(abs(ratio.matrix)),length.out=51) pdf(sprintf("heatmap_%s.pdf",name),width=15,height=30,title=name) heatmap.2(ratio.matrix,Colv=NA,col=greenred(50),margins=c(5,25),main=paste(name), @@ -320,7 +320,7 @@ } dev.off() - library(boot) + requireNamespace("boot") cols <- colnames(ratio.matrix) correlation.matrix <- sapply(cols ,function(i) sapply(cols,function(j) boot::corr(ratio.matrix[,c(i,j)], w=apply(1/variance.matrix,1,median)))) @@ -342,7 +342,7 @@ } .plot.pairs <- function(ratio.matrix,variance.matrix,name) { - require(RColorBrewer) + requireNamespace(RColorBrewer) weights <- apply(1/variance.matrix,1,median) weights <- weights/sum(weights) @@ -359,7 +359,7 @@ } .panel.cor <- function(x, y, digits=2, prefix="", cex.cor, weights, ...) { - library(boot) + requireNamespace("boot") usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(boot::corr(matrix(c(x,y),ncol=2),w=weights)) Index: R/ptm-methods.R =================================================================== --- R/ptm-methods.R (revision 122074) +++ R/ptm-methods.R (working copy) @@ -322,7 +322,7 @@ readPhosphoRSOutput <- function(phosphoRS.outfile,simplify=FALSE,pepmodif.sep="##.##", besthit.only=TRUE) { - require(XML) + requireNamespace("XML") doc <- xmlTreeParse(phosphoRS.outfile,useInternalNodes=TRUE) spectra <- xmlRoot(doc)[["Spectra"]] res <- xmlApply(spectra,function(spectrum) { @@ -458,7 +458,7 @@ .proteinPtmInfo <- function(isoform.ac,protein.group,ptm.info,modif,modification.name=NULL,simplify=TRUE) { - require(OrgMassSpecR) + requireNamespace("OrgMassSpecR") if (length(proteinInfo(protein.group)) == 0) stop("no protein info attached to protein.group: see ?getProteinInfoFromUniprot on how to get it.") Index: R/ratio-methods.R =================================================================== --- R/ratio-methods.R (revision 122074) +++ R/ratio-methods.R (working copy) @@ -550,7 +550,7 @@ sel | log.ratio < qs[1]-outliers.coef*iqr | log.ratio > qs[2]+outliers.coef*iqr } else if (method == "wtd.iqr") { # weighted implementation of iqr method with weighted quantiles - require(Hmisc) + requireNamespace("Hmisc") qs <- wtd.quantile(log.ratio,weights,c(.25,.75),na.rm=TRUE) iqr <- qs[2] - qs[1] sel | log.ratio < qs[1]-outliers.coef*iqr | log.ratio > qs[3]+outliers.coef*iqr Index: R/sharedpep-methods.R =================================================================== --- R/sharedpep-methods.R (revision 122074) +++ R/sharedpep-methods.R (working copy) @@ -114,7 +114,6 @@ xx$n.spectra <- factor(as.character(xx$n.spectra),levels=c("1","2 - 5","6 - 10","> 10")) if (plot) { - require(ggplot2) breaks <- c(0.1,0.25,0.5,1,2,3,4,5,10,20,30,40,50) breaks <- breaks[log10(breaks) %inrange% range(xx$ratio)] Index: man/distr-methods.Rd =================================================================== --- man/distr-methods.Rd (revision 122074) +++ man/distr-methods.Rd (working copy) @@ -4,6 +4,12 @@ \alias{calcProbXGreaterThanY} \alias{calcProbXDiffNormals} \alias{calcCumulativeProbXGreaterThanY} + +\alias{UnivariateDistribution-class} +\alias{AbscontDistribution-class} +\alias{Parameter-class} +\alias{Distribution-class} + \title{Functions for distribution calculations } \description{ @@ -36,6 +42,7 @@ \author{ Florian P. Breitwieser } \examples{ + library(distr) calcProbXGreaterThanY(Norm(0,.25),Norm(1,.25)) }
_______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel