Commit b16a0f39 authored by Eric Coissac's avatar Eric Coissac

Upadate on the taxonomy

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