* using log directory ‘/data/gannet/ripley/R/packages/tests-LENGTH1/adhoc.Rcheck’ * using R Under development (unstable) (2022-04-26 r82260) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘adhoc/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘adhoc’ version ‘1.1’ * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘adhoc’ can be installed ... [5s/14s] OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [7s/18s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of ‘data’ directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking examples ... [6s/16s] ERROR Running examples in ‘adhoc-Ex.R’ failed The error most likely occurred in: > ### Name: adhoc-package > ### Title: Calculation of ad hoc distance thresholds for DNA barcoding > ### identification. > ### Aliases: adhoc-package adhoc > > ### ** Examples > > data(tephdata); > out1<-checkDNAbcd(tephdata); Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences were not assigned to the same haplotype because of ambiguities Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences of different lengths were assigned to the same haplotype Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences of different lengths were assigned to the same haplotype Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences of different lengths were assigned to the same haplotype Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences were not assigned to the same haplotype because of ambiguities Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences of different lengths were assigned to the same haplotype Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : no segregating site detected with these options Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences were not assigned to the same haplotype because of ambiguities Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : no segregating site detected with these options Warning in haplotype.DNAbin(seq[grep(listsp$species[[i]], labels(seq)), : some sequences of different lengths were assigned to the same haplotype > out2<-adhocTHR(out1); ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- adhoc --- call from context --- adhocTHR(out1) --- call from argument --- Reg == "linear" && myreg$coefficients < 0 --- R stacktrace --- where 1: adhocTHR(out1) --- value of length: 4 type: logical --- (Intercept) thres FALSE FALSE FALSE FALSE --- function from context --- function (a, NbrTh = 30, ErrProb = 0.05, Ambig = "incorrect", Reg = "linear") { myBM <- list() myBMid <- list() myth <- c() BM <- data.frame(labels = a$mylabels$id, distBM = NA, idBM = NA, IDcheck = NA) for (i in 1:length(a$mylabels$id)) { spname <- c() BM$distBM[i] <- min(a$dist[i, ], na.rm = TRUE) myBM[[i]] <- labels(which(a$dist[i, ] == min(a$dist[i, ], na.rm = TRUE))) myBMid[[i]] <- labels(which(a$dist[, i] == min(a$dist[, i], na.rm = TRUE))) spname <- paste(a$mylabels$genus[i], a$mylabels$species[i], sep = "_") if (length(unique(c(spname, myBM[[i]]))) > 1) { BM$idBM[i] <- unique(c(spname, myBM[[i]]))[-which(unique(c(spname, myBM[[i]])) == spname)][[1]] } else { BM$idBM[i] <- myBM[[i]][1] } } myth <- seq(from = 0, to = as.numeric(max(BM$distBM, na.rm = TRUE)), length = NbrTh) allmatches <- data.frame(labels = a$mylabels$id) for (i in 1:length(a$mylabels$id)) { for (j in 1:length(myth)) { if (BM$distBM[i] > myth[j]) { if (length(intersect(paste(a$mylabels$genus[i], a$mylabels$species[i], sep = "_"), myBM[[i]])) == 0) { allmatches[i, j + 1] <- "TN" } else { if (length(unique(c(paste(a$mylabels$genus[i], a$mylabels$species[i], sep = "_"), myBM[[i]]))) > 1) { allmatches[i, j + 1] <- "TNambiguous" } else { allmatches[i, j + 1] <- "FN" } } } else { if (length(intersect(paste(a$mylabels$genus[i], a$mylabels$species[i], sep = "_"), myBM[[i]])) == 0) { allmatches[i, j + 1] <- "FP" } else { if (length(unique(c(paste(a$mylabels$genus[i], a$mylabels$species[i], sep = "_"), myBM[[i]]))) > 1) { allmatches[i, j + 1] <- "FPambiguous" } else { allmatches[i, j + 1] <- "TP" } } } } } BM$IDcheck <- allmatches[, length(myth) + 1] colnames(allmatches)[2:(length(myth) + 1)] <- paste("threshold nb", 1:length(myth)) IDcheck <- data.frame(thres = myth, TP = NA, FP = NA, RE = NA, TN = NA, FN = NA, OE = NA, Accuracy = NA, Precision = NA) for (k in 1:length(myth)) { if (Ambig == "correct") { IDcheck$TP[k] <- length(which(allmatches[, k + 1] == "TP")) + length(which(allmatches[, k + 1] == "FPambiguous")) IDcheck$FP[k] <- length(which(allmatches[, k + 1] == "FP")) IDcheck$TN[k] <- length(which(allmatches[, k + 1] == "TN")) IDcheck$FN[k] <- length(which(allmatches[, k + 1] == "FN")) + length(which(allmatches[, k + 1] == "TNambiguous")) } else { if (Ambig == "incorrect") { IDcheck$TP[k] <- length(which(allmatches[, k + 1] == "TP")) IDcheck$FP[k] <- length(which(allmatches[, k + 1] == "FP")) + length(which(allmatches[, k + 1] == "FPambiguous")) IDcheck$TN[k] <- length(which(allmatches[, k + 1] == "TN")) + length(which(allmatches[, k + 1] == "TNambiguous")) IDcheck$FN[k] <- length(which(allmatches[, k + 1] == "FN")) } else { IDcheck$TP[k] <- length(which(allmatches[, k + 1] == "TP")) IDcheck$FP[k] <- length(which(allmatches[, k + 1] == "FP")) IDcheck$TN[k] <- length(which(allmatches[, k + 1] == "TN")) IDcheck$FN[k] <- length(which(allmatches[, k + 1] == "FN")) } } IDcheck$RE[k] <- IDcheck$FP[k]/(IDcheck$TP[k] + IDcheck$FP[k]) IDcheck$OE[k] <- (IDcheck$FP[k] + IDcheck$FN[k])/(IDcheck$TP[k] + IDcheck$FP[k] + IDcheck$TN[k] + IDcheck$FN[k]) IDcheck$Accuracy[k] <- (IDcheck$TP[k] + IDcheck$TN[k])/(IDcheck$TP[k] + IDcheck$FP[k] + IDcheck$TN[k] + IDcheck$FN[k]) IDcheck$Precision[k] <- IDcheck$TP[k]/(IDcheck$TP[k] + IDcheck$FP[k]) } write.csv(BM, "Bestmatches.csv") write.csv(IDcheck, "ID.csv") redflagged <- list() redflaggedSP <- c() myBMid <- lapply(myBMid, paste, collapse = " ") if (length(which(BM$IDcheck == "FPambiguous")) > 0) { for (i in 1:length(myBMid[which(BM$IDcheck == "FPambiguous")])) { redflagged[[i]] <- as.character(BM$labels[which(BM$IDcheck == "FPambiguous")][[i]]) redflagged[[i]][2] <- length(unique(as.character(myBM[which(BM$IDcheck == "FPambiguous")][[i]]))) redflagged[[i]][3] <- length(which(as.character(myBM[which(BM$IDcheck == "FPambiguous")][[i]]) == paste(a$mylabels$genus[which(BM$IDcheck == "FPambiguous")][[i]], a$mylabels$species[which(BM$IDcheck == "FPambiguous")][[i]], sep = "_"))) redflagged[[i]][4] <- length(myBM[which(BM$IDcheck == "FPambiguous")][[i]]) - as.numeric(redflagged[[i]][3]) redflagged[[i]][5] <- as.character(myBMid[which(BM$IDcheck == "FPambiguous")][[i]]) redflaggedSP[[i]] <- unique(as.character(myBM[which(BM$IDcheck == "FPambiguous")][[i]])) } writeLines(c("red_flagged_seqID,Nb_species,Nb_conspecific_seq,Nb_allospecific_seq,list_of_best_matches", unlist(lapply(redflagged, paste, collapse = ","))), "redflagged.csv") redflaggedSP <- unique(redflaggedSP) writeLines(c("red_flagged_species_groups", unlist(lapply(redflaggedSP, paste, collapse = ","))), "redflaggedSP.csv") } if (Reg == "linear") { myreg <- c() THR <- c() myreg <- lm(RE ~ thres, IDcheck) myreg$coefficients[3:4] <- 0 } if (Reg == "polynomial") { myreg <- c() fp <- c() solp <- c() THRp <- c() IDcheck$thres2 <- IDcheck$thres^2 IDcheck$thres3 <- IDcheck$thres^3 myreg <- lm(RE ~ thres + thres2 + thres3, IDcheck) fp <- polynomial(myreg$coefficients) solp <- solve(fp, ErrProb) THR <- solp[(solp > 0) & (solp < max(IDcheck$thres))] } if (length(grep("FP", BM$IDcheck)) == 0) stop("All identifications are correct when using the best match method (no distance threshold considered). An ad hoc distance threshold for best close match identification cannot be calculated") if (Reg == "linear" && myreg$coefficients < 0) stop("The estimated relative identification error (RE) cannot be reached using this reference library (check reference library or increase argument ErrProb, cf. Sonet et al. 2013).") THR <- (ErrProb - as.numeric(myreg$coefficients[1]))/as.numeric(myreg$coefficients[2]) if (THR < 0) stop("The estimated relative identification error (RE) cannot be reached using this reference library (check reference library or increase argument ErrProb, cf. Sonet et al. 2013).") return(list(BM = BM, IDcheck = IDcheck, reg = myreg, ErrProb = ErrProb, THR = THR, redflagged = redflagged, redflaggedSP = redflaggedSP)) } --- function search by body --- Function adhocTHR in namespace adhoc has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical * checking PDF version of manual ... OK * checking for non-standard things in the check directory ... NOTE Found the following files/directories: ‘Bestmatches.csv’ ‘ID.csv’ ‘listsp.csv’ ‘mylabels.csv’ * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR, 1 NOTE See ‘/data/gannet/ripley/R/packages/tests-LENGTH1/adhoc.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 2:19.67, 46.59 + 7.35