By Angus Ball

Welcome to this super short intro to RPCA! First load your data

filepulling <- "C:\\Users\\angus\\OneDrive - UNBC\\Angus Ball\\Lab work\\Bioinformatics\\Kenzies Data\\physeq_Key.rds" #add your file location here
physeq_Key <- readRDS(file = filepulling)

Then load the package we’ll need

library(MicrobiotaProcess)
library(phyloseq)

Where do you want to save the graphs we make?

savelocation <- "Graphs\\Kenzie\\PCA_Location_rclr.pdf"

Then lets run the code!

pca_physeq <- get_pca(obj=physeq_Key, method="rclr") #This gets the distances needed for the PCA, using the robust clr method
ggordpoint(obj=pca_physeq, #your object
           biplot=TRUE, speciesannot=TRUE, #This is kinda confusing but together they add OTU labels to some directions on the PCA plot
           factorNames=c("Amd"), #This tells the program how visually format your samples, see the squares circles, and colours
           ellipse=TRUE) #shows the ellipses around the data showing where 90% of samples of that type lie on the graph

          #and many more!!! read the ggordpoint documentation for a bunch of other formatting and display options

Then save your graph!

ggsave(savelocation) #save the image to your plot!

On the axis is the two most important principle components. These aren’t necessarily specific things like pH and are more just aspects of the data represented by distance scores, but things like OTU’s can be correlated to to the axis. The axis also have percentages attached. These percentages represent the percentage of variance represented by each PC axis. Samples can have positive abundances (literally positive compared to the zero), or negative abundances (lower than the zero line) as related via the distance matrix to whatever the PC axis reflect. Within this dataset we see three specific groups form. (Red and brown), blue, and then green! This makes sense within the study as red and brown both have municipal compost in them!. Eitherway enjoy your RPCA plots!

LS0tDQp0aXRsZTogIlIgTm90ZWJvb2siDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KQnkgQW5ndXMgQmFsbA0KDQpXZWxjb21lIHRvIHRoaXMgc3VwZXIgc2hvcnQgaW50cm8gdG8gUlBDQSEgDQpGaXJzdCBsb2FkIHlvdXIgZGF0YQ0KYGBge3J9DQpmaWxlcHVsbGluZyA8LSAiQzpcXFVzZXJzXFxhbmd1c1xcT25lRHJpdmUgLSBVTkJDXFxBbmd1cyBCYWxsXFxMYWIgd29ya1xcQmlvaW5mb3JtYXRpY3NcX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