Running ‘initTestSession.R’ [18s/21s]
  Running ‘runAllTest.R’
  Running ‘testExpressionAnalysis.R’ [22s/24s]
  Running ‘testGraphics.R’ [26s/29s]
  Running ‘testIdentificationAnalysis.R’ [18s/21s]
  Running ‘testParser.R’ [18s/22s]
  Running ‘testSafeQuantAnalysis.R’ [27s/30s]
  Running ‘testTMT.R’ [18s/20s]
  Running ‘testUserOptions.R’ [18s/20s]
Running the tests in ‘tests/testExpressionAnalysis.R’ failed.
Complete output:
  > # TODO: Add comment
  > # 
  > # Author: ahrnee-adm
  > ###############################################################################
  > 
  > ### INIT
  > if(!grepl("SafeQuant\\.Rcheck",getwd())){
  + 	setwd(dirname(sys.frame(1)$ofile))
  + }
  > source("initTestSession.R")
  
  Attaching package: 'gplots'
  
  The following object is masked from 'package:stats':
  
      lowess
  
  
  Attaching package: 'seqinr'
  
  The following object is masked from 'package:limma':
  
      zscore
  
  Loading required package: survival
  Package epiR 0.9-96 is loaded
  Type help(epi.about) for summary information
  
  
  corrplot 0.84 loaded
  Loading required package: BiocGenerics
  Loading required package: parallel
  
  Attaching package: 'BiocGenerics'
  
  The following objects are masked from 'package:parallel':
  
      clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
      clusterExport, clusterMap, parApply, parCapply, parLapply,
      parLapplyLB, parRapply, parSapply, parSapplyLB
  
  The following object is masked from 'package:limma':
  
      plotMA
  
  The following objects are masked from 'package:stats':
  
      IQR, mad, sd, var, xtabs
  
  The following objects are masked from 'package:base':
  
      Filter, Find, Map, Position, Reduce, anyDuplicated, append,
      as.data.frame, basename, cbind, colMeans, colSums, colnames,
      dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
      intersect, is.unsorted, lapply, mapply, match, mget, order, paste,
      pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums,
      rownames, sapply, setdiff, sort, table, tapply, union, unique,
      unsplit, which, which.max, which.min
  
  Welcome to Bioconductor
  
      Vignettes contain introductory material; view with
      'browseVignettes()'. To cite Bioconductor, see
      'citation("Biobase")', and for packages 'citation("pkgname")'.
  
  > ### INIT END
  > 
  > 
  > ### TEST FUNCTIONS
  > 
  > testCreateExpressionDataset <- function(){
  + 	
  + 	cat("--- testCreateExpressionDataset: --- \n")
  + 	
  + 	stopifnot(all.equal(pData(eset),expDesign))
  + 	stopifnot(all.equal(sampleNames(eset),colnames(m)))
  + 	stopifnot(all.equal(nrow(exprs(eset)),nrow(m)))
  + 	cat("--- testCreateExpressionDataset: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > 
  > testGetAllEBayes <- function(){
  + 	
  + 	
  + 	cat("--- testGetAllEBayes: --- \n")
  + 	p <- getAllEBayes(eset)
  + 	stopifnot( mean(p[,"A"]) > mean(p[,"B"]) )
  + 	p <- getAllEBayes(eset)
  + 	stopifnot( mean(p[,"A"]) > mean(p[,"B"]) )
  + 	pAdj <- getAllEBayes(eset, adjust=T)
  + 	
  + 	stopifnot( mean(pAdj[,"A"]) > mean(p[,"A"]) )
  + 	
  + 	### paired desgn
  + 	esetNonPaired <- esetPaired
  + 	pData(esetNonPaired) <- pData(esetPaired)[,1:2]
  + 	
  + 	pValPaired <- getAllEBayes(esetPaired,adjust=F,method=c("all"))
  + 	pValPairedPairwise <- getAllEBayes(esetPaired,adjust=F,method=c("pairwise"))
  + 	
  + 	pValNonPaired <- getAllEBayes(esetNonPaired,adjust=F,method=c("all"))
  + 	pValNonPairedPairwise <- getAllEBayes(esetNonPaired,adjust=F,method=c("pairwise"))
  + 	stopifnot(all(apply(pValPaired,2,sum) < apply(pValNonPaired,2,sum)))
  + 	stopifnot(all(apply(pValPairedPairwise,2,sum) < apply(pValNonPairedPairwise,2,sum)))
  + 	
  + 	# adjustment filter
  + 	
  + 	adjustfilter <- data.frame(rep(T,nrow(eset)),rep(T,nrow(eset)) )
  + 	adjustfilter[1,1] <- F
  + 	adjustfilter[2,2] <- F
  + 		
  + 	pTmp <- getAllEBayes(eset,adjust=T, adjustFilter=adjustfilter)
  + 	stopifnot(p[1,1] == pTmp[1,1])
  + 	stopifnot(p[2,2] == pTmp[2,2])
  + 	stopifnot(is.na(pTmp[3,2]))
  + 	cat("--- testGetAllEBayes: PASS ALL TEST --- \n")
  + 
  + 	# Question: limma multiple groups comparison produces different pvalue comparing with two group comparsion	
  + 	# https://support.bioconductor.org/p/44216/	
  + 	# https://support.bioconductor.org/p/60556/
  + }
  > 
  > testGetRatios <- function(){
  + 	
  + 	cat("--- testGetRatios: --- \n")
  + 	
  + 	r <- getRatios(eset)
  + 	
  + 	exprs(eset)[1,c(5:6,1:2)]
  + 	#  C_rep_1  C_rep_2  A_rep_1  A_rep_2 
  + 	# 9.963852 9.966003 9.965568 9.967214 
  + 	
  + 	## NOTE: C is control
  + 	stopifnot(all.equal(r[1,1],median(log2(exprs(eset))[1,1:2]) - median(log2(exprs(eset))[1,5:6]) ) )
  + 	
  + 	stopifnot(mean(r[,"A"]) < mean(r[,"B"]))
  + 	stopifnot(all.equal(r,getRatios(eset,method="mean")))
  + 	r <- getRatios(eset)
  + 	stopifnot(all.equal(mean(r[,"B"]),mean(r[,"B"])))
  + 
  + 	stopifnot(all(round(apply(getRatios(esetPaired, log2=F),2,mean),1) == c(1.5,1.2)))
  + 	stopifnot(ncol(r)  == 2)
  + 	
  + 	rPaired <- getRatios(esetPaired, method="paired")
  + 	stopifnot(ncol(rPaired)  == 4)
  + 	stopifnot(all(	log2(exprs(esetPaired)[,1]) - log2(exprs(esetPaired)[,5]) == rPaired[,1] ))
  + 	stopifnot(all(	log2(exprs(esetPaired)[,4]) - log2(exprs(esetPaired)[,6]) == rPaired[,4] ))
  + 	stopifnot(all(	exprs(esetPaired)[,4] / exprs(esetPaired)[,6] == getRatios(esetPaired, method="paired", log2=F)[,4] ))
  + 	# should fail	
  + 	stopifnot((inherits(try(	getRatios(eset, method="paired"), silent = TRUE), "try-error")))
  + 
  + 	
  + 	stopifnot(all(round(getRatios(esetPaired)[,1],2) ==  round(apply(rPaired[,1:2],1,median),2)))
  + 	
  + 	
  + 	cat("--- testGetRatios: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetAllCV <- function(){
  + 	
  + 	cat("--- testGetAllCV: --- \n")
  + 	
  + 	cv <- getAllCV(eset)
  + 	
  + 	stopifnot(all.equal(cv[1,"A"] , (sd(exprs(eset)[1,unlist(pData(eset)$condition == "A")]) / mean(exprs(eset)[1,unlist(pData(eset)$condition == "A")]))))
  + 	stopifnot(all.equal(cv[200,"C"] , sd(exprs(eset)[200,unlist(pData(eset)$condition == "C")]) / mean(exprs(eset)[200,unlist(pData(eset)$condition == "C")])))
  + 	
  + 	cvPaired <-  getAllCV(esetPaired)
  + 	stopifnot(all(is.na(cvPaired[,1])))
  + 	stopifnot(all(!is.na(cvPaired[,2])))
  + 	stopifnot(cvPaired[3,"A"] ==  (sd(exprs(esetPaired)[3,1:2] / exprs(esetPaired)[3,5:6]) /	mean(exprs(esetPaired)[3,1:2] / exprs(esetPaired)[3,5:6])))
  + 	
  + 	cat("--- testGetAllCV: PASS ALL TEST --- \n")
  + }
  > 
  > testGlobalNormalize <- function(){
  + 	
  + 	cat("--- testGlobalNormalize: --- \n")
  + 	
  + 	globalNormFactors <- getGlobalNormFactors(eset,method="sum")
  + 	### add normalization factors to ExpressionSet
  + 	pData(eset) <- cbind(pData(eset),globalNormFactors)
  + 	esetNorm <- globalNormalize(eset,globalNormFactors)
  + 	
  + 	stopifnot(all.equal(as.vector(unlist(apply(exprs(esetNorm),2,sum))),as.vector(rev(unlist(apply(exprs(esetNorm),2,sum))))))
  + 	
  + 	stopifnot(pData(esetNorm)$normFactor[1] == 1)
  + 	stopifnot(pData(esetNorm)$normFactor[2] != 1)
  + 	
  + 	cat("--- testGlobalNormalize: PASS ALL TEST --- \n")
  + 	
  + 	# Should generate error and stop	
  + #	fData(eset)$isNormAnchor <- rep(F,nrow(eset))
  + #	esetNorm <- normalizeIntensities(eset)
  + 	
  + }
  > 
  > testGetSignalPerCondition <- function(){
  + 	
  + 	cat("--- testGetSignalPerCondition: --- \n")
  + 	stopifnot(sum(getSignalPerCondition(eset,method="min")[,"A"] <= getSignalPerCondition(eset,method="max")[,"A"]) == nrow(eset))
  + 	stopifnot(sum(getSignalPerCondition(eset,method="min")[,"C"] <= getSignalPerCondition(eset,method="median")[,"C"]) == nrow(eset))
  + 	stopifnot(getSignalPerCondition(eset,method="sd")[1,2] == sd(exprs(eset)[1,3:4]))
  + 	cat("--- testGetSignalPerCondition: PASS ALL TEST --- \n")
  + }
  > 
  > testBaselineIntensity <- function(){
  + 	
  + 	cat("--- testBaselineIntensity: --- \n")
  + 	
  + 	allInt <- as.vector(unlist(exprs(eset)))
  + 	bl <- round(getBaselineIntensity(allInt,promille=5),2)
  + 	#hist(allInt)
  + 	#abline(v=bl,lwd=2)
  + 	stopifnot(all.equal(bl[[1]] , 997.82) )
  + 	
  + 	
  + 	set.seed(1234)
  + 	suppressWarnings(allInt2 <- log10(rnorm(1000,1,1)))
  + 	bl2 <- round(getBaselineIntensity(allInt2,promille=5),2)
  + 	stopifnot(all.equal(-1.95,bl2[[1]]))
  + 	#hist(allInt2)
  + 	#abline(v=bl2,lwd=2)
  + 	
  + 	cat("--- testBaselineIntensity: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testRollUp <- function(){
  + 	
  + 	cat(" --- testRollUp --- \n")
  + 	
  + 	rollUpEset1 <- rollUp(eset,featureDataColumnName= c("proteinName"), method=c("sum"))
  + 	stopifnot( length( unique( fData(eset)$proteinName ) ) == nrow(rollUpEset1)) 
  + 	
  + 	rollUpEset2 <- rollUp(eset ,featureDataColumnName= c("ptm"), method=c("sum"))
  + 	stopifnot( length( unique( fData(eset)$ptm ) ) == nrow(rollUpEset2)) 
  + 	
  + 	rollUpEset3 <- rollUp(eset[!fData(eset)$isFiltered,] ,featureDataColumnName= c("ptm"), method=c("mean"))
  + 	stopifnot( length( unique( fData(eset)$ptm ) ) == nrow(rollUpEset3)) 
  + 	
  + 	#print(exprs(rollUpEset2))
  + 	
  + 	stopifnot(all.equal(sum(exprs(rollUpEset2)),sum(exprs(rollUpEset1)))) ### test sum
  + 	stopifnot(sum(exprs(rollUpEset1)) != sum(exprs(rollUpEset3))) ### test mean
  + 	
  + 	rollUpEset4 <- rollUp(eset[!fData(eset)$isFiltered,] ,featureDataColumnName= c("proteinName"), method=c("top3"))
  + 	stopifnot(sum(exprs(rollUpEset3)) != sum(exprs(rollUpEset4))  ) ### test top 3
  + 	
  + 	cat(" --- testRollUp: PASS ALL TEST  --- \n")
  + 	
  + #	progenesisFeatureCsvFile3 <- "/Users/ahrnee-adm/dev/R/workspace/SafeQuant/inst/testData/2014/peptides2.csv"
  + #	d <- parseProgenesisFeatureCsv(file=progenesisFeatureCsvFile3,expDesign=getExpDesignProgenesisCsv(progenesisFeatureCsvFile3))
  + #	system.time(e <- rollUp(d, method="sum", isProgressBar=T, featureDataColumnName= c("peptide")))
  + #	system.time(e <- rollUpDT(d, method="sum",  featureDataColumnName= c("peptide")))
  + #	
  + 	esetTmp <- parseProgenesisPeptideMeasurementCsv(progenesisPeptideMeasurementCsvFile1,expDesign= getExpDesignProgenesisCsv(progenesisPeptideMeasurementCsvFile1))
  + 	
  + 	fData(esetTmp)
  + 	
  + 	rollUpEsetProteinAllAccessions <- rollUp(esetTmp,featureDataColumnName= c("proteinName"), method=c("sum"))
  + 	stopifnot(fData(rollUpEsetProteinAllAccessions)$allAccessionsTMP[68] == "sp|E9PAV3|NACAM_HUMAN;sp|Q9BZK3|NACP1_HUMAN")
  + 
  + }
  > 
  > testTopX <- function(){
  + 	
  + 	cat(" --- testTopX --- \n")
  + 	
  + 	entryData1  <- data.frame(t(matrix(c(1,1,1,3,3,3,2,2,2,5,5,5),ncol=4)))
  + 	rownames(entryData1) <- paste("peptide",1:nrow(entryData1),sep="_")
  + 	#           X1 X2 X3
  + 	# peptide_1  1  1  1
  + 	# peptide_2  3  3  3
  + 	# peptide_3  2  2  2
  + 	# peptide_4  5  5  5
  + 	stopifnot(all.equal(rep(10/3,3) , as.vector(unlist(getTopX(entryData1))) ))
  + 	
  + 	entryData2 <- data.frame(t(matrix(c(1,1,1,3,3,3,2,2,2,5,5,NA),ncol=4)))
  + 	rownames(entryData2) <- paste("peptide",1:nrow(entryData2),sep="_")
  + 	
  + 	#           X1 X2 X3
  + 	# peptide_1  1  1  1
  + 	# peptide_2  3  3  3
  + 	# peptide_3  2  2  2
  + 	# peptide_4  5  5 NA
  + 	stopifnot(all.equal(c(4,4,3) ,  as.vector(unlist(getTopX(entryData2,topX=2)))))
  + 	
  + 	# 1 row
  + 	stopifnot(all.equal(rep(1,3),as.vector(unlist(getTopX(entryData1[1,])))))
  + 	
  + 	# 1 col
  + 	stopifnot(all.equal(getTopX(entryData1)[[1]],getTopX(entryData1[,1])))
  + 	
  + 	top1 <- apply(exprs(rollUp(eset[!fData(eset)$isFiltered,] ,featureDataColumnName= c("proteinName"), method=c("top1"))),1,sum)
  + 	top3 <- apply(exprs(rollUp(eset[!fData(eset)$isFiltered,] ,featureDataColumnName= c("proteinName"), method=c("top3"))),1,sum)
  + 	meanInt <- apply(exprs(rollUp(eset[!fData(eset)$isFiltered,] ,featureDataColumnName= c("proteinName"), method=c("mean"))),1,sum)
  + 	
  + 	stopifnot(sum(top1 >=  top3 ) == length(top3))
  + 	stopifnot(sum(top1) > sum(top3))
  + 	stopifnot(sum(top1) > sum(meanInt))
  + 	stopifnot(all.equal(sum(top3),sum(meanInt)))
  + 	
  + 	cat(" --- testTopX: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > testGetIBAQEset <- function(){
  + 	
  + 	cat(" --- testGetIBAQEset --- \n")
  + 	
  + 	# read protein fasta
  + 	proteinDB <- read.fasta(fastaFile,seqtype = "AA",as.string = TRUE, set.attributes = FALSE)
  + 	
  + 	iBaqEset <- getIBAQEset(eset,proteinDB=proteinDB)
  + 	stopifnot(round(exprs(iBaqEset))[1,1] == 125)
  + 	stopifnot(round(exprs(iBaqEset))[2,2] == 38)
  + 	
  + 	cat(" --- testGetIBAQEset: PASS ALL TEST --- \n")
  + }
  > 
  > 
  > testGetLoocvFoldError <- function(){
  + 	
  + 	cat(" --- testGetLoocvFoldError --- \n")
  + 	#plotCalibrationCurve(fit)
  + 	stopifnot(  round(sum(getLoocvFoldError(absEstSimData))) == -8)
  + 	cat(" --- testGetLoocvFoldError: PASS ALL TEST --- \n")
  + }
  > 
  > testSqNormalize <- function(){
  + 	
  + 	cat(" --- testSqNormalize --- \n")
  + 	
  + 	stopifnot(nrow(sqNormalize(eset, method = "global")) == 900)
  + 	esetTmp <- parseProgenesisFeatureCsv(file=progenesisFeatureCsvFile1,expDesign=getExpDesignProgenesisCsv(progenesisFeatureCsvFile1))
  + 	stopifnot(nrow(sqNormalize(esetTmp, method = "rt")) == 496)
  + 	
  + 	cat(" --- testSqNormalize: PASS ALL TEST --- \n")
  + }
  > 	
  > 
  > testRtNormalize <- function(){
  + 	
  + 
  + 	cat(" --- testRTNormalize --- \n")
  + 	esetTmp <- parseProgenesisFeatureCsv(file=progenesisFeatureCsvFile1,expDesign=getExpDesignProgenesisCsv(progenesisFeatureCsvFile1))
  + 	rtNormFactors <- getRTNormFactors(esetTmp, minFeaturesPerBin=100)
  + 	stopifnot(nrow(rtNormalize(esetTmp,rtNormFactors)) == 97)
  + 	
  + 	# Stop if rtNormFactors doesn't cover all retention times.
  + 	#rtNormalize(esetTmp,rtNormFactors[1:2,])
  + 	
  + 	cat(" --- testRTNormalize: PASS ALL TEST --- \n")
  + }
  > 
  > testRemoveOutliers <- function(){
  + 	
  + 	cat(" --- testRemoveOutliers --- \n")
  + 	set.seed(1234)
  + 	stopifnot(sum(is.na(removeOutliers(c(-10,  rnorm(100), 10)))) == 2)
  + 	cat(" --- testRemoveOutliers: PASS ALL TEST --- \n")
  + }
  > 
  > testPerFeatureNormalization <- function(){
  + 	
  + 	cat(" --- testPerFeatureNormalization: --- \n")
  + 	
  + 	normFactors <- exprs(eset)[1:10,1:3]
  + 	colnames(normFactors) <- c("A","B","C")
  + 	rownames(normFactors) <- fData(eset)[1:10,]$proteinName
  + 	normFactors[is.finite(normFactors)] <- 1
  + 	eNorm <-  perFeatureNormalization(eset,normFactors)
  + 	
  + 	stopifnot(all.equal(exprs(eNorm)[1,1] , (exprs(eset)[1,1]-1)))
  + 	stopifnot(all.equal(exprs(eNorm)[1,2] , (exprs(eset)[1,2]-1)))
  + 	stopifnot(all.equal(exprs(eNorm)[13,2] , (exprs(eset)[13,2])))
  + 	
  + 	normFactors[,2] <- 200
  + 	eNorm <-  perFeatureNormalization(eset,normFactors)
  + 	stopifnot(all.equal(exprs(eNorm)[1,1] , (exprs(eset)[1,1]-1)))
  + 	stopifnot(all.equal(exprs(eNorm)[1,3] ,  (exprs(eset)[1,3]-200)))
  + 	stopifnot(all.equal(exprs(eNorm)[1,4] ,  (exprs(eset)[1,4]-200)))
  + 	stopifnot(all.equal(exprs(eNorm)[1,5] ,  (exprs(eset)[1,5]-1)))
  + 	
  + 	normFactors[,3] <- 0
  + 	eNorm <-  perFeatureNormalization(eset,normFactors)
  + 	stopifnot(all.equal(exprs(eNorm)[1,5] , exprs(eset)[1,5]))
  + 	stopifnot(all.equal(exprs(eNorm)[2,6] , exprs(eset)[2,6]))
  + 	
  + 	normFactors[3,] <- 1000 
  + 	eNorm <-  perFeatureNormalization(eset,normFactors)
  + 	stopifnot(all.equal(exprs(eNorm)[3,] , (exprs(eset)[3,]-1000)))
  + 	stopifnot(all.equal(exprs(eNorm)[20:50,] , exprs(eset)[20:50,]))
  + 	
  + 	# re-order normFactors columns
  + 	eNorm <-  perFeatureNormalization(eset,normFactors[,rev(colnames(normFactors))])
  + 	stopifnot(all.equal(exprs(eNorm)[3,] , (exprs(eset)[3,]-1000)))
  + 	stopifnot(all.equal(exprs(eNorm)[20:50,] , exprs(eset)[20:50,]))
  + 	
  + 	cat(" --- testPerFeatureNormalization: PASS ALL TEST --- \n")
  + 	
  + 	#coveredPeptideSel <- fData(eset)$proteinName %in% rownames(normFactors)
  + 	#exprs(eset)[coveredPeptideSel,]	<- exprs(eset)[coveredPeptideSel, ] - normFactors[as.character(fData(eset)[coveredPeptideSel,]$proteinName),pData(eset)$condition]
  + 	
  + }
  > 
  > 
  > testStandardise <- function(){
  + 	
  + 	cat(" --- testStandardise: --- \n")
  + 	
  + 	d <- data.frame(rnorm(10000,5,20), rnorm(10000,10,10))
  + 	dStd <- standardise(d[,1])
  + 	
  + 	stopifnot(round(mean(dStd)) == 0 )
  + 	stopifnot(round(sd(dStd)) == 1 )
  + 	
  + 	dStd <- standardise(d)
  + 	stopifnot(round(apply(dStd,2,mean)[1]) == 0)
  + 	stopifnot(round(apply(dStd,2,sd)[1]) == 1)
  + 
  + 	cat(" --- testStandardise: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetMaxIndex <-function(){
  + 	
  + 	cat(" --- testGetMaxIndex:  --- \n")
  + 	d <- data.frame(s=c(NA,NA,NA,NA,1,1:4),lab=sort(rep(c("A","B","C"),3)))
  + 	DT <- data.table(d)
  + 	setkey(DT,lab)
  + 	
  + 	
  + 	stopifnot(all.equal(c(1,5,9) , DT[, .I[getMaxIndex(s)], by=lab ]$V1  ))
  + 	cat(" --- testGetMaxIndex: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > testCreatePairedExpDesign <- function(){
  + 	
  + 	cat(" --- testCreatePairedExpDesign:  --- \n")
  + 	stopifnot(all( pData(createPairedExpDesign(eset))$subject == as.factor(rep(1:2,3))))
  + 	stopifnot((inherits(try(createPairedExpDesign(eset[,1:3]), silent = TRUE), "try-error")))
  + 	stopifnot((inherits(try(createPairedExpDesign(eset[,1:4]), silent = TRUE), "ExpressionSet")))
  + 	cat(" --- testCreatePairedExpDesign: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > ### TEST FUNCTIONS END
  > 
  > #### TESTS
  > #testGetRatios()
  > #testGetAllEBayes()
  > #testGetSignalPerCondition()
  > #testGetRatios()
  > 
  > if(T){
  + 	testCreateExpressionDataset()
  + 	testGetAllEBayes()
  + 	testGetRatios()
  + 	testGetAllCV()
  + 	testGlobalNormalize()
  + #testNormalise()
  + 	testRtNormalize()
  + 
  + 	testBaselineIntensity()
  + 	testRollUp()
  + 	testTopX()
  + 	
  + 	testGetLoocvFoldError()
  + 	
  + 	testRemoveOutliers()
  + 	testPerFeatureNormalization()
  + 	testStandardise()
  + 	testGetMaxIndex()
  + 	
  + 	testGetIBAQEset()
  + 	
  + 	testCreatePairedExpDesign()
  + 	
  + }
  --- testCreateExpressionDataset: --- 
  --- testCreateExpressionDataset: PASS ALL TEST --- 
  --- testGetAllEBayes: --- 
  --- testGetAllEBayes: PASS ALL TEST --- 
  --- testGetRatios: --- 
  --- testGetRatios: PASS ALL TEST --- 
  --- testGetAllCV: --- 
  --- testGetAllCV: PASS ALL TEST --- 
  --- testGlobalNormalize: --- 
  --- testGlobalNormalize: PASS ALL TEST --- 
   --- testRTNormalize --- 
   --- testRTNormalize: PASS ALL TEST --- 
  --- testBaselineIntensity: --- 
  --- testBaselineIntensity: PASS ALL TEST --- 
   --- testRollUp --- 
  Error in `[.data.table`(DT, , .I[getMaxIndex(idScore)], by = idx) : 
    SETLENGTH() cannot be applied to an ALTVEC object.
  Calls: testRollUp -> rollUp -> [ -> [.data.table
  Execution halted
Running the tests in ‘tests/testIdentificationAnalysis.R’ failed.
Complete output:
  > # TODO: Add comment
  > # 
  > # Author: ahrnee-adm
  > ###############################################################################
  > 
  > ### INIT
  > if(!grepl("SafeQuant\\.Rcheck",getwd())){
  + 	setwd(dirname(sys.frame(1)$ofile))
  + }
  > source("initTestSession.R")
  
  Attaching package: 'gplots'
  
  The following object is masked from 'package:stats':
  
      lowess
  
  
  Attaching package: 'seqinr'
  
  The following object is masked from 'package:limma':
  
      zscore
  
  Loading required package: survival
  Package epiR 0.9-96 is loaded
  Type help(epi.about) for summary information
  
  
  corrplot 0.84 loaded
  Loading required package: BiocGenerics
  Loading required package: parallel
  
  Attaching package: 'BiocGenerics'
  
  The following objects are masked from 'package:parallel':
  
      clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
      clusterExport, clusterMap, parApply, parCapply, parLapply,
      parLapplyLB, parRapply, parSapply, parSapplyLB
  
  The following object is masked from 'package:limma':
  
      plotMA
  
  The following objects are masked from 'package:stats':
  
      IQR, mad, sd, var, xtabs
  
  The following objects are masked from 'package:base':
  
      Filter, Find, Map, Position, Reduce, anyDuplicated, append,
      as.data.frame, basename, cbind, colMeans, colSums, colnames,
      dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
      intersect, is.unsorted, lapply, mapply, match, mget, order, paste,
      pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums,
      rownames, sapply, setdiff, sort, table, tapply, union, unique,
      unsplit, which, which.max, which.min
  
  Welcome to Bioconductor
  
      Vignettes contain introductory material; view with
      'browseVignettes()'. To cite Bioconductor, see
      'citation("Biobase")', and for packages 'citation("pkgname")'.
  
  > ### INIT END
  > 
  > proteinSeq1 <- "MSAGSSCSQTPSRAIPTRRVALGDGVQLPPGDYSTTPGGTLFSTTPGGTRIIYDRKFLMECRNSPVAKTPPKDLPAIPGVTSPTSDEPPMQASQSQLPSSPEDKRAGGEESQFEMDI"
  > proteinSeq2 <- "MVKKSRRRGAAQWAAVRAQAGLTATDENEDDLGLPPSPGDSSYYQDQVDEFHEARSRAVLAKGWNEVESGEEDGDEEEE"
  > proteinSeq3 <- "MSERMRPVVVDLPTSASSSMKVNG"	
  > proteinSeq4 <- "RKR"
  > 
  > ### read protein db
  > proteinDB <- read.fasta(fastaFile,seqtype = "AA",as.string = TRUE, set.attributes = FALSE)
  > 
  > ### INIT END
  > 
  > ### TEST FUNCTIONS
  > 
  > testIsCon <- function(){
  + 	cat("--- testIsCon: --- \n")
  + 	stopifnot(sum(isCon(fData(eset)$proteinName)) == 0)
  + 	cat("--- testIsCon: PASS ALL TEST --- \n")
  + }
  > 
  > testIsDecoy <- function(){
  + 	cat("--- testIsDecoy: --- \n")
  + 	stopifnot(sum(isDecoy(fData(eset)$proteinName)) == 198)
  + 	cat("--- testIsDecoy: PASS ALL TEST --- \n")
  + }
  > 
  > testGetIdQvals <- function(){
  + 	cat("--- testGetIdQvals: --- \n")
  + 	stopifnot(max(getIdLevelQvals(fData(eset)$idScore, isDecoy(fData(eset)$proteinName))) < 1)
  + 	cat("--- testGetIdQvals: PASS ALL TEST --- \n")
  + }
  > 
  > 
  > testAddIdQvalues <- function(){
  + 	
  + 	cat("--- testAddIdQvalues: --- \n")	
  + 	stopifnot(all.equal(round(max(fData(addIdQvalues(eset))$idQValue ),2),0.28))
  + 	stopifnot(all.equal(round(max(fData(addIdQvalues(rollUp(eset, featureDataColumnName = "proteinName"  )))$idQValue),2),0.29))
  + 	cat("--- testAddIdQvalues: PASS ALL TEST --- \n")
  + 	
  + 	#progenesisPeptideCsvFile3 <- "/Users/ahrnee-adm/dev/R/workspace/SafeQuant/inst/testData/PeptidesSQAnalysis/peptides5.csv"
  + 	#d <- parseProgenesisPeptideCsv(file=progenesisPeptideCsvFile3,expDesign=getExpDesignProgenesisCsv(progenesisPeptideCsvFile3))
  + 	#e <- rollUp(d, method="sum", isProgressBar=T, featureDataColumnName= c("proteinName"))
  + 	#x <- addIdQvalues(e)
  + 	#
  + 	#fData(x)$idQValue
  + 	#isPtm <- nchar(as.character(fData(x)$ptm)) > 0
  + 	#plot(sort(fData(x)$idScore[isPtm]),sort(fData(x)$idQValue[isPtm],decreasing=T), type="l" )
  + 	#lines(sort(fData(x)$idScore[!isPtm]),sort(fData(x)$idQValue[!isPtm],decreasing=T), col=2)
  + 	#
  + 	#
  + 	#d <- parseProgenesisProteinCsv(file=progenesisProteinCsvFile1,expDesign=getExpDesignProgenesisCsv(progenesisProteinCsvFile1))
  + 	#x <- addIdQvalues(d)
  + 	#fData(x)$idQValue
  + 	#plot(sort(fData(x)$idScore),sort(fData(x)$idQValue,decreasing=T), type="l" )
  + 	#
  + 	#hist(fData(x)$idQValue)
  + 	
  + 	
  + }
  > 
  > testGetScoreCutOff <- function(){
  + 	cat("--- testGetScoreCutOff: --- \n")
  + 	stopifnot(all.equal(round(getScoreCutOff(fData(eset)$idScore, isDecoy(fData(eset)$proteinName)),2), 12.07))
  + 	cat("--- testGetScoreCutOff: PASS ALL TEST --- \n")
  + }
  > 
  > testGetModifProteinCoordinates <- function(){
  + 	
  + 	ptm <- "[N-term] Acetyl (Protein N-term)|[6] Oxidation (M)"
  + 	peptide <- "SSDAEMAVFGEAAPYLR"
  + 	protein <-  "MPEPTIDESSDAEMAVFGEAAPYLRKSEKERIEAQNKPFDAK"
  + 	
  + 	#debug(getModifProteinCoordinates)
  + 	
  + 	cat("--- testGetModifProteinCoordinates: --- \n")
  + 	mc <- getModifProteinCoordinates(ptm,peptide,protein)
  + 	stopifnot(9 == mc[1])
  + 	stopifnot(14 == mc[2])
  + 	stopifnot(all.equal(c(34,49),getModifProteinCoordinates(fData(eset)$ptm[1],fData(eset)$peptide[1],proteinSeq1))) 
  + 	stopifnot(37 == getModifProteinCoordinates(fData(eset)$ptm[2],fData(eset)$peptide[2],proteinSeq2)) 
  + 	
  + 	#### SCAFFOLD PTM FORMAT
  + 	proteinSeq <-  "MMMMMMMMMMETPSPRPPPMRHRSSRSP"		
  + 	peptideSeq <- "ETPSPRPPPMR"
  + 	modifAnnot <- "T2 Phospho, S4 Phospho, M10 Oxidation"
  + 	stopifnot(all.equal(c(12,14,20),  getModifProteinCoordinates(modifAnnot,peptideSeq,proteinSeq, format=2)))
  + 	
  + 	
  + 	cat("--- testGetModifProteinCoordinates: PASS ALL TEST --- \n")
  + }
  > 
  > testGetMotifX <- function(){
  + 	
  + 	cat("--- testGetMotifX: --- \n")
  + 	
  + 	modifPos1 <- getModifProteinCoordinates(fData(eset)$ptm[1],fData(eset)$peptide[1],proteinSeq1)
  + 	modifPos2 <- getModifProteinCoordinates(fData(eset)$ptm[2],fData(eset)$peptide[2],proteinSeq2)
  + 	
  + 	stopifnot("PGDYS*TTPG" == getMotifX(modifPos1,fData(eset)$peptide[1],proteinSeq1,4)[1])
  + 	stopifnot("GLPPS*PGDS" == getMotifX(modifPos2,fData(eset)$peptide[2],proteinSeq2,4))
  + 	
  + 	#stopifnot("PGDYS*TTPG" == getMotifX(fData(eset)$ptm[1],fData(eset)$peptide[1],proteinSeq1,4)[1])
  + 	#stopifnot("GLPPS*PGDS" == getMotifX(fData(eset)$ptm[2],fData(eset)$peptide[2],proteinSeq2,4))
  + 	
  + 	cat("--- testGetMotifX: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testAddPTMCoord <- function(){
  + 	
  + 	cat("--- testAddPTMCoord: --- \n")	
  + 	eset <- .addPTMCoord(eset,proteinDB,motifLength = 4)
  + 	stopifnot( "PGDYS*TTPG,TPGGT*RIIY"  ==  fData(eset)$motifX[1] )
  + 	cat("--- testAddPTMCoord: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > 
  > testSetFilter <- function(){
  + 	
  + 	### peptide data example
  + 	
  + 	idQValueThrs <- 0.01
  + 	pMassTol <- c(-1,1)
  + 	ptmRegExp <- "?"
  + 	proteinNameRegExp <- "?"
  + 	
  + 	filter <- data.frame(
  + 			
  + 			fData(addIdQvalues(eset))$idQValue >= idQValueThrs # id score
  + 			,(fData(eset)$pMassError < pMassTol[1]) | (fData(eset)$pMassError > pMassTol[2]) # precursor mass tolerance
  + 			,isDecoy(fData(eset)$proteinName)	# decoy
  + 			,isCon(fData(eset)$proteinName)	# contaminants	
  + 			,!(regexpr(proteinNameRegExp,fData(eset)$proteinName,ignore.case=T) == 1) # protein ac 
  + 			,!(regexpr(ptmRegExp,fData((eset))$ptm,ignore.case=T) == 1 ) # ptm 
  + 	
  + 	)
  + 	
  + 	cat("--- testSetFilter: --- \n")	
  + 	
  + 	stopifnot(sum(fData(.setFilter(eset,filter=filter))$isFiltered) == 230)
  + 	stopifnot(sum(fData(.setFilter(eset,filter=cbind(filter,rep(T,nrow(eset)))))$isFiltered) == 900)
  + 	
  + 	cat("--- testSetFilter: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetPeptides <- function(){
  + 	
  + 	stopifnot(length(getPeptides(proteinSeq3)) == 3)
  + 	stopifnot(paste(getPeptides(proteinSeq3),collapse="") == proteinSeq3)
  + 	stopifnot(length(getPeptides(proteinSeq3,proteaseRegExp=.getProteaseRegExp("lys-c"))) == 2)
  + 
  + 	stopifnot(length(getPeptides(proteinSeq4,nbMiscleavages=0)) == 3)
  + 	stopifnot(length(getPeptides(proteinSeq4,nbMiscleavages=1)) == 5)
  + 	stopifnot(length(getPeptides(proteinSeq4,nbMiscleavages=2)) == 6)
  + 	
  + 	### digest whole db
  + 	if(F){
  + 
  + 		digestedDB <- list()
  + 		
  + 		for(i in 1:length(names(proteinDB))){
  + 		#for(i in 1:100){
  + 			
  + 			cat(i,"/",length(proteinDB),"\n")
  + 			ac <- names(proteinDB)[i]
  + 			
  + 			for(peptide in getPeptides(proteinDB[[ac]])){
  + 				
  + 				digestedDB[[peptide]] <- c(digestedDB[[peptide]],ac)
  + 				
  + 			}
  + 			
  + 		}
  + 	}
  + }
  > 
  > testGetNbDetectablePeptides <- function(){
  + 	
  + 	cat("--- testGetNbDetectablePeptides: --- \n")	
  + 	stopifnot(getNbDetectablePeptides(getPeptides(proteinSeq1)) == 8)
  + 	stopifnot(getNbDetectablePeptides(getPeptides(proteinSeq2),peptideLength=c(-Inf,Inf)) == length(getPeptides(proteinSeq2)))
  + 	cat("--- testGetNbDetectablePeptides: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetNbMisCleavages <- function(){
  + 	
  + 	cat("--- testGetNbMisCleavages: --- \n")	
  + 	peptide <- c("PEPTIDEK","PERTIDEK","PERKTIDEK","PERTIDE","RRPERPKK")
  + 	protease <- "trypsin"
  + 	stopifnot( all.equal(c(0,1,2,1,2),getNbMisCleavages(peptide)))
  + 	cat("--- testGetNbMisCleavages:  PASS ALL TEST --- \n")	
  + 	
  + }
  > 
  > testGetPeptidePerProtein <- function(){
  + 	
  + 	cat("--- testGetPeptidePerProtein: --- \n")
  + 	stopifnot(getNbPeptidesPerProtein(eset)["prot52"] == 3)
  + 	cat("--- testGetPeptidePerProtein: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testSetPeptidePerProtein <- function(){
  + 	
  + 	cat("--- testSetPeptidePerProtein: --- \n")
  + 	stopifnot("nbPeptides" %in% names(fData(setNbPeptidesPerProtein(eset))))
  + 	cat("--- testSetPeptidePerProtein: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetMeanCenteredRange <- function(){
  + 	
  + 	cat("--- testGetMeanCenteredRange: --- \n")
  + 	stopifnot( round(mean(getMeanCenteredRange(fData(eset)$pMassError)),3) == round(mean(fData(eset)$pMassError),3) )
  + 	cat("--- testGetMeanCenteredRange: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testIsStrippedACs <- function(){
  + 	
  + 	cat("--- testIsStrippedACs: --- \n")
  + 	stopifnot(!isStrippedACs( sample(names(proteinDB),100) ) )
  + 	stopifnot(isStrippedACs(fData(eset)$proteinName))
  + 	cat("--- testIsStrippedACs: PASS ALL TEST --- \n")
  + }
  > 
  > testStripACs <- function(){
  + 	
  + 	cat("--- testStripACs: --- \n")
  + 	stopifnot(isStrippedACs(stripACs(sample(names(proteinDB),100))))
  + 	cat("--- testStripACs: PASS ALL TEST --- \n")
  + }
  > 
  > ### TEST FUNCTIONS END
  > 
  > testGetAAProteinCoordinates <- function(){
  + 	
  + 	cat("--- testGetAAProteinCoordinates: --- \n")
  + 	peptide <- "SSDAEMAVFGEAAPYLR"
  + 	protein <-  "MPEPTIDESSDAEMAVFGEAAPYLRKSEKERIEAQNKPFDAK"
  + 	stopifnot(length(getAAProteinCoordinates("SSDAEMAVFGEAAPYLR","MPEPTIDESSDAEMAVFGEAAPYLRKSEKERIEAQNKPFDAK","S")) == 2)
  + 	stopifnot(getAAProteinCoordinates("SSDAEMAVFGEAAPYLR","MPEPTIDESSDAEMAVFGEAAPYLRKSEKERIEAQNKPFDAK","Y") == 23)
  + 	cat("--- testGetAAProteinCoordinates: PASS ALL TEST --- \n")	
  + 	
  + }
  > 
  > ### TESTS
  > 
  > testIsCon()
  --- testIsCon: --- 
  --- testIsCon: PASS ALL TEST --- 
  > testIsDecoy()
  --- testIsDecoy: --- 
  --- testIsDecoy: PASS ALL TEST --- 
  > testGetIdQvals()
  --- testGetIdQvals: --- 
  --- testGetIdQvals: PASS ALL TEST --- 
  > testAddIdQvalues()
  --- testAddIdQvalues: --- 
  Error in all.equal(round(max(fData(addIdQvalues(rollUp(eset, featureDataColumnName = "proteinName")))$idQValue),  : 
    SETLENGTH() cannot be applied to an ALTVEC object.
  Calls: testAddIdQvalues ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
  Execution halted
Running the tests in ‘tests/testParser.R’ failed.
Complete output:
  > # TODO: Add comment
  > # 
  > # Author: ahrnee-adm
  > ###############################################################################
  > 
  > 
  > ### INIT
  > if(!grepl("SafeQuant\\.Rcheck",getwd())){
  + 	setwd(dirname(sys.frame(1)$ofile))
  + }
  > source("initTestSession.R")
  
  Attaching package: 'gplots'
  
  The following object is masked from 'package:stats':
  
      lowess
  
  
  Attaching package: 'seqinr'
  
  The following object is masked from 'package:limma':
  
      zscore
  
  Loading required package: survival
  Package epiR 0.9-96 is loaded
  Type help(epi.about) for summary information
  
  
  corrplot 0.84 loaded
  Loading required package: BiocGenerics
  Loading required package: parallel
  
  Attaching package: 'BiocGenerics'
  
  The following objects are masked from 'package:parallel':
  
      clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
      clusterExport, clusterMap, parApply, parCapply, parLapply,
      parLapplyLB, parRapply, parSapply, parSapplyLB
  
  The following object is masked from 'package:limma':
  
      plotMA
  
  The following objects are masked from 'package:stats':
  
      IQR, mad, sd, var, xtabs
  
  The following objects are masked from 'package:base':
  
      Filter, Find, Map, Position, Reduce, anyDuplicated, append,
      as.data.frame, basename, cbind, colMeans, colSums, colnames,
      dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
      intersect, is.unsorted, lapply, mapply, match, mget, order, paste,
      pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums,
      rownames, sapply, setdiff, sort, table, tapply, union, unique,
      unsplit, which, which.max, which.min
  
  Welcome to Bioconductor
  
      Vignettes contain introductory material; view with
      'browseVignettes()'. To cite Bioconductor, see
      'citation("Biobase")', and for packages 'citation("pkgname")'.
  
  > ### INIT END
  > 
  > ### TEST FUNCTIONS
  > 
  > ################## TMT ##################
  > 
  > testGetSkipLineNb <- function(){
  + 	cat(" --- testGetSkipLineNb --- \n")
  + 	stopifnot(40 ==  .getSkipLineNb(scaffoldTmt6PlexRawTestFile))
  + 	stopifnot(40 ==  .getSkipLineNb(scaffoldTmt10PlexRawTestFile))
  + 	cat(" --- testGetSkipLineNb: PASS ALL TEST --- \n")	
  + }
  > 
  > testGetNbPlex <- function(){
  + 	cat(" --- testGetNbPlex --- \n")
  + 	stopifnot(10 ==.getNbPlex(scaffoldTmt10PlexRawTestFile))
  + 	stopifnot(6 ==.getNbPlex(scaffoldTmt6PlexRawTestFile))
  + 	cat(" --- testGetNbPlex: PASS ALL TEST --- \n")	
  + }
  > 
  > 
  > 
  > ################## LFQ ##################
  > 
  > testGetProgenesisCsvExpressionColIndices <- function(){
  + 	
  + 	cat(" --- testGetProgenesisCsvProteinIntColIndices --- \n")
  + 	
  + 	stopifnot(sum(14:17 %in% .getProgenesisCsvExpressionColIndices(progenesisProteinCsvFile1) ) == 4 )
  + 	
  + 	stopifnot(sum(31:48 %in% .getProgenesisCsvExpressionColIndices(progenesisFeatureCsvFile1) ) == 18 )
  + 	
  + 	stopifnot(.getProgenesisCsvExpressionColIndices(progenesisPeptideMeasurementCsvFile1)  == 18 )
  + 	
  + 	stopifnot(.getProgenesisCsvExpressionColIndices(progenesisPeptideMeasurementFractionatedCsvFile1)[1] == 21)
  + 	
  + 	cat(" --- testGetProgenesisCsvProteinIntColIndices: PASS ALL TEST --- \n")	
  + 	
  + }
  > 
  > testGetExpDesignProgenesisCsv <- function(){
  + 	
  + 	cat(" --- testGetExpDesignProgenesisCsv --- \n")
  + 	
  + 	stopifnot(4 == nrow( getExpDesignProgenesisCsv(progenesisProteinCsvFile1) )) 
  + 	
  + 	stopifnot(18 == nrow(getExpDesignProgenesisCsv(progenesisFeatureCsvFile1) ))
  + 	
  + 	cat(" --- testGetExpDesignProgenesisCsv: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > 
  > testParseProgenesisProteinCsv <- function(){
  + 	
  + 	cat(" --- testParseProgenesisProteinCsv --- \n")
  + 	
  + 	eset <- parseProgenesisProteinCsv(file=progenesisProteinCsvFile1,expDesign=getExpDesignProgenesisCsv(progenesisProteinCsvFile1))
  + 	stopifnot(983 == nrow(eset))
  + 	stopifnot(6 == ncol(fData(eset)))
  + 	stopifnot(4 == nrow(pData(eset)))
  + 	
  + 	expDesign <- getExpDesignProgenesisCsv(progenesisProteinCsvFile1)[c(3,2),]
  + 	eset2 <- parseProgenesisProteinCsv(file=progenesisProteinCsvFile1,expDesign=expDesign)
  + 	
  + 	stopifnot(colnames(eset2) == row.names(pData(eset))[c(3,2)]   )
  + 	### change expDesign
  + 	
  + 	cat(" --- testParseProgenesisProteinCsv: PASS ALL TEST  --- \n")
  + }
  > 
  > testParseProgenesisFeatureCsv <- function(){
  + 	
  + 	cat(" --- testParseProgenesisFeatureCsv --- \n")
  + 	
  + 	eset <- parseProgenesisFeatureCsv(file=progenesisFeatureCsvFile1,expDesign=getExpDesignProgenesisCsv(progenesisFeatureCsvFile1))
  + 	stopifnot(97 == nrow(eset))
  + 	#names(fData(eset))
  + 	stopifnot(13 == ncol(fData(eset)))
  + 	stopifnot(18 == nrow(pData(eset)))
  + 	
  + #	expDesign <- getExpDesignProgenesisCsv(progenesisFeatureCsvFile1)[c(3,4:8),]
  + #	eset2 <- parseProgenesisPeptideCsv(file=progenesisFeatureCsvFile1,expDesign=expDesign)
  + #	
  + #	pData(eset2)
  + #	pData(eset)
  + 	
  + 	cat(" --- testParseProgenesisFeatureCsv: PASS ALL TEST  --- \n")
  + }
  > 
  > testParseScaffoldRawFile <- function(){
  + 	
  + 	
  + 	cat(" --- testParseScaffoldRawFile --- \n")
  + 	
  + 	# 6 plex	
  + 	
  + 	expDesignTMTSixPlex <- data.frame(condition=sort(rep(c(1,2),3)),isControl=sort(rep(c(T,F),3),decreasing=T) )
  + 	eset <- parseScaffoldRawFile(scaffoldTmt6PlexRawTestFile,expDesign=expDesignTMTSixPlex)
  + 	stopifnot(329 ==  nrow(eset))
  + 	stopifnot("sp|P38711|RS27B_YEAST,sp|P35997|RS27_YEAST" ==  fData(eset)$proteinName[1])
  + 	stopifnot("sp|P38711|RS27B_YEAST" == fData(parseScaffoldRawFile(scaffoldTmt6PlexRawTestFile,expDesign=expDesignTMTSixPlex,keepFirstAcOnly=T))$proteinName[1])
  + 	
  + 	expDesignTMTSixPlex <- data.frame(condition=sort(rep(c(1,2),3)),isControl=sort(rep(c(T,F),3),decreasing=T) )
  + 	rownames(expDesignTMTSixPlex) <- rev(1:6)
  + 	eset2 <- parseScaffoldRawFile(scaffoldTmt6PlexRawTestFile,expDesign=expDesignTMTSixPlex[1:5,])
  + 	stopifnot(all.equal(exprs(eset)[1,6], exprs(eset2)[1,1]))
  + 	
  + 	# 10 plex	
  + 	expDesignTMTTenPlex <- data.frame(condition=sort(rep(c(1:5),2)),isControl=c(T,T,rep(F,8)) )
  + 	eset3 <- parseScaffoldRawFile(scaffoldTmt10PlexRawTestFile,expDesign=expDesignTMTTenPlex, keepFirstAcOnly=T)
  + 	stopifnot(958 ==  nrow(eset3))
  + 	cat(" --- testParseScaffoldRawFile: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testGetFileType <- function(){
  + 	
  + 	cat(" --- testGetFileType --- \n")
  + 	
  + 	stopifnot(.getFileType(scaffoldTmt6PlexRawTestFile) == "ScaffoldTMT")
  + 	stopifnot(.getFileType(scaffoldTmt10PlexRawTestFile) == "ScaffoldTMT")
  + 	stopifnot(.getFileType(progenesisFeatureCsvFile1) == "ProgenesisFeature")
  + 	stopifnot(.getFileType(progenesisProteinCsvFile1) == "ProgenesisProtein")
  + 	stopifnot(.getFileType(progenesisPeptideMeasurementCsvFile1) == "ProgenesisPeptide")
  + 	stopifnot(.getFileType(maxQuantProteinFileTxt) == "MaxQuantProteinGroup")
  + 
  + 	cat(" --- testGetFileType: PASS ALL TEST --- \n")
  + 	
  + }
  > 
  > testParseProgenesisPeptideMeasurementCsv <- function(){
  + 	
  + 	cat(" --- testParseProgenesisPeptideMeasurementCsv --- \n")
  + 	eset <- parseProgenesisPeptideMeasurementCsv(progenesisPeptideMeasurementCsvFile1,expDesign= getExpDesignProgenesisCsv(progenesisPeptideMeasurementCsvFile1))
  + 	stopifnot(ncol(exprs(eset)) == 1)
  + 	stopifnot(nrow(eset) == 92)
  + 	
  + 	stopifnot(sum(grepl(";",fData(eset)$proteinName)) == 2)
  + 	stopifnot("sp|Q9Y6H1|CHCH2_HUMAN;sp|Q5T1J5|CHCH9_HUMAN" %in% fData(eset)$proteinName)
  + 	stopifnot(all.equal(which(fData(eset)$nbProteinConflicts == 1), c(33,66)))
  + 	
  + 	esetUnique <- parseProgenesisPeptideMeasurementCsv(progenesisPeptideMeasurementCsvFile1,expDesign= getExpDesignProgenesisCsv(progenesisPeptideMeasurementCsvFile1), uniqueProteins = T)
  + 	stopifnot(sum(fData(esetUnique)$nbProteinConflicts) == 0)
  + 	
  + 	cat(" --- testParseProgenesisPeptideMeasurementCsv: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > 
  > testParseMaxQuantProteinGroupTxt <- function(){
  + 	
  + 	cat(" --- testParseMaxQuantProteinGroupTxt:  --- \n")
  + 	
  + 	expDesign <- data.frame(row.names=1:20,isControl=c(rep(T,5),rep(F,15)),condition=sort(rep(paste("condition",1:4,sep="_"),5)))
  + 	eset <- parseMaxQuantProteinGroupTxt(maxQuantProteinFileTxt,expDesign=expDesign, method="auc")
  + 	
  + 	stopifnot(ncol(fData(eset)) == 7)
  + 	stopifnot(ncol(eset) == 20)
  + 	stopifnot( nrow(parseMaxQuantProteinGroupTxt(maxQuantProteinFileTxt,expDesign=expDesign, method="spc")) == 996 )
  + 
  + 	cat(" --- testParseMaxQuantProteinGroupTxt: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > testParseScaffoldPTMReport <- function(){
  + 	
  + 	cat(" --- testParseScaffoldPTMReport:  --- \n")
  + 	df <- parseScaffoldPTMReport(scaffoldPtmReportFile1)
  + 	stopifnot(nrow(df) == 883 )
  + 	cat(" --- testParseScaffoldPTMReport: PASS ALL TEST  --- \n")
  + 
  + }
  > 
  > 
  > testAddScaffoldPTMFAnnotations <- function(){
  + 	
  + 	expDesignTMTTenPlex <- data.frame(condition=sort(rep(c(1:5),2)),isControl=c(T,T,rep(F,8)) )
  + 	eset <- parseScaffoldRawFile(scaffoldPtmTMTRawDataFile1,expDesign = expDesignTMTTenPlex)
  + 	
  + 	cat(" --- testAddScaffoldPTMFAnnotations:  --- \n")
  + 	eset <- addScaffoldPTMFAnnotations(eset,scaffoldPtmReportFile1)
  + 	
  + 	stopifnot(all( c("ptmPeptide","ptm","ptmLocProb","idScore","ptmLocMascotConfidence","pMassError") %in% names(fData(eset))))
  + 	
  + 	cat(" --- testAddScaffoldPTMFAnnotations: PASS ALL TEST  --- \n")
  + 	
  + }
  > 
  > ### TEST FUNCTIONS END
  > 
  > 
  > 
  > #testParseProgenesisPeptideMeasurementCsv()
  > 
  > ### TESTS
  > if(T){
  + 	testGetFileType()
  + 	
  + # progenesis
  + 	testGetProgenesisCsvExpressionColIndices()
  + 	testGetExpDesignProgenesisCsv()
  + 	testParseProgenesisProteinCsv()
  + 	testParseProgenesisFeatureCsv()
  + 	testParseProgenesisPeptideMeasurementCsv()
  + 	
  + # scaffold 
  + 	testGetSkipLineNb()
  + 	testParseScaffoldRawFile()
  + 	testGetNbPlex()
  + 	testParseScaffoldPTMReport()
  + 	testAddScaffoldPTMFAnnotations()
  + 	
  + # max quant
  + 	testParseMaxQuantProteinGroupTxt()
  + }
   --- testGetFileType --- 
   --- testGetFileType: PASS ALL TEST --- 
   --- testGetProgenesisCsvProteinIntColIndices --- 
   --- testGetProgenesisCsvProteinIntColIndices: PASS ALL TEST --- 
   --- testGetExpDesignProgenesisCsv --- 
   --- testGetExpDesignProgenesisCsv: PASS ALL TEST  --- 
   --- testParseProgenesisProteinCsv --- 
   --- testParseProgenesisProteinCsv: PASS ALL TEST  --- 
   --- testParseProgenesisFeatureCsv --- 
   --- testParseProgenesisFeatureCsv: PASS ALL TEST  --- 
   --- testParseProgenesisPeptideMeasurementCsv --- 
  INFO: ASSIGNING PEPTIDES TO PROTEINS APPLYING OCCAM'S RAZOR 
  Error in `[.data.table`(resDT, , list(allAccessions = paste(unique(c(unlist(strsplit(Grouped,  : 
    SETLENGTH() cannot be applied to an ALTVEC object.
  Calls: testParseProgenesisPeptideMeasurementCsv ... parseProgenesisPeptideMeasurementCsv -> [ -> [.data.table
  In addition: Warning message:
  In parseProgenesisPeptideMeasurementCsv(progenesisPeptideMeasurementCsvFile1,  :
    NAs introduced by coercion
  Execution halted