Hi andres.firrincieli, can I draw your attention for an isuue I am facing? I am following the tutorial you have provided. I am here at the "a stacked barplot for the class level" of the tutorial. I accordingly used the codes as in tutorial:
# melt to long format (for ggploting)
# prune out phyla below 1% in each sample
# selecting the taxa at the level: Phylum
mdata_class <- mouse_data %>%
tax_glom(taxrank = "Class") %>% # agglomerate at phylum level
transform_sample_counts(function(x) {x/sum(x)} ) %>% # Transform to rel. abundance
psmelt() %>% # Melt to long format
filter(Abundance > 0.01) %>% # Filter out low abundance taxa
arrange(Class) # Sort data frame alphabetically by phylum
str(mdata_class)
And the expected outcome supposed be like:
## 'data.frame': 77 obs. of 10 variables:
## $ OTU : chr "Otu0059" "Otu0010" "Otu0010" "Otu0010" ...
## $ Sample : chr "F3D142" "F3D144" "F3D3" "F3D6" ...
## $ Abundance : num 0.0119 0.0949 0.0765 0.0747 0.0734 ...
## $ group : Factor w/ 19 levels "F3D0","F3D1",..: 4 6 14 16 11 7 9 2 4 18 ...
## $ dpw : int 142 144 3 6 149 145 147 1 142 8 ...
## $ time : chr "late" "late" "early" "early" ...
## $ body_weight: num 40.2 41.6 15.5 20.5 40.6 ...
## $ Kingdom : Factor w/ 1 level "Bacteria": 1 1 1 1 1 1 1 1 1 1 ...
## $ Phylum : Factor w/ 9 levels "Actinobacteria",..: 1 5 5 5 5 5 5 5 5 5 ...
## $ Class : Factor w/ 15 levels "Actinobacteria",..: 1 2 2 2 2 2 2 2 2 2 ...
Here clearly number of different kingdom, phylums, classes is shown which is 1, 9, 15 respectively. But in my dataset I am using the same code, but the output doesn't show number of different classes. As a result I am unable to use colours for them:
str(mdata_phylum)
'data.frame': 37 obs. of 9 variables:
$ OTU : chr "Otu00009" "Otu00009" "Otu00009" "Otu00009" ...
$ Sample : chr "DRR046797" "DRR046803" "DRR046802" "DRR046805" ...
$ Abundance : num 0.1336 0.1205 0.0908 0.0899 0.0893 ...
$ sample : chr "DRR046797" "DRR046803" "DRR046802" "DRR046805" ...
$ type : chr "control" "obese" "obese" "obese" ...
$ time : chr "early" "late" "late" "early" ...
$ bodyweight: num 20 45 45 78 40 45 45 45 32 45 ...
$ Kingdom : chr "k__Bacteria" "k__Bacteria" "k__Bacteria" "k__Bacteria" ...
$ Phylum : chr "p__Actinobacteria" "p__Actinobacteria" "p__Actinobacteria" "p__Actinobacteria" ...
Can you please help me out?
Thanks and Regards, DC7
Hi DC,
here is a tutorial on how to build a
phyloseqobject from mothur files.Hope this helps!
Thanks andres!!! Can you please help me with this error? I have imported mothur files with these codes:
But, after
head(phyloseq), I am getting the following ERROR:Thanks and Regards, DC7
you can't use
head()on a S4 object. To inspect the OTU table simply useotu_table(physeq). For the taxonomytax_table(physeq).Source