Skip to content
antagomir edited this page Apr 5, 2015 · 70 revisions

Clustering

Density
Hierarchical clustering
Heatmaps
Interactive motionchart
Histograms, Clusters

Data projections

Project high-dimensional data on two-dimensional plane by various methods including PCA, MDS, Sammons mapping etc. (for visualization purposes; see help(project.data) for details):

library(microbiome, quietly = TRUE)
data.directory <- system.file("extdata", package = "microbiome")
genus.matrix.log10.simulated <- read.profiling(level = "L2", method = "frpa", 
			              data.dir = data.directory, log10 = TRUE)

# Note: transpose the data matrix into samples x features
proj <- project.data(t(genus.matrix.log10.simulated), type = "MDS.nonmetric")
## initial  value 15.632295 
## iter   5 value 12.895757
## iter  10 value 11.421017
## iter  15 value 11.072375
## iter  15 value 11.064577
## iter  20 value 10.139051
## iter  25 value 9.781502
## final  value 9.705087 
## converged
# Plot the projection
library(ggplot2); 
theme_set(theme_bw(15))
ggplot(aes(x = Comp.1, y = Comp.2), data = proj) + geom_point()

plot of chunk visu-example

Plot the projection with sample names:

ggplot(aes(x = Comp.1, y = Comp.2, label = rownames(proj)), data = proj) + geom_text()

plot of chunk visu-example2

Plotting trends

Plot subject age versus phylotype abundance with smoothed confidence intervals:

library(microbiome)
N <- 250
df <- data.frame(age = sort(runif(N, 0, 100)), hitchip = rnorm(N))
p <- vwReg(hitchip~age, df, shade = TRUE, mweight = TRUE, verbose = FALSE)
## Error in eval(expr, envir, enclos): could not find function "vwReg"
p <- p + xlab("Age (y)") + ylab("HITChip Signal") 
## Error in p + xlab("Age (y)"): non-numeric argument to binary operator
print(p)
## NULL

Visualization utilities

  • theme_bottom_border: ggplot2 theme

Version information

sessionInfo()
## R version 3.1.2 (2014-10-31)
## Platform: x86_64-pc-linux-gnu (64-bit)
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] ggplot2_1.0.0        microbiome_0.99.38   AnnotationDbi_1.28.1
##  [4] GenomeInfoDb_1.2.4   IRanges_2.0.1        S4Vectors_0.4.0     
##  [7] Biobase_2.26.0       BiocGenerics_0.12.1  RSQLite_1.0.0       
## [10] DBI_0.3.1            reshape_0.8.5        vegan_2.2-1         
## [13] lattice_0.20-30      permute_0.8-3        e1071_1.6-4         
## [16] knitr_1.9           
## 
## loaded via a namespace (and not attached):
##  [1] acepack_1.3-3.3       ade4_1.6-2            boot_1.3-15          
##  [4] class_7.3-12          cluster_2.0.1         codetools_0.2-11     
##  [7] colorspace_1.2-6      devtools_1.7.0        df2json_0.0.2        
## [10] digest_0.6.8          doParallel_1.0.8      dynamicTreeCut_1.62  
## [13] earlywarnings_1.1.19  evaluate_0.5.5        fastcluster_1.1.16   
## [16] fields_8.2-1          foreach_1.4.2         foreign_0.8-63       
## [19] formatR_1.0           Formula_1.2-0         GO.db_3.0.0          
## [22] grid_3.1.2            gtable_0.1.2          Hmisc_3.15-0         
## [25] igraph_0.7.1          impute_1.40.0         iterators_1.0.7      
## [28] Kendall_2.2           KernSmooth_2.23-14    labeling_0.3         
## [31] latticeExtra_0.6-26   lmtest_0.9-33         maps_2.3-9           
## [34] maptree_1.4-7         MASS_7.3-39           Matrix_1.1-5         
## [37] matrixStats_0.14.0    mgcv_1.8-5            mixOmics_5.0-3       
## [40] moments_0.14          munsell_0.4.2         nlme_3.1-120         
## [43] nnet_7.3-9            nortest_1.0-3         pheatmap_1.0.2       
## [46] plyr_1.8.1            preprocessCore_1.28.0 proto_0.3-10         
## [49] quadprog_1.5-5        RColorBrewer_1.1-2    Rcpp_0.11.5          
## [52] reshape2_1.4.1        RGCCA_2.0             rgl_0.95.1201        
## [55] rjson_0.2.15          rpart_4.1-9           scales_0.2.4         
## [58] som_0.3-5             spam_1.0-1            splines_3.1.2        
## [61] stringr_0.6.2         survival_2.38-1       tgp_2.4-11           
## [64] tools_3.1.2           tseries_0.10-34       WGCNA_1.43           
## [67] zoo_1.7-11

Clone this wiki locally