Replies: 2 comments
-
Hey there, did you manage to handle this "NAs not allowed in distance matrix" in your work? I am having this same issue... |
Beta Was this translation helpful? Give feedback.
-
This is probably arising because the cor_heatmap function by default sorts the heatmap rows and columns using a distance-based seriation method. The underlying issue that makes this a problem is likely that some of your metadata to microbe correlations are NA (probably due to underlying missings in your metadata!) You could find out which metadata variables are the problem either by inspecting them directly in the sample data slot of the phyloseq object, or probably also conveniently by disabling the sorting of the correlations heatmap with seriation_method = "Identity" as an argument to cor_heatmap hope this helps |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm not an R expert and have been struggling to get a spearman correlation heatmap from my microbiome + immune data for ages.
I was excited to see MicroViz and hope to get it to work for me. I have a few questions which I really hope someone can help me with.
I get a lot of errors about "NAs not allowed in distance matrix" I think this is because in my metadata I have some samples which were not able to be analyzed and so have an empty cell for some immune measures. They aren't zero values, just missing :( how do I handle these?
I was following the great tutorial for MicroViz and I just wanted to confirm that before you use the cor_heatmap function you should transform your microbiome data first (i.e., CLR). I was aiming to do something like this to get my cor_heatmap
`
PS_clr <- phyloseq_object%>%
tax_agg(rank = "Family") %>%
tax_transform(trans = "clr", zero_replace = "halfmin", chain = TRUE)
##corr heatmap
PS_clr %>%
cor_heatmap(
taxa = tax_top(ps_log10, 15, by = max, rank = "Family"),
cor = "spearman"
)`
Thank you :)
Beta Was this translation helpful? Give feedback.
All reactions