I have used Q2 a lot lately and I want to use some features of Phyloseq illustration in R now but I have very often a problem with the code names used by Q2 that looks like "2ec862esddlr88965a8855d665er2245" which is not helping for the analysis.
I am wondering whether during my exportation of Q2 object to Phyloseq object I can do something about it so I won't get these ugly name ;-)!
That will tell us all the columns of the R data.frame(), and one of those columns should be an informative taxonomy name like Phylum, and we can pass that column name to ggplot.
I think we are really close to solving it...
Colin
P.S. I've put your code inside of a code block. They're cool
Thanks for your reply… I know I am not at the perfect forum for this type of question… I was afraid I would be blocked
So here is the output :
OTU Sample Abundance ATB_VEHICULE Group_ATB Timepoint Num_mice SameMice2Timepoints Group_mice
71 62d492efc804b7f173b5286cffca8603 MS35 0.8745698 ATB Long D10 70 YES ABLong_D10
59 62d492efc804b7f173b5286cffca8603 MS32 0.8688360 ATB Short D10 40 YES ABShort_D10
94 9c79cbb243d988ebe749b6d2753696ed MS1 0.8471313 VEHICULE None D_Bef24 A NO Ctrl_Dbef24
55 62d492efc804b7f173b5286cffca8603 MS31 0.8471070 ATB Short D10 38 YES ABShort_D10
130 9c79cbb243d988ebe749b6d2753696ed MS7 0.8447736 VEHICULE None D_Bef24 G NO Ctrl_Dbef24
120 9c79cbb243d988ebe749b6d2753696ed MS3 0.8400406 VEHICULE None D_Bef24 C NO Ctrl_Dbef24
Group_Timepoint accurate_group Kingdom Phylum
71 D10_Abx 5_D10_Abx D_0__Bacteria D_1__Proteobacteria
59 D10_Abx 5_D10_Abx D_0__Bacteria D_1__Proteobacteria
94 D0_no_Abx 1_D-24_no_abx D_0__Bacteria D_1__Bacteroidetes
55 D10_Abx 5_D10_Abx D_0__Bacteria D_1__Proteobacteria
130 D0_no_Abx 1_D-24_no_abx D_0__Bacteria D_1__Bacteroidetes
120 D0_no_Abx 1_D-24_no_abx D_0__Bacteria D_1__Bacteroidetes
So yes there is indeed the “Phylum” column… but sorry I don’t know how to put the right wording to replace the “ugly” name by the phylum in the figure !!!
Thank you for your help.
Ok ok ! I am back... your suggestion was enough to put me on the right track!
I feel ashamed that I did not think about that
I just have to change OTU for Phylum... da!
Many thanks Colin !
Here's how ggplot works:
ggplot maps metadata columns, to aesthetics using the aes() function.
Note that Group_Timepoint, Abundance, and OTU are all columns in your dataframe.
aes(x = Group_Timepoint, position on the x axis
y = Abundance, position on the y axis
OTU = color of each point
But you can map these out any way that you want! Try this
So basically I've replaced OTU with Phylum, so that it uses the data in the other column.
Why are the sizes different? Did you notice I snuck in size = Abundance to the aes() function? You should probably take that out... but you can also edit the other settings too!