Last data update: 2014.03.03

R: Build consensus tree out of bootstrap cluster result
consensusR Documentation

Build consensus tree out of bootstrap cluster result

Description

This is the function to build the consensus tree from the bootstrap clustering analysis. If the clustering algorithm is hierarchical clustering, the majority rule consensus tree will be built based on the given significance level. If the clustering algorithm is K-means, a consensus K-means group will be built.

Usage

consensus(macluster, level = 0.8, draw=TRUE)

Arguments

macluster

An object of class macluster, which is the output of macluster

.

level

The significance level for the consensus tree. This is a numeric number between 0.5 and 1.

draw

A logical value to indicate whether to draw the consensus tree on screen or not.

Value

An object of class consensus.hc or consensus.kmean according to the clustering method.

Author(s)

Hao Wu

See Also

macluster

Examples

# load data
data(abf1)
## Not run: 
# fit the anova model
fit.fix = fitmaanova(abf1,formula = ~Strain)
# test Strain effect 
test.fix = matest(abf1, fit.fix, term="Strain",n.perm= 1000)
# pick significant genes - pick the genes selected by Fs test
idx <- volcano(test.fix)$idx.Fs
# do k-means cluster on genes
gene.cluster <- macluster(fit.fix, term="Strain", idx, what="gene", 
   method="kmean", kmean.ngroups=5, n.perm=100)
# get the consensus group
genegroup = consensus(gene.cluster, 0.5)
# get the gene names belonging to each group
genegroupname = genegroup$groupname

# HC cluster on samples
sample.cluster <- macluster(fit.fix, term="Strain", idx, what="sample",method="hc")
# get the consensus group
consensus(sample.cluster, 0.5)

## End(Not run)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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(maanova)

Attaching package: 'maanova'

The following object is masked from 'package:base':

    norm

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/maanova/consensus.Rd_%03d_medium.png", width=480, height=480)
> ### Name: consensus
> ### Title: Build consensus tree out of bootstrap cluster result
> ### Aliases: consensus
> ### Keywords: cluster
> 
> ### ** Examples
> 
> # load data
> data(abf1)
> ## Not run: 
> ##D # fit the anova model
> ##D fit.fix = fitmaanova(abf1,formula = ~Strain)
> ##D # test Strain effect 
> ##D test.fix = matest(abf1, fit.fix, term="Strain",n.perm= 1000)
> ##D # pick significant genes - pick the genes selected by Fs test
> ##D idx <- volcano(test.fix)$idx.Fs
> ##D # do k-means cluster on genes
> ##D gene.cluster <- macluster(fit.fix, term="Strain", idx, what="gene", 
> ##D    method="kmean", kmean.ngroups=5, n.perm=100)
> ##D # get the consensus group
> ##D genegroup = consensus(gene.cluster, 0.5)
> ##D # get the gene names belonging to each group
> ##D genegroupname = genegroup$groupname
> ##D 
> ##D # HC cluster on samples
> ##D sample.cluster <- macluster(fit.fix, term="Strain", idx, what="sample",method="hc")
> ##D # get the consensus group
> ##D consensus(sample.cluster, 0.5)
> ## End(Not run)
> 
> 
> 
> 
> dev.off()
null device 
          1 
>