blekhmanlab / biomehorizon

Plot microbiome time series in parallel
Other
24 stars 2 forks source link

Error when following tutorial with example data #10

Open Abbie-Williams opened 3 years ago

Abbie-Williams commented 3 years ago

Hi,

Congratulations on the awesome package - I'm really enjoying playing around with it and definitely planning to use it for some of my data. I was attempting to recreate the horizon plots which plotted a single taxon across multiple subjects. I couldn't recreate this in my own data as I kept getting the error message (see below):

Error in prepanel(otudata = otu, metadata = metadata, singleVarOTU = "taxon 1", : metadata must have the same number of samples for each subject to perform single OTU analysis

In my metadata, I have the same number of samples for each subject I listed, and I double checked this. I switched over to the example data and followed the tutorial, but I still got this same error message even with the example data. Everything else prior to this code has worked fine, and I can generate stacked horizon plots for different taxa within a single subject. This seems a really great feature that I'm planning to use, but I'm unsure how to resolve this error.

isaacfink21 commented 3 years ago

Hi @Abbie-Williams,

Thank you for this! I'm able to generate the plot using the code from the tutorial without any issues - could you try entering these commands into your console and let me know what it outputs?

library(biomehorizon)
library(dplyr)

## Subset the data set to the subjects who were sampled on all 17 days, and arrange by date
metadata_17 <- metadatasample_diet %>%
  filter(subject %in% c("MCTs08","MCTs18","MCTs23","MCTs26","MCTs33","MCTs36")) %>%
  arrange(subject, collection_date)

otu_17 <- otusample_diet %>%
  select(taxon_id, as.character((metadatasample_diet %>% filter(subject %in% c("MCTs08","MCTs18","MCTs23","MCTs26","MCTs33","MCTs36")))$sample))

## Single variable analysis with "Taxon 1"
paramList <- prepanel(otudata = otu_17, metadata = metadata_17, singleVarOTU = "taxon 1", subj =        
    c("MCTs08","MCTs18","MCTs23","MCTs26","MCTs36","MCTs33"))

horizonplot(paramList)