diff --git a/DESCRIPTION b/DESCRIPTION index a8c42e5..1ff8318 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,4 +35,4 @@ Collate: 'taxoDBtree.R' 'taxonomic.resolution.R' 'taxonomy_classic_table.R' -RoxygenNote: 6.0.1 +RoxygenNote: 6.1.1 diff --git a/R/obiclean.R b/R/obiclean.R index b74b1c7..b320629 100644 --- a/R/obiclean.R +++ b/R/obiclean.R @@ -56,9 +56,8 @@ setMethod("extracts.obiclean", "metabarcoding.data", function(obj) { cols = colnames(obj@motus) cleancols = grep(pat,cols) clean.names=cols[cleancols] - p = grep(pat,cols) - d = t(as.factor.or.matrix(obj@motus[,p])) - n = sapply(strsplit(cols[p],':'),function(y) y[[2]]) + d = t(as.factor.or.matrix(obj@motus[,cleancols])) + n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]]) rownames(d)=n d = d[rownames(obj@reads),] obj[["obiclean_status"]]=d @@ -68,28 +67,31 @@ setMethod("extracts.obiclean", "metabarcoding.data", function(obj) { pat = "^obiclean_count:.*$" cols = colnames(newmotus) cleancols = grep(pat,cols) - clean.names=cols[cleancols] - p = grep(pat,cols) - d = t(as.factor.or.matrix(newmotus[,p])) - n = sapply(strsplit(cols[p],':'),function(y) y[[2]]) - rownames(d)=n - d = d[rownames(obj@reads),] - obj[["obiclean_count"]]=d - - newmotus = newmotus[-cleancols] + if (length(cleancols) > 0) { + clean.names=cols[cleancols] + d = t(as.factor.or.matrix(newmotus[,cleancols])) + n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]]) + rownames(d)=n + d = d[rownames(obj@reads),] + obj[["obiclean_count"]]=d + + newmotus = newmotus[-cleancols] + } pat = "^obiclean_cluster:.*$" cols = colnames(newmotus) cleancols = grep(pat,cols) - clean.names=cols[cleancols] - p = grep(pat,cols) - d = t(as.factor.or.matrix(newmotus[,p])) - n = sapply(strsplit(cols[p],':'),function(y) y[[2]]) - rownames(d)=n - d = d[rownames(obj@reads),] - obj[["obiclean_cluster"]]=d - newmotus = newmotus[-cleancols] + if (length(cleancols) > 0) { + clean.names=cols[cleancols] + d = t(as.factor.or.matrix(newmotus[,cleancols])) + n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]]) + rownames(d)=n + d = d[rownames(obj@reads),] + obj[["obiclean_cluster"]]=d + + newmotus = newmotus[-cleancols] + } newdata = copy.metabarcoding.data(obj,motus=newmotus) diff --git a/man/extrapol.freq.Rd b/man/extrapol.freq.Rd index e4189b3..e3ddbc2 100644 --- a/man/extrapol.freq.Rd +++ b/man/extrapol.freq.Rd @@ -4,8 +4,8 @@ \alias{extrapol.freq} \title{Read frequencies krigging} \usage{ -extrapol.freq(x, min.coord, max.coord, grid.grain = 100, coords, otus.table, - cutoff = 0.001, return.metabarcoding.data = FALSE) +extrapol.freq(x, min.coord, max.coord, grid.grain = 100, coords, + otus.table, cutoff = 0.001, return.metabarcoding.data = FALSE) } \arguments{ \item{x}{a vector or matrix from a row-normalized read table diff --git a/man/initialize-methods.Rd b/man/initialize-methods.Rd index 0918e25..9989d9b 100644 --- a/man/initialize-methods.Rd +++ b/man/initialize-methods.Rd @@ -7,7 +7,8 @@ \title{metabarcoding.data constructor} \usage{ \S4method{initialize}{metabarcoding.data}(.Object, reads, samples, motus, - taxonomy = NULL, taxid = NULL, sample.margin = NA, layers = list()) + taxonomy = NULL, taxid = NULL, sample.margin = NA, + layers = list()) } \description{ metabarcoding.data constructor diff --git a/man/m.univariate.test.Rd b/man/m.univariate.test.Rd index 26c6a67..e647724 100644 --- a/man/m.univariate.test.Rd +++ b/man/m.univariate.test.Rd @@ -4,7 +4,8 @@ \alias{m.univariate.test} \title{Test the significance of the M statistics by Monte-Carlo} \usage{ -m.univariate.test(w, groups, resampling = 100, alternative = "two.sided") +m.univariate.test(w, groups, resampling = 100, + alternative = "two.sided") } \arguments{ \item{w}{the weigth matrix indicating the presence probability of each motu diff --git a/man/map.extrapol.freq.Rd b/man/map.extrapol.freq.Rd index 1f30663..de8b39d 100644 --- a/man/map.extrapol.freq.Rd +++ b/man/map.extrapol.freq.Rd @@ -4,8 +4,8 @@ \alias{map.extrapol.freq} \title{Maps of krigged log10-transformed frequencies} \usage{ -map.extrapol.freq(x, path = NULL, col.name = NULL, index, cutoff = 0.001, - add.points = NULL, adj = 4) +map.extrapol.freq(x, path = NULL, col.name = NULL, index, + cutoff = 0.001, add.points = NULL, adj = 4) } \arguments{ \item{x}{an extrapol.freq output} diff --git a/man/plot.PCRplate.Rd b/man/plot.PCRplate.Rd index 76710b0..5bb673b 100644 --- a/man/plot.PCRplate.Rd +++ b/man/plot.PCRplate.Rd @@ -4,8 +4,8 @@ \alias{plot.PCRplate} \title{Plot PCR plates} \usage{ -\method{plot}{PCRplate}(x, samples = NULL, col = "cyan2", different = T, - ...) +\method{plot}{PCRplate}(x, samples = NULL, col = "cyan2", + different = T, ...) } \arguments{ \item{x}{a \code{\link{metabarcoding.data}} object} diff --git a/man/threshold-mask-methods.Rd b/man/threshold-mask-methods.Rd index 50f643b..ce20226 100644 --- a/man/threshold-mask-methods.Rd +++ b/man/threshold-mask-methods.Rd @@ -6,8 +6,8 @@ \alias{threshold.mask-methods,metabarcoding.data} \title{Computes a cumulatif thresold mask for filtering read aboundancies.} \usage{ -\S4method{threshold.mask}{metabarcoding.data}(data, MARGIN, threshold = 0.97, - operator = "<") +\S4method{threshold.mask}{metabarcoding.data}(data, MARGIN, + threshold = 0.97, operator = "<") } \arguments{ \item{data}{The \code{\linkS4class{metabarcoding.data}} instance