curveFDP/0000755000723300071640000000000011312462536012461 5ustar brenardMultBildcurveFDP/DESCRIPTION0000744000723300071640000000071011312462536014166 0ustar brenardMultBildPackage: curveFDP Depends: mixtools Type: Package Title: curveFDP implementation for the estimation of confidence levels of peptide identification Version: 2.0 Date: 2009-12-12 Author: Bernhard Renard Maintainer: Bernhard Renard Description: curveFDP implementation for the estimation of confidence levels of peptide identification License: LGPL v2.0 or any later version Packaged: Thu Dec 17 18:07:42 2009; brenard curveFDP/R/0000755000723300071640000000000011312462536012662 5ustar brenardMultBildcurveFDP/R/testModel.r0000744000723300071640000000317711312451300015001 0ustar brenardMultBildtestModel<-function(scores,out) { ###chisq test #compute empirical distribution #do binning binning<-seq(range(scores)[1],range(scores)[2],(range(scores)[2]-range(scores)[1])/(length(scores)/5)) binning[length(binning)]<-max(scores) empDistr<-hist(scores,binning,plot=FALSE)$counts empDistr2<-c(empDistr[c(2:length(empDistr))],0) empDistr3<-c(0,empDistr[c(1:(length(empDistr)-1))]) empDistr4<-c(empDistr[c(3:length(empDistr))],0,0) empDistr5<-c(0,0,empDistr[c(1:(length(empDistr)-2))]) empDistr<-(empDistr+empDistr2+empDistr3+empDistr4+empDistr5)/5 theoDistr<-rep(0,length(empDistr)) if(length(out$mu)==2) { for(i in 1:length(theoDistr)) {theoDistr[i]<-out$lambda[1]*(pnorm(binning[i+1],out$mu[1],out$sigma[1])-pnorm(binning[i],out$mu[1],out$sigma[1]))+out$lambda[2]*(pnorm(binning[i+1],out$mu[2],out$sigma[2])-pnorm(binning[i],out$mu[2],out$sigma[2])) } }else{ for(i in 1:length(theoDistr)) {theoDistr[i]<-out$lambda[1]*(pnorm(binning[i+1],out$mu[1],out$sigma[1])-pnorm(binning[i],out$mu[1],out$sigma[1]))+out$lambda[2]*(pnorm(binning[i+1],out$mu[2],out$sigma[2])-pnorm(binning[i],out$mu[2],out$sigma[2]))+out$lambda[3]*(pnorm(binning[i+1],out$mu[3],out$sigma[3])-pnorm(binning[i],out$mu[3],out$sigma[3])) } } theoDistr<-theoDistr/sum(theoDistr)*length(scores) j=1 while(j1) { scoreboot<-sample(1:length(scores),length(scores),replace=TRUE) scoresNew<-scores[scoreboot] } else { scoresNew<-scores } out2<-normalmixEM(as.numeric(scoresNew), k=2) # find mixture of 2 normals outorder2<-order(out2$mu,decreasing=TRUE) # order the means to identify the second largest mean -mu- among the 3 mean values out3<-normalmixEM(as.numeric(scoresNew), k=3) # find mixture of 3 normals outorder3<-order(out3$mu,decreasing=TRUE) # order the means to identify the second largest mean -mu- among the 3 mean values if(out2$mu[outorder2[1]]=FDPcutoff)# identify how many scores are above cutoff pvalues[b]<-testModel(scoresNew,out) } FDPresults<-list(FDPcutoff,aboveFDP, pvalues, out, modelsize) names(FDPresults)=list("FDPcutoff","aboveFDP","pvalue", "out","modelsize") return(FDPresults) } curveFDP/man/0000755000723300071640000000000011312462536013234 5ustar brenardMultBildcurveFDP/man/testModel.rd0000744000723300071640000000177411312454366015537 0ustar brenardMultBild\name{testModel} \alias{testModel} %- Also NEED an '\alias' for EACH other topic documented here. \title{Testing whether a mixture model from curveFDP approximately fits the score distribution} \description{ after binning and mild smoothing a chi-square test is used to test whether a mixture model approximately fits the socre distribution } \usage{ testModel(scores, out)} %- maybe also 'usage' for other objects documented here. \arguments{ \item{scores}{scores corresponds to the results of the scoring of sequences to spectra (vector), for each spectrum only the best score, higher scores are better} \item{out}{mixture model as indicated by curveFDP} } \details{ after binning and mild smoothing a chi-square test is used to test whether a mixture model approximately fits the socre distribution } \value{ \item{p}{pvalue of the Chi square test} } %\references{ ~put references to the literature/web site here ~ } \author{Bernhard Renard \email{bernhard.renard@iwr.uni-heidleberg.de}} \examples{} \keyword{} curveFDP/man/curveFDP.rd0000744000723300071640000000455411312454365015253 0ustar brenardMultBild\name{curveFDP} \alias{curveFDP} %- Also NEED an '\alias' for EACH other topic documented here. \title{Fitting of a two- or three component mixture model to obtain False Discovery Proportion} \description{ function to estimate global fdr by curve-fitting a gaussian mixture model (gmm) of two or three distributions, one, to the left, for spectra of evident very low quality (if necessary), one, in the center, for spectra with random hits to sequences one, to the right, with non-random hits to sequences the three distributions may overlap, the gmm is used to find the best seperation assumption is that quantile of the random-hit distribution can be used to estimate how likely a score is to stem from that distribution and thus to be random. } \usage{ curveFDP(scores, FDPperc=5, bootstrap=1)} %- maybe also 'usage' for other objects documented here. \arguments{ \item{scores}{scores corresponds to the results of the scoring of sequences to spectra (vector), for each spectrum only the best score, higher scores are better} \item{FDPperc}{FDPperc is the desired FDP cutoff in percent (so 5 for 0.05 likelihood of having a value that extreme or higher by random)} \item{bootstrap}{The number of times the FDP computation should be repeated with bootstrap resampling of datasets of the same size} } \details{ function to estimate global fdr by curve-fitting a gaussian mixture model (gmm) of two or three distributions, one, to the left, for spectra of evident very low quality (if necessary), one, in the center, for spectra with random hits to sequences one, to the right, with non-random hits to sequences the three distributions may overlap, the gmm is used to find the best seperation assumption is that quantile of the random-hit distribution can be used to estimate how likely a score is to stem from that distribution and thus to be random. } \value{ \item{FDPcutoff}{the score atrting at which there is a likelihood of FDPperc or less that a hit is random} \item{aboveFDR}{number of scores above the FDPcutoff} \item{pvalues}{pvalues from the chi square test for appropriateness of the mixture model} \item{out}{mixture model as identified by mixtools package} \item{modelsize}{number of components in the mixture model} } %\references{ ~put references to the literature/web site here ~ } \author{Bernhard Renard \email{bernhard.renard@iwr.uni-heidleberg.de}} \examples{} \keyword{}