Hi @jbisanz,
I have some trouble with the following script as it gives me an error which I searched online but could not rectify it. Do you have some time to look into it?
Thank you,
metadata <- read_q2metadata("qiime2/metadata.tsv")
SVs <- read_qza("table-with-no-mt-no-chlp.qza")$data
taxonomy <- read_qza("qiime2/taxonomy-single-end.qza")
SVs <- apply(SVs, 2, function(x) x/sum(x)*100)
SVsToPlot <- data.frame(MeanAbundance=rowMeans(SVs)) %>%
- rownames_to_column("Feature.ID") %>%
- arrange(desc(MeanAbundance)) %>%
- top_n(30, MeanAbundance) %>%
- pull(Feature.ID)
SVs %>%
- as.data.frame()%>%
- rownames_to_column("Feature.ID") %>%
- gather(-Feature.ID, key="SampleID", value = "Abundance") %>%
- mutate(Feature.ID=if_else(Feature.ID %in% SVsToPlot, Feature.ID, "Remainder")) %>%
- group_by(SampleID, Feature.ID) %>%
- summarize(Abundance=sum(Abundance)) %>%
- left_join(metadata) %>%
- mutate(NormAbundance=log10(Abundance+0.01)) %>%
- left_join(taxonomy) %>%
- mutate(Feature=paste(Feature.ID, Taxon)) %>%
- mutate(Feature=gsub("[kpcofgs__", "", Feature)) %>%
- ggplot(aes(x=SampleID, y=Feature, fill= NormAbundance))+
- geom_tile()+
- facet_grid(~
category
, scales = "free-x") + - theme_q2r() +
- theme(axis.text.x = element_text(angle = 45, hjust=1)) +
- scale_fill_viridis_c(name= "log10(% Abundance)")
summarise()
regrouping output by 'SampleID' (override with.groups
argument)
Joining, by = "SampleID"
Error:x
andy
must share the same src, setcopy
= TRUE (may be slow).
Runrlang::last_error()
to see where the error occurred.
rlang::last_error()
<error/rlang_error>
x
andy
must share the same src, setcopy
= TRUE (may be slow).
Backtrace:
- base::as.data.frame(.)
- tibble::rownames_to_column(., "Feature.ID")
- tidyr::gather(., -Feature.ID, key = "SampleID", value = "Abundance")
- dplyr::mutate(...)
- dplyr::group_by(., SampleID, Feature.ID)
- dplyr::summarize(., Abundance = sum(Abundance))
- dplyr::left_join(., metadata)
- dplyr::mutate(., NormAbundance = log10(Abundance + 0.01))
- dplyr::left_join(., taxonomy)
- dplyr::auto_copy(x, y, copy = copy)
- dplyr:::glubort(...)
Runrlang::last_trace()
to see the full context.
rlang::last_trace()
<error/rlang_error>
x
andy
must share the same src, setcopy
= TRUE (may be slow).
Backtrace:
ā
- āā
%>%
(...) - āābase::withVisible(eval(quote(
_fseq
(_lhs
)), env, env)) - āābase::eval(quote(
_fseq
(_lhs
)), env, env) -
āābase::eval(quote(`_fseq`(`_lhs`)), env, env)
-
āā`_fseq`(`_lhs`)
-
āāmagrittr::freduce(value, `_function_list`)
-
āāfunction_list[[i]](value)
-
āādplyr::left_join(., taxonomy)
-
āādplyr:::left_join.data.frame(., taxonomy)
-
āādplyr::auto_copy(x, y, copy = copy)
-
āādplyr:::glubort(...)