Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd `calc_prop_samples` #233
Comments
|
done |
|
Hi Zachary, |
|
Hi @olar785, thanks for the report. Did you use the |
…s` is used without `cols`. relates to #233
|
Thanks for your quick reply.
I did use the cols option. Here is what I did:
taxmap_18S$data$propS = calc_prop_samples(taxmap_18S, "tax_abund",
cols = taxmap_18S$data$sample_data$sample_id,
groups = taxmap_18S$data$sample_data$Sample_type,
other_cols= TRUE)
However, if I use the compare_groups() functions with the same parameters I get the results I expect. In this case for example, I can see that the Cnidaria phylum is much more present in the water samples than in the sediment ones:
taxmap_18S$data$diff_table <- compare_groups(taxmap_18S, "tax_abund",
cols = taxmap_18S$data$sample_data$sample_id,
groups = taxmap_18S$data$sample_data$Sample_type)
I have attached my data below.
Thanks
… On 30/01/2019, at 8:03 AM, Zachary Foster ***@***.***> wrote:
Hi @olar785 <https://github.com/olar785>, thanks for the report. Did you use the cols options to specify the columns to use? Something like that might happen if you don't use the cols option and the numeric columns in the table are in a different order than the sample type given to the groups option. Perhaps I should add a warning about that. If you did use the cols option (and it was in the same order as the values given to the group option), then it sounds like a bug. If that is the case, can you send me you data and code? Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#233 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ATdp7XN7rpGUR9tsVIKyLRpipAcezwDnks5vId5agaJpZM4T5F99>.
|
|
Ok, I will look into it. I don't see your attachment though. Perhaps you need to attach it on Github rather than via email? Thanks |
|
You can also email it to me directly at "zacharyfoster1989@gmail.com" if you would rather it not be posted on github |
…tly in some data sets when the `groups` option was used. relates to #233
|
Hi @olar785, it was a bug and I think it is fixed now. I did not notice it before because it only effects some datasets when the devtools::install_github("grunwaldlab/metacoder")
Thanks again for the report! |
|
Hi Zachary,
I removed the metacoder package and tried to reinstall it with devtools::install_github(“grunwaldlab/metacoder”) but I get the following error:
Error: package or namespace load failed for ‘metacoder’ in namespaceExport(ns, exports):
undefined exports: edge_shape_functions, node_shape_functions
I don’t if it’s an issue stemming from my configuration or something else though.
… On 30/01/2019, at 1:17 PM, Zachary Foster ***@***.***> wrote:
Hi @olar785 <https://github.com/olar785>, it was a bug and I think it is fixed now. I did not notice it before because it only effects some datasets when the groups option is used and the bug did not affect my test data set. Try installing the development version and let me know if it works for you:
devtools::install_github("grunwaldlab/metacoder")
> taxmap_18S <- readRDS("~/Downloads/taxmap_18S.rds")
>
> hand_res <- lapply(unique(taxmap_18S$data$sample_data$Sample_type), function(site) {
+ site_ids <- taxmap_18S$data$sample_data$sample_id[taxmap_18S$data$sample_data$Sample_type == site]
+ site_data <- taxmap_18S$data$tax_abund[site_ids]
+ hand_res <- apply(MARGIN = 1, site_data, function(x) sum(x > 0) / length(x))
+ })
> names(hand_res) <- unique(taxmap_18S$data$sample_data$Sample_type)
> hand_res <- tibble::as_tibble(hand_res)
>
> res <- calc_prop_samples(taxmap_18S, "tax_abund", cols = taxmap_18S$data$sample_data$sample_id, groups = taxmap_18S$data$sample_data$Sample_type, other_cols= TRUE)
Calculating the proportion of samples with a value greater than 0 for 219 columns in 3 groups for 556 observations
Warning message:
The following columns will be replaced in the output:
N-1, N-10, N-11, N-12, N-13, N-14, N-15, N-16, N-17, N-18, N-19, N-2 ... S-216, S-219, S-230, S-241, S-306, S-46, S-48, S-54, S-56, S-87, S-98
>
> all(res[,-1] == hand_res)
[1] TRUE
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#233 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ATdp7atrnUZVmMOP70OPKDC3L6_O69Usks5vIigSgaJpZM4T5F99>.
|
|
Sorry about that @olar785, I was working on the development branch when I made that bug fix to the master branch and did not rebuild the namespace after switching branches to commit the bug fix on master, so there were references in the namespace to functions that did not exist in master. It should be working now. At least it works for me now. |
|
Works like a charm, thank you! |
|
no problem! |
This would be like
calc_n_samplesexcept it would return the proportion of samples in each group with greater than some number of reads.