R Under development (unstable) (2024-04-27 r86487 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(ClassDiscovery) Loading required package: cluster Loading required package: oompaBase > suppressWarnings( RNGversion("3.5.3") ) > set.seed(587677) > # simulate data from three different sample groups > d1 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE) > d2 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE) > d3 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE) > dd <- cbind(d1, d2, d3) > kind <- factor(rep(c('red', 'green', 'blue'), each=10)) > > # prepare the Mosaic object > m <- Mosaic(dd, sampleMetric='pearson', geneMetric='spearman', center=TRUE, usecor=TRUE) > summary(m) My mosaic, an object of the Mosaic class. Call: Mosaic(data = dd, sampleMetric = "pearson", geneMetric = "spearman", usecor = TRUE, center = TRUE) Sample dendrogram constructed with "average" linkage and "pearson" distance metric. Gene dendrogram constructed with "average" linkage and "spearman" distance metric. > > # The default plot with red-green color map > plot(m, col=redgreen(64)) > > # change to a blue-yellow color map, and mark the four top splits in the sample > # direction with a color bar along the top > plot(m, col=blueyellow(128), sampleClasses=4, + sampleColors=c('red', 'green', 'blue', 'black')) > > # This time, mark the three classes that we know are there > plot(m, col=blueyellow(128), sampleClasses=kind, + sampleColors=c('red', 'green', 'blue')) > > plot(m, col=blueyellow(128), geneClasses=3, geneColors=c('red', 'green', 'black')) > > # In addition, mark the top 5 splits in the gene dendrogram > plot(m, col=blueyellow(128), + sampleClasses=kind, sampleColors=c('red', 'green', 'black'), + geneClasses=5, geneColors=c('cyan', 'magenta', 'royalblue', 'darkgreen', 'orange')) > > # plot the sample dendrogram by itself > cols <- as.character(kind) > pltree(m, labels=1:30, colors=cols) > > # cleanup > rm(d1, d2, d3, dd, kind, cols, m) > > proc.time() user system elapsed 0.67 0.09 0.75