Commit 39c6bf35 authored by Eric Coissac's avatar Eric Coissac

change the type of the rpath columns to int

parent 200bef73
......@@ -7,3 +7,4 @@ Bison-gh.uniq.fasta
*.so
*.fasta.*
*.ngsfilter
man_md
......@@ -242,15 +242,13 @@ read_ncbi_taxdump <- function(file = .NCBIURL,
if (file.exists(file) &&
str_ends(file, pattern = "\\.(tar|tar\\.gz|tgz)")) {
if (verbose)
message("Untaring the taxonomy taxdump... ")
robimessage("Untaring the taxonomy taxdump... ")
directory <- .untar_ncbi_taxdump(file,
verbose = verbose)
}
else if (str_starts(file, "(https?|ftp)://")) {
if (verbose)
message("Downloading the taxonomy from NCBI web site... ")
robimessage("Downloading the taxonomy from NCBI web site... ")
directory <- download_ncbi_taxdump(file,
verbose = verbose)
......@@ -260,64 +258,59 @@ read_ncbi_taxdump <- function(file = .NCBIURL,
}
if (verbose)
message("Reading the taxonomy tree... ")
robimessage("Reading the taxonomy tree... ")
nodes <- .read_ncbi_nodes_dump(directory,
file = nodes_dump)
if (verbose)
message("Done.")
robimessage("Done.")
if (verbose)
message("Reading the taxon names... ")
robimessage("Reading the taxon names... ")
names <- .read_ncbi_names_dump(directory,
file = name_dump)
if (verbose)
message("Done.")
robimessage("Done.")
if (to_be_cleaned)
unlink(directory,recursive = TRUE)
if (verbose)
message("Indexing scientific names... ",appendLF = FALSE)
robimessage("Indexing scientific names... ")
suppressWarnings(names %>%
dplyr::filter(name_class == "scientific name") %>%
dplyr::right_join(nodes, by = "taxid")) %>%
dplyr::mutate(taxid = new_robitaxid_master(taxid),
parent = new_robitaxid(parent)) %>%
dplyr::select(taxid,
rank,
scientific_name=name,
parent) -> taxonomy
suppressWarnings(names %>%
dplyr::filter(name_class == "scientific name") %>%
dplyr::right_join(nodes, by = "taxid")) %>%
dplyr::mutate(taxid = new_robitaxid_master(taxid),
parent = new_robitaxid(parent)) %>%
dplyr::select(taxid,
rank,
scientific_name=name,
parent) -> taxonomy
if (verbose)
message("Done.")
robimessage("Done.")
if (verbose)
message("Indexing parent taxids... ",appendLF = FALSE)
robimessage("Indexing parent taxids... ")
o <- order(nodes$taxid)
names(o) <- nodes$taxid
relparent <- o[as.character(nodes$parent)]
if (verbose)
message("Done.")
robimessage("Done.")
if (verbose)
message("Computing path... ",appendLF = FALSE)
paths <- lapply(.Call("R_compute_taxonomic_path",
nodes$taxid,nodes$rank,relparent),
function(p) lapply(p,new_robiobject,
class = "robipath"))
robimessage("Computing path... ")
if (verbose)
message("Done.")
paths <- .Call("R_compute_taxonomic_path",
data$taxid,
data$rank,
data$parent_idx)
paths <- list(path = lapply(paths[[1]],new_robiobject,
class = "robipath"),
rpath = paths[[2]])
robimessage("Done.")
taxonomy$path <- paths[[1]]
taxonomy$rpath <- paths[[2]]
......
......@@ -120,10 +120,14 @@ read_obitools_taxonomy <- function(taxoname,
message("Computing path... ",appendLF = FALSE)
paths <- lapply(.Call("R_compute_taxonomic_path",
data$taxid,data$rank,data$parent_idx),
function(p) lapply(p,new_robiobject,
class = "robipath"))
paths <- .Call("R_compute_taxonomic_path",
data$taxid,
data$rank,
data$parent_idx)
paths <- list(path = lapply(paths[[1]],new_robiobject,
class = "robipath"),
rpath = paths[[2]])
if (verbose)
......
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