... | ... | @@ -204,8 +204,8 @@ First, let's load the necessary libraries: |
|
|
Before we create our phyloseq object, we can import some metadata about our samples, e.g. sample type, fraction etc.
|
|
|
|
|
|
```plaintext
|
|
|
> sample_metadata <- read.table("sample_metadata.csv", header=TRUE, sep="\t", stringsAsFactors=FALSE)
|
|
|
> rownames(sample_metadata) <- sample_metadata$Sample
|
|
|
> sample_metadata <- read.table("sample_metadata.csv", header=TRUE, sep=",", stringsAsFactors=FALSE)
|
|
|
> rownames(sample_metadata) <- sample_metadata$Sample_name
|
|
|
> View(sample_metadata)
|
|
|
```
|
|
|
|
... | ... | @@ -308,7 +308,7 @@ Let's repeat the family level barplot with this filtered dataset |
|
|
> marmic_filtered_family_barplot <- plot_bar(phyloseq_genus_abundant, fill="Family") +
|
|
|
```
|
|
|
|
|
|
facet_grid(\~Sample_group, scales="free_x") + guides(fill=guide_legend(ncol=1)) + labs(y="Relative abundance", x="Sample") + theme_bw() + theme(axis.title.x = element_text(size=12,face="bold",colour="black"), axis.title.y = element_text(size=12,face="bold",colour="black"), axis.text.x = element_text(size=10, colour="black", angle=45, hjust=1), legend.title = element_text(size=12,face="bold",colour="black"), strip.background.x = element_rect(fill="white"), strip.text.x = element_text(size=11,face="bold",colour="black")) > marmic_filtered_family_barplot
|
|
|
facet_grid(<span dir="">\~</span>Sample_group, scales="free_x") + guides(fill=guide_legend(ncol=1)) + labs(y="Relative abundance", x="Sample") + theme_bw() + theme(axis.title.x = element_text(size=12,face="bold",colour="black"), axis.title.y = element_text(size=12,face="bold",colour="black"), axis.text.x = element_text(size=10, colour="black", angle=45, hjust=1), legend.title = element_text(size=12,face="bold",colour="black"), strip.background.x = element_rect(fill="white"), strip.text.x = element_text(size=11,face="bold",colour="black")) > marmic_filtered_family_barplot
|
|
|
|
|
|
This looks much better, but it is hard to distinguish between some of the colours and also we should rearrange the sample order.
|
|
|
|
... | ... | |