ropensci / chromer

package for interacting with the chromosome counts database (CCDB) at https://taux.evolseq.net/CCDB_web/
https://docs.ropensci.org/chromer
Other
12 stars 4 forks source link

Erro when using summarize_counts #31

Closed RANSHOSHANI closed 2 years ago

RANSHOSHANI commented 4 years ago

hi, i've tried to use the summarize_counts function but got the following error: Input must be a vector, not a tbl_df/tbl/data.frame/chrom.counts object.

Backtrace:

  1. chromer::summarize_counts(res)
    1. vctrs:::stop_scalar_type(...)
    2. vctrs:::stop_vctrs(msg, "vctrs_error_scalar_type", actual = x)

the code I was trying to run was:

ploidy <- chrom_counts (taxa = 'Allium_thunbergii', rank = 'species') sum <- chromer::summarize_counts (ploidy)

Im using the latest version from Github and using R version 4.0.2.

Thank you for your help

orchid00 commented 4 years ago

Hi @RANSHOSHANI Apologies for the late reply, I do maintenance in my free time as volunteer, and I've been very busy lately.

It seems that the method we were using for the summary is now obsolete with the new dplyr version.

I am unable to test an older version at the moment, so I am not sure what it was returning before. But I think I got what you need.

Can you tell me if this is something you were expecting?

using your ploidy object which has 17 rows, if we do a summary of the counts per species and Gametophyc and sporophytic

library(tidyverse)

ploidy %>% count(resolved_binomial, gametophytic, sporophytic)
# A tibble: 7 x 4
  resolved_binomial                gametophytic           sporophytic      n
  <chr>                            <chr>                  <chr>        <int>
1 Allium_thunbergii                ""                     "32"             1
2 Allium_thunbergii                "13, 14,15, 16,17, 18" ""               1
3 Allium_thunbergii                 NA                    "16"            10
4 Allium_thunbergii                 NA                    "16,32+2,3B"     1
5 Allium_thunbergii                 NA                    "32"             1
6 Allium_thunbergii                 NA                    "32+0-1B"        1
7 Allium_thunbergii_var._deltoides  NA                    "16"             2

Or maybe you only need the counts per species

library(tidyverse)
ploidy %>% count(resolved_binomial)
# A tibble: 2 x 2
  resolved_binomial                    n
  <chr>                            <int>
1 Allium_thunbergii                   15
2 Allium_thunbergii_var._deltoides     2

Can you please provide feedback and let me know if this is what you need and what you will prefer as result of the summarize_counts, so I will update the package and you will call the function as before.

RANSHOSHANI commented 4 years ago

Hi thank you for the reply.

I actually already managed to summarize the results myself so its okey.

if you are interested, I was looking for the second option with count for species.

Thank you

orchid00 commented 4 years ago

thanks @RANSHOSHANI for the feedback. I will implement it. (I'm leaving this issue open for now.) i'm glad you were able to do the summary.

jamie-thompson commented 3 years ago

Hi, I'm having the same problem, how can I use the summarize_counts function?

kbroman commented 2 years ago

I believe this is now fixed.