Commit b16a0f39 authored by Eric Coissac's avatar Eric Coissac

Upadate on the taxonomy

parent 46dbb4a8
^.*\.Rproj$ ^.*\.Rproj$
^\.Rproj\.user$ ^\.Rproj\.user$
^external_data_pkg$
^LICENCE-CECILL-2.1.txt$
^data-raw$
...@@ -7,3 +7,5 @@ B100000.fasta ...@@ -7,3 +7,5 @@ B100000.fasta
B3500.fasta B3500.fasta
B5.fasta B5.fasta
Bison-gh.uniq.fasta Bison-gh.uniq.fasta
*.o
*.so
Package: ROBITools2 Package: ROBITools2
Type: Package Type: Package
Title: What the Package Does (Title Case) Title: Provides tools to help in the analysing of DNA metabarcoding data.
Version: 0.1.0 Version: 0.1.0
Author: Who wrote it Author: Eric Coissac
Maintainer: The package maintainer <yourself@somewhere.net> Maintainer: Eric Coissac <eric.coissac@metabarcoding.org>
Description: More about what it does (maybe more than one line) Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description. Use four spaces when indenting paragraphs within the Description.
License: What license is it under? License: CeCILL-2
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 7.1.0 RoxygenNote: 7.1.0
...@@ -45,6 +45,7 @@ Collate: ...@@ -45,6 +45,7 @@ Collate:
'robitag.R' 'robitag.R'
'robitaxid.R' 'robitaxid.R'
'tags_categories.R' 'tags_categories.R'
'taxonomy_default.R'
'taxonomy_methods.R' 'taxonomy_methods.R'
'taxonomy_robi.R' 'taxonomy_robi.R'
'taxonomy_ncbi.R' 'taxonomy_ncbi.R'
......
...@@ -94,6 +94,7 @@ S3method(pillar_shaft,robitaxid) ...@@ -94,6 +94,7 @@ S3method(pillar_shaft,robitaxid)
S3method(pillar_shaft,robiuniqueid) S3method(pillar_shaft,robiuniqueid)
S3method(print,robicategory) S3method(print,robicategory)
S3method(reference_taxonomy,robilca) S3method(reference_taxonomy,robilca)
S3method(reference_taxonomy,robitaxid)
S3method(reference_taxonomy,robitaxonomy) S3method(reference_taxonomy,robitaxonomy)
S3method(rep,robicategory) S3method(rep,robicategory)
S3method(rep,robitag) S3method(rep,robitag)
...@@ -159,6 +160,7 @@ export(filter_tag_homopolymere) ...@@ -159,6 +160,7 @@ export(filter_tag_homopolymere)
export(filter_tag_homopolymere_min) export(filter_tag_homopolymere_min)
export(full_taxonomy) export(full_taxonomy)
export(genus) export(genus)
export(get_default_taxonomy)
export(gradient_tol1) export(gradient_tol1)
export(gradient_tol2) export(gradient_tol2)
export(ids) export(ids)
...@@ -206,6 +208,7 @@ export(read_fasta) ...@@ -206,6 +208,7 @@ export(read_fasta)
export(read_ncbi_taxdump) export(read_ncbi_taxdump)
export(read_obitab) export(read_obitab)
export(read_obitools_taxonomy) export(read_obitools_taxonomy)
export(read_robitaxonomy)
export(reference_taxonomy) export(reference_taxonomy)
export(resets_category_tags) export(resets_category_tags)
export(rkmer) export(rkmer)
...@@ -227,6 +230,7 @@ export(rseq) ...@@ -227,6 +230,7 @@ export(rseq)
export(sample_ids_name) export(sample_ids_name)
export(samples) export(samples)
export(scientific_name) export(scientific_name)
export(set_default_taxonomy)
export(species) export(species)
export(superkingdom) export(superkingdom)
export(tags_positive_ctrls) export(tags_positive_ctrls)
...@@ -238,6 +242,7 @@ export(unclass_robiobject) ...@@ -238,6 +242,7 @@ export(unclass_robiobject)
export(validate_robisample) export(validate_robisample)
export(validate_robitaxonomy) export(validate_robitaxonomy)
export(write.xlsx) export(write.xlsx)
export(write_robitaxonomy)
import(R6) import(R6)
import(doParallel) import(doParallel)
import(dplyr) import(dplyr)
......
...@@ -3,13 +3,10 @@ ...@@ -3,13 +3,10 @@
#' @description Provides tools to help in the analysing of DNA metabarcoding data. #' @description Provides tools to help in the analysing of DNA metabarcoding data.
#' #'
#' @details #' @details
#' The functions in the ProcMod package aims to estimate and to test correlation #' More about what it does (maybe more than one line)
#' between matrices, correcting for the spurious correlations because of the #' Use four spaces when indenting paragraphs within the Description.
#' over-fitting effect.
#' #'
#' over-fitting effect. #' The ROBITools2 package is developed on the metabarcoding.org gitlab
#'
#' The ProcMod package is developed on the metabarcoding.org gitlab
#' (https://git.metabarcoding.org/obitools/ROBITools2.git). #' (https://git.metabarcoding.org/obitools/ROBITools2.git).
#' The gitlab of metabarcoding.org provides up-to-date information and #' The gitlab of metabarcoding.org provides up-to-date information and
#' forums for bug reports. #' forums for bug reports.
......
...@@ -111,8 +111,8 @@ robitaxid <- function(x, check_against=NULL, verbose = TRUE) { ...@@ -111,8 +111,8 @@ robitaxid <- function(x, check_against=NULL, verbose = TRUE) {
#' @return a \code{robitaxid} instance #' @return a \code{robitaxid} instance
#' #'
#' @examples #' @examples
#' x <- robitaxid(c("A","B","C")) #' x <- robitaxid(c(1,2,2759))
#' as_robitaxid(x) #' is_robitaxid(x)
#' #'
#' @author Eric Coissac <eric.coissac@metabarcoding.org> #' @author Eric Coissac <eric.coissac@metabarcoding.org>
#' @export #' @export
...@@ -171,9 +171,28 @@ pillar_shaft.robitaxid <- function(x, ...) { ...@@ -171,9 +171,28 @@ pillar_shaft.robitaxid <- function(x, ...) {
pillar::new_pillar_shaft_simple(out, align = "right") pillar::new_pillar_shaft_simple(out, align = "right")
} }
#' @details For \code{\link[ROBITools2]{robitaxid}}, is no reference taxonomy
#' are attached to an instance, then the ROBITools2 default taxonomy
#' is returned.
#'
#' @seealso \code{\link[ROBITools2]{get_default_taxonomy}},
#' \code{\link[ROBITools2]{set_default_taxonomy}}.
#'
#' @rdname reference_taxonomy
#' @export
#'
#' @examples
#'
#' x <- robitaxid(c(1,2,2759))
#' reference_taxonomy(x)
#'
reference_taxonomy.robitaxid = function(object) {
ref <- attr(object,"reference_taxonomy")
if (is.null(ref)) get_default_taxonomy() else ref
}
######################### #########################
# #
# robitaxid_forward # robitaxid_master
# #
######################### #########################
...@@ -331,3 +350,5 @@ as_robitaxonomy.robilca <- function(object) { ...@@ -331,3 +350,5 @@ as_robitaxonomy.robilca <- function(object) {
} }
.The_default_taxonomy = new.env(parent = emptyenv())
#' @export
set_default_taxonomy <- function(taxonomy) {
.The_default_taxonomy$taxonomy <- taxonomy
invisible(taxonomy)
}
#' @export
get_default_taxonomy <- function() {
.The_default_taxonomy$taxonomy
}
\ No newline at end of file
...@@ -10,10 +10,14 @@ NULL ...@@ -10,10 +10,14 @@ NULL
#' robiobjects including taxonomy can be linked to a reference taxonomy. #' robiobjects including taxonomy can be linked to a reference taxonomy.
#' This method return this taxonomy. #' This method return this taxonomy.
#' #'
#' @param object the interrogated object.
#'
#' @return a robitaxonomy instance.
#'
#' @author Eric Coissac #' @author Eric Coissac
#' @export #' @export
reference_taxonomy = function(taxonomy) { reference_taxonomy = function(object) {
UseMethod("reference_taxonomy", taxonomy) UseMethod("reference_taxonomy", object)
} }
#' @author Eric Coissac #' @author Eric Coissac
......
...@@ -52,7 +52,7 @@ is_robitaxonomy = function(object) { ...@@ -52,7 +52,7 @@ is_robitaxonomy = function(object) {
.robitaxonomy <- R6Class("robitaxonomy",lock_objects = FALSE, .robitaxonomy <- R6Class("robitaxonomy",
public = list( public = list(
nodes = NULL, nodes = NULL,
...@@ -358,9 +358,9 @@ lowest_common_ancestor.robitaxonomy <- function(taxonomy, ...@@ -358,9 +358,9 @@ lowest_common_ancestor.robitaxonomy <- function(taxonomy,
#' @rdname reference_taxonomy #' @rdname reference_taxonomy
#' @export #' @export
reference_taxonomy.robitaxonomy = function(taxonomy) { reference_taxonomy.robitaxonomy = function(object) {
ref <- taxonomy$reference_taxonomy ref <- object$reference_taxonomy
if (is.null(ref)) taxonomy else ref if (is.null(ref)) object else ref
} }
#' @rdname alternative_names #' @rdname alternative_names
...@@ -415,4 +415,15 @@ full_taxonomy.robitaxonomy = function(taxonomy) { ...@@ -415,4 +415,15 @@ full_taxonomy.robitaxonomy = function(taxonomy) {
reference_taxonomy = NULL) reference_taxonomy = NULL)
} }
#' @export
write_robitaxonomy <- function(taxonomy, file) {
save(taxonomy,file = file)
invisible(taxonomy)
}
#' @export
read_robitaxonomy <- function(file) {
get(load(file))
}
...@@ -17,4 +17,4 @@ StripTrailingWhitespace: Yes ...@@ -17,4 +17,4 @@ StripTrailingWhitespace: Yes
BuildType: Package BuildType: Package
PackageUseDevtools: Yes PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette PackageRoxygenize: rd,collate,namespace
...@@ -8,13 +8,10 @@ ...@@ -8,13 +8,10 @@
Provides tools to help in the analysing of DNA metabarcoding data. Provides tools to help in the analysing of DNA metabarcoding data.
} }
\details{ \details{
The functions in the ProcMod package aims to estimate and to test correlation More about what it does (maybe more than one line)
between matrices, correcting for the spurious correlations because of the Use four spaces when indenting paragraphs within the Description.
over-fitting effect.
over-fitting effect. The ROBITools2 package is developed on the metabarcoding.org gitlab
The ProcMod package is developed on the metabarcoding.org gitlab
(https://git.metabarcoding.org/obitools/ROBITools2.git). (https://git.metabarcoding.org/obitools/ROBITools2.git).
The gitlab of metabarcoding.org provides up-to-date information and The gitlab of metabarcoding.org provides up-to-date information and
forums for bug reports. forums for bug reports.
......
...@@ -34,8 +34,8 @@ a \code{robitaxid} instance ...@@ -34,8 +34,8 @@ a \code{robitaxid} instance
Converts an object to a \code{robitaxid} instance Converts an object to a \code{robitaxid} instance
} }
\examples{ \examples{
x <- robitaxid(c("A","B","C")) x <- robitaxid(c(1,2,2759))
as_robitaxid(x) is_robitaxid(x)
} }
\author{ \author{
......
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/robitaxid.R, R/taxonomy_methods.R, % Please edit documentation in R/robitaxid.R, R/taxonomy_methods.R,
% R/taxonomy_robi.R % R/taxonomy_robi.R
\name{reference_taxonomy.robilca} \name{reference_taxonomy.robitaxid}
\alias{reference_taxonomy.robitaxid}
\alias{reference_taxonomy.robilca} \alias{reference_taxonomy.robilca}
\alias{reference_taxonomy} \alias{reference_taxonomy}
\alias{reference_taxonomy.robitaxonomy} \alias{reference_taxonomy.robitaxonomy}
\title{Returns the reference taxonomy of an object} \title{Returns the reference taxonomy of an object}
\usage{ \usage{
\method{reference_taxonomy}{robitaxid}(object)
\method{reference_taxonomy}{robilca}(taxonomy) \method{reference_taxonomy}{robilca}(taxonomy)
reference_taxonomy(taxonomy) reference_taxonomy(object)
\method{reference_taxonomy}{robitaxonomy}(taxonomy) \method{reference_taxonomy}{robitaxonomy}(object)
}
\arguments{
\item{object}{the interrogated object.}
}
\value{
a robitaxonomy instance.
} }
\description{ \description{
robiobjects including taxonomy can be linked to a reference taxonomy. robiobjects including taxonomy can be linked to a reference taxonomy.
This method return this taxonomy. This method return this taxonomy.
} }
\details{
For \code{\link[ROBITools2]{robitaxid}}, is no reference taxonomy
are attached to an instance, then the ROBITools2 default taxonomy
is returned.
}
\examples{
x <- robitaxid(c(1,2,2759))
reference_taxonomy(x)
}
\seealso{
\code{\link[ROBITools2]{get_default_taxonomy}},
\code{\link[ROBITools2]{set_default_taxonomy}}.
}
\author{ \author{
Eric Coissac Eric Coissac
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
\alias{robiuniqueid} \alias{robiuniqueid}
\title{Build a \code{robiuniqueid} instance} \title{Build a \code{robiuniqueid} instance}
\usage{ \usage{
robiuniqueid(x, make_unique = TRUE, sep = "_", verbose = TRUE) robiuniqueid(x, make_unique = TRUE, sep = "_", verbose = is_robi_verbose())
} }
\arguments{ \arguments{
\item{x}{an object coercible to a \code{charactere}} \item{x}{an object coercible to a \code{charactere}}
......
ROBITools2.so
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment