Closed gaworj closed 7 months ago
hmm I can't see an obvious problem
to troubleshoot, I would remove every piece probably not related to the problem to try and isolate where this is going wrong
e.g. for the plotting itself try only one method of sample annotation at a time, does one work, and one not? or both don't work?
psq %>%
tax_transform("compositional", rank = "Class") %>%
comp_heatmap(
sample_anno = sampleAnnotation(
State1 = anno_sample(var = "Description"),
col = list(State1 = cols), border = FALSE
)
)
psq %>%
tax_transform("compositional", rank = "Class") %>%
comp_heatmap(
sample_anno = sampleAnnotation(
State2 = anno_sample_cat("Description", col = cols)
)
)
in addition, what version of ComplexHeatmap do you have installed?
Hello,
I got back to my code in the fresh session in R. After checking packages versions I found that ComplexHeatmap package was not loaded.. Initially thought that it was loaded directly with microViz. There is no mention about loading it directly in the microViz manual, but of course, it is said to load phyloseq + microViz. It looks like I messed up yesterday with the packages loading. When I loaded microViz + phyloseq everything works as described.
Thank you for your time.
Bests, Jan
thanks for the additional information Jan, glad it's now working for you :)
Hi,
Thank you very much for such great tool. Now my stacked barplots look wonderful.
I have encountered a problem during annotated heatmap construction.
Tried to replicate "annotating samples" section: https://david-barnett.github.io/microViz/articles/web-only/heatmaps.html
using my own dataset from Qiime2 and such error appeared:
psq %>% tax_transform("compositional", rank = "Class") %>% comp_heatmap( tax_anno = taxAnnotation( Prev. = anno_tax_prev(bar_width = 0.3, size = grid::unit(1, "cm")) ), sample_anno = sampleAnnotation( State1 = anno_sample(var = "Description"), col = list(State1 = cols), border = FALSE, State2 = anno_sample_cat("Description", col = cols) ) ) Error in sample_anno(.data = data, .samples = samples, .side = sample_side) : all arguments must be either:
Here is what I did before:
library(qiime2R) physeq <- qza_to_phyloseq("table.qza", "rooted-tree.qza", "taxonomy.qza","sample-metadata.tsv")
library(microViz)
psq <- physeq %>% tax_mutate(Species = NULL) %>% tax_filter(min_prevalence = 5) %>% tax_fix(unknowns = c("uncultured"))
psq phyloseq-class experiment-level object otu_table() OTU Table: [ 24 taxa and 6 samples ] sample_data() Sample Data: [ 6 samples by 12 sample variables ] tax_table() Taxonomy Table: [ 24 taxa by 6 taxonomic ranks ] phy_tree() Phylogenetic Tree: [ 24 tips and 23 internal nodes ]
cols <- distinct_palette(n = 2, add = NA) names(cols) <- unique(samdat_tbl(physeq)$Description)
My samplesheet is simple:
sample_data(psq) Sample Data: [6 samples by 12 sample variables]: BarcodeSequence LinkerPrimerSequence Site Year Month Day Age Subject KM1 KM1 2024 2 14
KM2 KM2 2024 2 14
KM4 KM4 2024 2 14
KM5 KM5 2024 2 14
KM6 KM6 2024 2 14
KMT3 KMT3 2024 2 14
ReportedAntibioticUsage DaysSinceExperimentStart Description sample.type KM1 NA group-I KM1 KM2 NA group-I KM2 KM4 NA group-II KM4 KM5 NA group-II KM5 KM6 NA group-II KM6 KMT3 NA group-I KMT3
When I tried the demo data everything works fine. Do I need to manually specify sample category? Any other hints?
Bests, Jan