Files
ROBITools/man/taxo.decider.Rd

61 lines
2.4 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/choose.taxonomy.R
\name{taxo.decider}
\alias{taxo.decider}
\title{Choose between databases for taxonomic classifications}
\usage{
taxo.decider(x, taxonomy, dbrank, thresh = 0.95)
}
\arguments{
\item{x}{a \code{\link{metabarcoding.data}} object}
\item{taxonomy}{a \code{\linkS4class{taxonomy.obitools}} instance}
\item{dbrank}{string or vector indicating reference database names ranked by order of preference}
\item{thresh}{a best_identity threshold for applying priority. Default is \code{0.95}}
}
\value{
returns a data.frame with the refined taxonomic assignement and classic taxonomy description.
}
\description{
Chooses a sequence taxonomic assignment in order of preference for the different
reference databases that have been used when the assignment is above a certain threshold
}
\examples{
data(termes)
taxo=default.taxonomy()
#create artificial taxonomic assignments
attr(termes, "motus")["best_identity:DB1"] = sample(seq(0.5,1,0.001),size=nrow(termes$motus), replace=T)
attr(termes, "motus")["best_identity:DB2"] = sample(seq(0.5,1,0.001),size=nrow(termes$motus), replace=T)
attr(termes, "motus")["best_identity:DB3"] = sample(seq(0.5,1,0.001),size=nrow(termes$motus), replace=T)
attr(termes, "motus")["taxid_by_db:DB1"] = termes$motus$taxid
attr(termes, "motus")["taxid_by_db:DB2"] = sample(termes$motus$taxid,size=nrow(termes$motus), replace=F)
attr(termes, "motus")["taxid_by_db:DB3"] = sample(termes$motus$taxid,size=nrow(termes$motus), replace=F)
#Run taxo.decider
termes.ok = taxo.decider(termes, taxo, "DB2", 0.95)
head(termes.ok$motus[union(grep("DB", colnames(termes.ok$motus)), grep("_ok", colnames(termes.ok$motus)))])
termes.ok = taxo.decider(termes, taxo, c("DB3", "DB1"), 0.95)
head(termes.ok$motus[union(grep("DB", colnames(termes.ok$motus)), grep("_ok", colnames(termes.ok$motus)))])
#Quick look at the enhancement in taxonomic assignements
par(mfrow=c(1,4))
for(i in grep("best_identity.", colnames(termes.ok$motus))){
hist(termes.ok$motus[,i], breaks=20, ylim=c(1,21), main=colnames(termes.ok$motus)[i], xlab="assignment score")
}
}
\seealso{
\code{\linkS4class{taxonomy.obitools}}, and methods \code{\link{species}},\code{\link{genus}}, \code{\link{family}},\code{\link{kingdom}},
\code{\link{superkingdom}},\code{\link{taxonatrank}}, \code{\link{taxonmicank}}
}
\author{
Lucie Zinger
}
\keyword{taxonomy}