PC-ORD Non-metric Multidimensional Scaling and Correlations
- Imported Main Matrix “MM” sheet from “PCORD_only_Base.xlsx”
- Imported Environmental “EM” sheet from “PCORD_only_Base.xlsx”
- Ran analysis: Ordination|NMS|autopilot/Slow & thorough
- Took about 20 min. No option to “Graph Ordination”.
- Graphed NMS Scree Plot. Not exactly sure what this represents.
- Ran another analysis: Ordination|NMS|autopilot/Medium
- Graphed NMS Scree Plot again. No visible changes.
- Graphed 2D ordination: Graph|2D. Does not appear to be same as graph in demo with Dr. Lamendella which had an issue with outliers. (There is a way to delete outliers in PC-ORD. Look at the manual)
- Ran Pearson & Kendall Correlations with Ordination Axes: (in Graph window) Statistics|Correlations with Second Matrix. Nothing seems to be strongly correlated.
Heatmaps using R
- This is a quick tutorial to heatmaps. http://flowingdata.com/2010/01/21/how-to-make-a-heatmap-a-quick-and-easy-solution/
- This is a cool tutorial replicating a heatmap found in a published article. http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/heatmap/
- This shows a way to insert a color key with the heatmap using “heatmap.2” function. http://enotacoes.wordpress.com/2007/11/16/easy-guide-to-drawing-heat-maps-to-pdf-with-r-with-color-key/
- This shows the different enhanced heatmap options http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/gplots/html/heatmap.2.html
Install specific packages to plot enhanced heatmaps.
install.packages("gplots")
install.packages("RColorBrewer")
library(RColorBrewer)
library(gplots)
Save .xls as .csv. Read .csv into R.
dietdata = read.csv("c:/moni_files/Dropbox/Lamendella/analysis/OTUforR.csv",
header=TRUE,row.names=1, colClasses="character",comment="", sep=",")
Created a heatmap using first 50 patients reads and first 50 OTUS
d3 = dietdata[1:50,1:50]
d3matrix = data.matrix(d3)
d3_heatmap = heatmap.2(d3matrix,Rowv=NA,
Colv=NA, scale="column", trace="none", col=redgreen(75), xlab="patient", ylab="OTU")
Created a heatmap with a dendrogram and color key.
Export file:
png(filename="your/file/location/name.png")
heatmap.2(d3matrix,Rowv=NA,Colv=NA, scale="column", trace="none", col=redgreen(75), xlab="patient", ylab="OTU")
dev.off()
Things to figure out
- How to graph the output from a “Slow & Thorough” Ordination Analysis
- What exactly is the dendrogram representing? Edit. Apply to OTU.
- Group patients by visit.
- Change patient codes.
- Add bar to represent the different visits similar to the bar for clustering the patients in (http://genomebiology.com/2004/5/10/r80/figure/F2)
- Change settings so that it can show all or most of the the OTUs
Later down the road…
- Indicator Species Analysis
- Network Analysis & Cytoscape
- Procrustes Analysis
Pingback: from OTU table to HEATMAP! | Learning Omics