dcat4 / ensembleTax

source R package
Other
6 stars 3 forks source link

names' attribute error #2

Closed MCK-sketch closed 1 year ago

MCK-sketch commented 1 year ago

Hi, I am following your ensembleTax overview vignette, but using my data. I am getting stuck on the "ensembleTax pre-processing" step. Can you provide some advice on why I might be getting these problems? Thanks,

"idtax.silva.pretty" seems to work fine, but I get the following errors for the others steps.

bayes.pr2.pretty2 <- bayestax2df(t12p,

  • db = "pr2",
  • ranks = NULL,
  • boot = 50,
  • rubric = rubric,
  • return.conf = FALSE) Error in names(x) <- value : 'names' attribute [8] must be the same length as the vector [1]

bayes.silva.pretty <- bayestax2df(taxa_p_silva,

  • db = "silva",
  • ranks = NULL,
  • boot = 50,
  • rubric = rubric,
  • return.conf = FALSE) Error in names(x) <- value : 'names' attribute [6] must be the same length as the vector [1]

idtax.pr2.pretty <- idtax2df(idp,

  • db = "pr2",
  • ranks = NULL,
  • boot = 50,
  • rubric = rubric,
  • return.conf = FALSE) Error in names(x) <- value : 'names' attribute [8] must be the same length as the vector [6] In addition: Warning messages: 1: In matrix(unlist(taxonomy), nrow = notu, byrow = TRUE) : data length [49324] is not a sub-multiple or multiple of the number of rows [7351] 2: In matrix(unlist(conf), nrow = notu, byrow = TRUE) : data length [49324] is not a sub-multiple or multiple of the number of rows [7351]
dcat4 commented 1 year ago

What version of pr2 are you using? ensembleTax supports PR2 4.14.0. There was a pretty substantial restructuring of their nomenclature in v5.0.0. I would like to update to support more current database releases but that could be weeks away.

One workaround for now is to follow this vignette for using a "custom" database: https://github.com/dcat4/ensembleTax/blob/master/add_tax_dbs.md

MCK-sketch commented 1 year ago

Thanks for your quick reply. I have tried pr2 v5.0.0, v4.12, and v4.13. I will try v4.14 and the workaround.

MCK-sketch commented 1 year ago

Hi, quick update - I tried using pr2 v4.14 and got this error

idtax.pr2.pretty <- idtax2df(ids_p14,

  • db = "pr2",
  • ranks = NULL,
  • boot = 50,
  • rubric = rubric,
  • return.conf = FALSE) Error in names(x) <- value : 'names' attribute [8] must be the same length as the vector [6] In addition: Warning messages: 1: In matrix(unlist(taxonomy), nrow = notu, byrow = TRUE) : data length [50066] is not a sub-multiple or multiple of the number of rows [7351] 2: In matrix(unlist(conf), nrow = notu, byrow = TRUE) : data length [50066] is not a sub-multiple or multiple of the number of rows [7351]
dcat4 commented 1 year ago

What are the dimensions of "ids_p14"?

i.e. nrow(ids_p14) and ncol(ids_p14)

dcat4 commented 1 year ago

Oops scratch that. I forgot idtax returns a list.

It looks like your input "ids_p14" does not have the appropriate number of taxonomic ranks. It should have 8 if it was run again pr2 4.14, and idtax introduces a "root" rank. It appears you have 6. Are you sure you haven't manipulated it and that it's the output from PR2?

If you want to attach a subset of these data I'm happy to look more closely.

dcat4 commented 1 year ago

Assuming this solved your issue, closing now. Please re-open if this problem persists.