Description Details Value Author(s) References See Also Examples
Computate Generalized Minimum Distance (GMD) between discrete distributions and clustering tools
Package: | GMD |
Type: | Package |
License: | GPL (>= 2) |
This package contains:
1) modules and functions for GMD computation, with GMD algorithm implemented in C to interface with R.
2) related clustering and visualization tools for distributions.
An overview of functions
Function | Description |
ghist | Generalized Histogram Computation and Visualization |
gdist | Generalized Distance Matrix Computation |
css | Computing Clustering Sum-of-Squares and |
evaluating the clustering by the “elbow” method | |
heatmap.3 | Enhanced Heatmap Representation with Dendrogram and Partition |
gmdp | Computation of GMD on a pair of histograms |
gmdm | Computation of GMD Matrix on a set of histograms |
## To install from online repositories (e.g. CRAN) install.packages(pkgs="GMD", repos="http://cran.r-project.org")
## Sometimes the offical repository might not be up to date, then ## you may install it from a downloaded source file; please replace ## '<current-version>' with actual version numbers: Note that as ## new versions are release, the '<current-version>' changes. install.packages(pkgs="GMD_<current-version>.tar.gz", repos=NULL)
## Load the package and get a complete list of functions, use library(GMD) ls("package:GMD")
## help documantation of the package help(GMD) # this page
NULL
Xiaobei Zhao and Albin Sandelin
Maintainer: Xiaobei Zhao xiaobei (at) binf.ku.dk
Zhao et al (2011),
"Systematic Clustering of Transcription Start Site Landscapes",
PLoS ONE 6(8): e23409.
http://dx.plos.org/10.1371/journal.pone.0023409
See citation("GMD")
for BibTeX entries for LaTeX users.
gmdp
, gmdm
, cage
, chipseq
, ghist
,
gdist
, css
, elbow
, heatmap.3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
require(GMD) # load GMD
help(GMD) # a help document of GMD
data(package="GMD") # a list of datasets available in GMD
ls("package:GMD") # a list of functions available in GMD
help(package="GMD") # help documentation on GMD
citation("GMD") # citation for publications
demo("GMD-demo") # run the demo
## view GMD Description
packageDescription("GMD")
## view GMD vignette
vignette("GMD-vignette",package="GMD")
## End(Not run)
|
GMD-package package:GMD R Documentation
_T_h_e _P_a_c_k_a_g_e _f_o_r _G_e_n_e_r_a_l_i_z_e_d _M_i_n_i_m_u_m _D_i_s_t_a_n_c_e (_G_M_D) _C_o_m_p_u_t_a_t_i_o_n
_D_e_s_c_r_i_p_t_i_o_n:
Computate Generalized Minimum Distance (GMD) between discrete
distributions and clustering tools
_D_e_t_a_i_l_s:
Package: GMD
Type: Package
License: GPL (>= 2)
This package contains:
1) modules and functions for GMD computation, with GMD algorithm
implemented in C to interface with R.
2) related clustering and visualization tools for distributions.
An overview of functions
Function Description
'ghist' Generalized Histogram Computation and Visualization
'gdist' Generalized Distance Matrix Computation
'css' Computing Clustering Sum-of-Squares and
evaluating the clustering by the _``elbow''_ method
'heatmap.3' Enhanced Heatmap Representation with Dendrogram and Partition
'gmdp' Computation of GMD on a pair of histograms
'gmdm' Computation of GMD Matrix on a set of histograms
## To install from online repositories (e.g. CRAN)
install.packages(pkgs="GMD", repos="http://cran.r-project.org")
## Sometimes the offical repository might not be up to date, then
## you may install it from a downloaded source file; please
replace ## '<current-version>' with actual version numbers: Note
that as ## new versions are release, the '<current-version>'
changes. install.packages(pkgs="GMD_<current-version>.tar.gz",
repos=NULL)
## Load the package and get a complete list of functions, use
library(GMD) ls("package:GMD")
## help documantation of the package help(GMD) # this page
_V_a_l_u_e:
'NULL'
_A_u_t_h_o_r(_s):
Xiaobei Zhao and Albin Sandelin
Maintainer: Xiaobei Zhao <email: xiaobei (at) binf.ku.dk>
_R_e_f_e_r_e_n_c_e_s:
Zhao et al (2011), "Systematic Clustering of Transcription Start
Site Landscapes", _PLoS ONE_ *6*(8): e23409.
<URL: http://dx.plos.org/10.1371/journal.pone.0023409>
See 'citation("GMD")' for BibTeX entries for LaTeX users.
_S_e_e _A_l_s_o:
'gmdp', 'gmdm', 'cage', 'chipseq', 'ghist', 'gdist', 'css',
'elbow', 'heatmap.3'
_E_x_a_m_p_l_e_s:
## Not run:
require(GMD) # load GMD
help(GMD) # a help document of GMD
data(package="GMD") # a list of datasets available in GMD
ls("package:GMD") # a list of functions available in GMD
help(package="GMD") # help documentation on GMD
citation("GMD") # citation for publications
demo("GMD-demo") # run the demo
## view GMD Description
packageDescription("GMD")
## view GMD vignette
vignette("GMD-vignette",package="GMD")
## End(Not run)
Data sets in package 'GMD':
cage CAGE Data: Transcription Start Site
Distributions (TSSDs) by CAGE tags
cagel CAGE Data: Transcription Start Site
Distributions (TSSDs) by CAGE tags
chipseq_hCD4T ChIP-seq data: ChIP-seq Enrichment around TSSs
chipseq_mES ChIP-seq data: ChIP-seq Enrichment around TSSs
[1] "as.ghist" "as.mhist" "bedgraph.to.depth"
[4] "css" "css.hclust" "elbow"
[7] "elbow.batch" "equalize.list" "gbreaks"
[10] "gdist" "ghist" "gmdm"
[13] "gmdm2dist" "gmdm_dist" "gmdp"
[16] "heatmap.3" "is.dist" "is.ghist"
[19] "is.mhist" "mhist.summary" "mhist2matrix"
[22] "plot.elbow" "plot.gmdm" "plot.gmdp"
[25] "plot.mhist" "plot.mhist.summary" "print.gmdm"
[28] "print.gmdp" "summary.gmdp"
Information on package 'GMD'
Description:
Package: GMD
Type: Package
Version: 0.3.3
Date: 2014-08-26 15:46:45 EDT
Title: Generalized Minimum Distance of distributions
Description: GMD is a package for non-parametric distance
measurement between two discrete frequency
distributions.
License: GPL (>= 2)
LazyLoad: TRUE
NeedsCompilation: no
URL: http://CRAN.R-project.org/package=GMD
Repository: CRAN
Depends: R (>= 3.1.0)
Imports: stats, grDevices, gplots
Suggests: datasets, MASS, cluster
Collate: 'GMD-package.R' 'imports.R' 'util.R'
'GMD-internal.R' 'GMD-data.R' 'ghist.R' 'gdist.R'
'css.R' 'heatmap3.R' 'gmdp.R' 'gmdm.R'
Authors@R: c( person("Xiaobei", "Zhao",
email="xiaobei@binf.ku.dk", role=c("aut", "cre",
"cph")), person("Albin", "Sandelin",
email="albin@binf.ku.dk", role=c("aut")) )
Maintainer: Xiaobei Zhao <xiaobei@binf.ku.dk>
Packaged: 2014-08-27 12:02:34 UTC; xiaobei
Author: Xiaobei Zhao [aut, cre, cph], Albin Sandelin [aut]
Date/Publication: 2014-08-27 14:29:53
Built: R 3.4.0; x86_64-pc-linux-gnu; "Thu, 04 May 2017
08:34:43 +0000"; unix
Index:
GMD-package The Package for Generalized Minimum Distance
(GMD) Computation
bedgraph.to.depth Convert a BedGraph fiel to a vector of
depth-like signals
cage CAGE Data: Transcription Start Site
Distributions (TSSDs) by CAGE tags
chipseq ChIP-seq data: ChIP-seq Enrichment around TSSs
css Clustering Sum-of-Squares for clustering
evaluation
elbow The "Elbow" Method for Clustering Evaluation
equalize.list Make members of a list equal size
gdist Generalized Distance Matrix Computation
get.sep Get row or column lines of separation for
heatmap.3
ghist Generalized Histogram Computation
gmdm Generalized Minimum Distance Matrix
gmdp Generalized Minimum Distance between a pair of
distributions
heatmap.3 Enhanced Heatmap Representation with Dendrogram
and Partition
legend Add Legends to Plots
mhist.summary Bin-wise summary of histograms
plot.gmdm S3 method for class 'gmdm'
plot.gmdp Plot function for class gmdp
plot.mhist S3 method for class 'mhist'.
ts2df Convert time series to data frame
Further information is available in the following vignettes in
directory '/usr/lib/R/site-library/GMD/doc':
GMD-data-processing: GMD - Measure Similarity between Histone
Modifications (source, pdf)
GMD-vignette: GMD: Generalized Minimum Distance of distributions
(source, pdf)
To cite the GMD package in publications use:
Zhao et al (2011), Systematic Clustering of Transcription Start Site
Landscapes, PLoS ONE 6(8): e23409.
Also please use the following citation:
Zhao, Xiaobei and Sandelin, Albin. GMD: Generalized Minimum Distance
of distributions. R package. 2014.
http://CRAN.R-project.org/package=GMD
To see these entries in BibTeX format, use 'print(<citation>,
bibtex=TRUE)', 'toBibtex(.)', or set
'options(citation.bibtex.max=999)'.
demo(GMD-demo)
---- ~~~~~~~~
> require(GMD)
> example("ghist",package="GMD")
ghist> ## load library
ghist> require("GMD")
ghist> ## create two normally-distributed samples
ghist> ## with unequal means and unequal variances
ghist> set.seed(2012)
ghist> v1 <- rnorm(1000,mean=-5, sd=10)
ghist> v2 <- rnorm(1000,mean=10, sd=5)
ghist> ## create common bins
ghist> n <- 20 # desired number of bins
ghist> breaks <- gbreaks(c(v1,v2),n) # bin boundaries
ghist> x <-
ghist+ list(ghist(v1,breaks=breaks,digits=0),
ghist+ ghist(v2,breaks=breaks,digits=0))
ghist> mhist.obj <- as.mhist(x)
> example("plot.mhist",package="GMD")
plt.mh> ## load library
plt.mh> require("GMD")
plt.mh> ## create two normally-distributed samples
plt.mh> ## with unequal means and unequal variances
plt.mh> set.seed(2012)
plt.mh> v1 <- rnorm(1000,mean=-5, sd=10)
plt.mh> v2 <- rnorm(1000,mean=10, sd=5)
plt.mh> ## create common bins
plt.mh> n <- 20 # desired number of bins
plt.mh> breaks <- gbreaks(c(v1,v2),n) # bin boundaries
plt.mh> x <-
plt.mh+ list(ghist(v1,breaks=breaks,digits=0),
plt.mh+ ghist(v2,breaks=breaks,digits=0))
plt.mh> mhist.obj <- as.mhist(x)
plt.mh> ## plot histograms side-by-side
plt.mh> plot(mhist.obj,mar=c(1.5,1,1,0),
plt.mh+ main="Histograms of simulated normal distributions")
plt.mh> ## plot histograms as subplots,
plt.mh> ## with corresponding bins aligned
plt.mh> plot(mhist.obj,beside=FALSE,mar=c(1.5,1,1,0),
plt.mh+ main="Histograms of simulated normal distributions")
> example("gdist",package="GMD")
gdist> ## load library
gdist> require("GMD")
gdist> require(cluster)
Loading required package: cluster
gdist> ## compute distance using Euclidean metric (default)
gdist> data(ruspini)
gdist> x <- gdist(ruspini)
gdist> ## see a dendrogram result by hierarchical clustering
gdist> dev.new(width=12, height=6)
gdist> plot(hclust(x),
gdist+ main="Cluster Dendrogram of Ruspini data",
gdist+ xlab="Observations")
gdist> ## convert to a distance matrix
gdist> m <- as.matrix(x)
gdist> ## convert from a distance matrix
gdist> d <- as.dist(m)
gdist> stopifnot(d == x)
gdist> ## Use correlations between variables "as distance"
gdist> data(USJudgeRatings)
gdist> dd <- gdist(x=USJudgeRatings,method="correlation.of.variables")
gdist> dev.new(width=12, height=6)
dev.new(): using pdf(file="Rplots1.pdf")
gdist> plot(hclust(dd),
gdist+ main="Cluster Dendrogram of USJudgeRatings data",
gdist+ xlab="Variables")
> example("elbow",package="GMD")
elbow> ## load library
elbow> require("GMD")
elbow> ## simulate data around 12 points in Euclidean space
elbow> pointv <- data.frame(x=c(1,2,2,4,4,5,5,6,7,8,9,9),
elbow+ y=c(1,2,8,2,4,4,5,9,9,8,1,9))
elbow> set.seed(2012)
elbow> mydata <- c()
elbow> for (i in 1:nrow(pointv)){
elbow+ mydata <- rbind(mydata,cbind(rnorm(10,pointv[i,1],0.1),
elbow+ rnorm(10,pointv[i,2],0.1)))
elbow+ }
elbow> mydata <- data.frame(mydata); colnames(mydata) <- c("x","y")
elbow> plot(mydata,type="p",pch=21, main="Simulated data")
elbow> ## determine a "good" k using elbow
elbow> dist.obj <- dist(mydata[,1:2])
elbow> hclust.obj <- hclust(dist.obj)
elbow> css.obj <- css.hclust(dist.obj,hclust.obj)
elbow> elbow.obj <- elbow.batch(css.obj)
elbow> print(elbow.obj)
$k
[1] 7
$ev
[1] 0.9795881
$inc.thres
[1] 0.01
$ev.thres
[1] 0.95
attr(,"description")
[1] "A \"good\" k=7 (EV=0.98) is detected when the EV is no less than 0.95\nand the increment of EV is no more than 0.01 for a bigger k.\n"
attr(,"class")
[1] "elbow" "list"
elbow> ## make partition given the "good" k
elbow> k <- elbow.obj$k; cutree.obj <- cutree(hclust.obj,k=k)
elbow> mydata$cluster <- cutree.obj
elbow> ## draw a elbow plot and label the data
elbow> dev.new(width=12, height=6)
dev.new(): using pdf(file="Rplots2.pdf")
elbow> par(mfcol=c(1,2),mar=c(4,5,3,3),omi=c(0.75,0,0,0))
elbow> plot(mydata$x,mydata$y,pch=as.character(mydata$cluster),
elbow+ col=mydata$cluster,cex=0.75,main="Clusters of simulated data")
elbow> plot(css.obj,elbow.obj,if.plot.new=FALSE)
elbow> ## clustering with more relaxed thresholds (, resulting a smaller "good" k)
elbow> elbow.obj2 <- elbow.batch(css.obj,ev.thres=0.90,inc.thres=0.05)
elbow> mydata$cluster2 <- cutree(hclust.obj,k=elbow.obj2$k)
elbow> dev.new(width=12, height=6)
dev.new(): using pdf(file="Rplots3.pdf")
elbow> par(mfcol=c(1,2), mar=c(4,5,3,3),omi=c(0.75,0,0,0))
elbow> plot(mydata$x,mydata$y,pch=as.character(mydata$cluster2),
elbow+ col=mydata$cluster2,cex=0.75,main="Clusters of simulated data")
elbow> plot(css.obj,elbow.obj2,if.plot.new=FALSE)
> example("heatmap.3",package="GMD")
htmp.3> ## ------------------------------------------------------------------------
htmp.3> ## Example1: mtcars
htmp.3> ## ------------------------------------------------------------------------
htmp.3> ## load library
htmp.3> require("GMD")
htmp.3> ## load data
htmp.3> data(mtcars)
htmp.3> ## heatmap on raw data
htmp.3> x <- as.matrix(mtcars)
htmp.3> dev.new(width=10,height=8)
dev.new(): using pdf(file="Rplots4.pdf")
htmp.3> heatmap.3(x) # default, with reordering and dendrogram
1.dim(x): 32 11
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 32 11
Scaling ... 3.dim(x): 32 11
Making color breaks ... 4.dim(x): 32 11
[1] "kr=2,kc=2"
5.dim(x): 32 11
Plotting ... revC: FALSE , revR: FALSE
5b.dim(x): 32 11
5c.dim(x): 32 11
scale: none
5d.dim(x): 11 32
6.dim(x): 11 32
7.dim(x): 11 32
8.dim(x): 11 32
DONE!
htmp.3> ## Not run:
htmp.3> ##D heatmap.3(x, Rowv=FALSE, Colv=FALSE) # no reordering and no dendrogram
htmp.3> ##D heatmap.3(x, dendrogram="none") # reordering without dendrogram
htmp.3> ##D heatmap.3(x, dendrogram="row") # row dendrogram with row (and col) reordering
htmp.3> ##D heatmap.3(x, dendrogram="row", Colv=FALSE) # row dendrogram with only row reordering
htmp.3> ##D heatmap.3(x, dendrogram="col") # col dendrogram
htmp.3> ##D heatmap.3(x, dendrogram="col", Rowv=FALSE) # col dendrogram with only col reordering
htmp.3> ##D heatmapOut <-
htmp.3> ##D heatmap.3(x, scale="column") # sacled by column
htmp.3> ##D names(heatmapOut) # view the list that is returned
htmp.3> ##D heatmap.3(x, scale="column", x.center=0) # colors centered around 0
htmp.3> ##D heatmap.3(x, scale="column",trace="column") # trun "trace" on
htmp.3> ## End(Not run)
htmp.3>
htmp.3> ## coloring cars (row observations) by brand
htmp.3> brands <- sapply(rownames(x), function(e) strsplit(e," ")[[1]][1])
htmp.3> names(brands) <- c()
htmp.3> brands.index <- as.numeric(as.factor(brands))
htmp.3> RowIndividualColors <- rainbow(max(brands.index))[brands.index]
htmp.3> heatmap.3(x, scale="column", RowIndividualColors=RowIndividualColors)
1.dim(x): 32 11
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 32 11
Scaling ... 3.dim(x): 32 11
Making color breaks ... 4.dim(x): 32 11
[1] "kr=2,kc=2"
5.dim(x): 32 11
Plotting ... revC: FALSE , revR: FALSE
5b.dim(x): 32 11
5c.dim(x): 32 11
scale: column
5d.dim(x): 11 32
6.dim(x): 11 32
7.dim(x): 11 32
8.dim(x): 11 32
DONE!
htmp.3> ## coloring attributes (column features) randomly (just for a test :)
htmp.3> heatmap.3(x, scale="column", ColIndividualColors=rainbow(ncol(x)))
1.dim(x): 32 11
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 32 11
Scaling ... 3.dim(x): 32 11
Making color breaks ... 4.dim(x): 32 11
[1] "kr=2,kc=2"
5.dim(x): 32 11
Plotting ... revC: FALSE , revR: FALSE
5b.dim(x): 32 11
5c.dim(x): 32 11
scale: column
5d.dim(x): 11 32
6.dim(x): 11 32
7.dim(x): 11 32
8.dim(x): 11 32
DONE!
htmp.3> ## add a single plot for all row individuals
htmp.3> dev.new(width=12,height=8)
dev.new(): using pdf(file="Rplots5.pdf")
htmp.3> expr1 <- list(quote(plot(row.data[rowInd,"hp"],1:nrow(row.data),
htmp.3+ xlab="hp",ylab="",yaxt="n",main="Gross horsepower")),
htmp.3+ quote(axis(2,1:nrow(row.data),rownames(row.data)[rowInd],las=2)))
htmp.3> heatmap.3(x, scale="column", plot.row.individuals=TRUE, row.data=x,
htmp.3+ plot.row.individuals.list=list(expr1))
1.dim(x): 32 11
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 32 11
Scaling ... 3.dim(x): 32 11
Making color breaks ... 4.dim(x): 32 11
[1] "kr=2,kc=2"
5.dim(x): 32 11
Plotting ... revC: FALSE , revR: FALSE
5b.dim(x): 32 11
5c.dim(x): 32 11
scale: column
5d.dim(x): 11 32
6.dim(x): 11 32
7.dim(x): 11 32
8.dim(x): 11 32
DONE!
htmp.3> ## ------------------------------------------------------------------------
htmp.3> ## Example2: ruspini
htmp.3> ## ------------------------------------------------------------------------
htmp.3> ## load library
htmp.3> require("GMD")
htmp.3> require(cluster)
htmp.3> ## load data
htmp.3> data(ruspini)
htmp.3> ## heatmap on a `dist' object
htmp.3> x <- gdist(ruspini)
htmp.3> main <- "Heatmap of Ruspini data"
htmp.3> dev.new(width=10,height=10)
dev.new(): using pdf(file="Rplots6.pdf")
htmp.3> heatmap.3(x, main=main, mapratio=1) # with a title and a map in square!
1.dim(x): 75 75
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 75 75
Scaling ... 3.dim(x): 75 75
Making color breaks ... 4.dim(x): 75 75
[1] "kr=2,kc=2"
5.dim(x): 75 75
Plotting ... revC: FALSE , revR: FALSE
5b.dim(x): 75 75
5c.dim(x): 75 75
scale: none
5d.dim(x): 75 75
6.dim(x): 75 75
7.dim(x): 75 75
8.dim(x): 75 75
DONE!
htmp.3> ## Not run:
htmp.3> ##D heatmap.3(x, main=main, revC=TRUE) # reverse column for a symmetric look
htmp.3> ##D heatmap.3(x, main=main, kr=2, kc=2) # partition by predefined number of clusters
htmp.3> ## End(Not run)
htmp.3> ## show partition by elbow
htmp.3> css.multi.obj <- css.hclust(x,hclust(x))
htmp.3> elbow.obj <- elbow.batch(css.multi.obj,ev.thres=0.90,inc.thres=0.05)
htmp.3> heatmap.3(x, main=main, revC=TRUE, kr=elbow.obj$k, kc=elbow.obj$k)
1.dim(x): 75 75
Preparing `hclust'... The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Preparing `dendrogram'... Reordering ... 2.dim(x): 75 75
Scaling ... 3.dim(x): 75 75
Making color breaks ... 4.dim(x): 75 75
[1] "kr=4,kc=4"
5.dim(x): 75 75
Plotting ... revC: TRUE , revR: FALSE
5b.dim(x): 75 75
5c.dim(x): 75 75
scale: none
5d.dim(x): 75 75
6.dim(x): 75 75
7.dim(x): 75 75
8.dim(x): 75 75
DONE!
htmp.3> ## Not run:
htmp.3> ##D ## show elbow info as subtitle
htmp.3> ##D heatmap.3(x, main=main, sub=sub("\n"," ",attr(elbow.obj,"description")),
htmp.3> ##D cex.sub=1.25,revC=TRUE,kr=elbow.obj$k, kc=elbow.obj$k)
htmp.3> ## End(Not run)
htmp.3>
htmp.3>
htmp.3>
> example("gmdp",package="GMD")
gmdp> require(GMD)
gmdp> gmdp(c(4,1,1,0,0,0,3,1),c(2,1,1,0,0,0,3,3),sliding=FALSE)
[1] 1.4
gmdp> x <- gmdp(c(4,1,1,0,0,0,3,1), c(1,1,2,1,1,0,0,0,3,3,5,5),
gmdp+ pseudocount=1, sliding=TRUE)
gmdp> print(x)
[1] 1.156863
gmdp> print(x, "full")
Distribution of v1:
5 2 2 1 1 1 4 2
(After normalization)
0.278 0.111 0.111 0.056 0.056 0.056 0.222 0.111
Distribution of v2:
2 2 3 2 2 1 1 1 4 4 6 6
(After normalization)
0.059 0.059 0.088 0.059 0.059 0.029 0.029 0.029 0.118 0.118 0.176 0.176
GM-Distance: 1.157
Sliding: TRUE
Number of hits: 1
Gap:
v1 v2
Hit1 4 0
Resolution: 1
> example("plot.gmdp",package="GMD")
plt.gm> require("GMD") # load library
plt.gm> data(cage) # load data
plt.gm> ## measure pairwise distance
plt.gm> x <- gmdp(cage[["Pfkfb3 (T02R00AEC2D8)"]],cage[["Csf1 (T03R0672174D)"]])
plt.gm> print(x) # print a brief version by default
[1] 7.881066
plt.gm> print(x, mode="full") # print a full version by default
Distribution of v1:
1 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 4 1 0 0 0 0 0 1 0 0 2 0 2 0 0 0 1 0 0 2 0 1 0 0 3 0 1 0 0 1 0 0 1 0 0 0 35 7 0 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 0 11 2 0 2 0 5 0 5 0 2 0 0 17 1 31 10 16 791 2 1 50 1 0 1 0 0 3 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2
(After normalization)
0.001 0 0.002 0 0 0 0 0 0.001 0 0 0 0 0 0 0 0 0.001 0 0 0 0 0 0.001 0 0 0 0 0 0 0 0.004 0.001 0 0 0 0 0 0.001 0 0 0.002 0 0.002 0 0 0 0.001 0 0 0.002 0 0.001 0 0 0.003 0 0.001 0 0 0.001 0 0 0.001 0 0 0 0.034 0.007 0 0 0.001 0 0 0 0 0 0.002 0 0 0 0 0 0 0 0 0.011 0.002 0 0.002 0 0.005 0 0.005 0 0.002 0 0 0.017 0.001 0.03 0.01 0.016 0.769 0.002 0.001 0.049 0.001 0 0.001 0 0 0.003 0 0 0 0 0 0 0 0 0 0.001 0.001 0 0 0 0 0.001 0 0 0 0 0 0 0 0 0 0 0.001 0 0 0 0 0 0 0 0 0 0 0.002
Distribution of v2:
3 2 0 221 8 15 4 2 0 0 1 0 0 0 3 1 0 0 0 0 0 1 0 0 5 1 0 1 0 0 0 0 0 0 1 0 0 3 0 0 3 0 0 0 0 0 2 0 0 1 0 0 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 2 0 0 0 1
(After normalization)
0.01 0.007 0 0.767 0.028 0.052 0.014 0.007 0 0 0.003 0 0 0 0.01 0.003 0 0 0 0 0 0.003 0 0 0.017 0.003 0 0.003 0 0 0 0 0 0 0.003 0 0 0.01 0 0 0.01 0 0 0 0 0 0.007 0 0 0.003 0 0 0.003 0 0 0.007 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.014 0.007 0 0 0 0.003
GM-Distance: 7.881
Sliding: TRUE
Number of hits: 1
Gap:
v1 v2
Hit1 0 100
Resolution: 1
plt.gm> ## show alignment
plt.gm> plot(x,labels=c("Pfkfb3","Csf1"),beside=FALSE)
plt.gm> ## show another alignment
plt.gm> plot(gmdp(cage[["Hig1 (T09R0743763C)"]],cage[["Cd72 (T04R028B8BC9)"]]),
plt.gm+ labels=c("Hig1 (T09R0743763C)","Cd72 (T04R028B8BC9)"),
plt.gm+ beside=FALSE)
> example("plot.gmdm",package="GMD")
plt.gm> ## ------------------------------------------------------------------------
plt.gm> ## Example1: CAGE
plt.gm> ## ------------------------------------------------------------------------
plt.gm> require("GMD") # load library
plt.gm> data(cage) # load data
plt.gm> ## construct a distance matrix and visualize it
plt.gm> short.labels <- gsub("(.+) \\(.+","\\1",names(cage)) # get short labels
plt.gm> x <- gmdm(cage[1:6],labels=short.labels[1:6])
plt.gm> plot(x)
dev.new(): using pdf(file="Rplots7.pdf")
plt.gm> ## Not run:
plt.gm> ##D ## ------------------------------------------------------------------------
plt.gm> ##D ## Example2: ChIP-seq
plt.gm> ##D ## ------------------------------------------------------------------------
plt.gm> ##D data(chipseq_mES) # load data
plt.gm> ##D data(chipseq_hCD4T) # load data
plt.gm> ##D
plt.gm> ##D ## pairwise distance and alignment based on GMD metric
plt.gm> ##D plot(gmdm(chipseq_mES,sliding=FALSE))
plt.gm> ##D
plt.gm> ##D ## clustering on spatial distributions of histone modifications
plt.gm> ##D x <- gmdm(chipseq_hCD4T,sliding=FALSE,resolution=10)
plt.gm> ##D heatmap.3(x,revC=TRUE)
plt.gm> ## End(Not run)
plt.gm>
plt.gm>
plt.gm>
There were 50 or more warnings (use warnings() to see the first 50)
Package: GMD
Type: Package
Version: 0.3.3
Date: 2014-08-26 15:46:45 EDT
Title: Generalized Minimum Distance of distributions
Description: GMD is a package for non-parametric distance measurement
between two discrete frequency distributions.
License: GPL (>= 2)
LazyLoad: TRUE
NeedsCompilation: no
URL: http://CRAN.R-project.org/package=GMD
Repository: CRAN
Depends: R (>= 3.1.0)
Imports: stats, grDevices, gplots
Suggests: datasets, MASS, cluster
Collate: 'GMD-package.R' 'imports.R' 'util.R' 'GMD-internal.R'
'GMD-data.R' .....
Authors@R: c( person("Xiaobei", "Zhao", email="xiaobei@binf.ku.dk",
role=c("aut", "cre", "cph")), person("Albin", "Sandelin",
email="albin@binf.ku.dk", role=c("aut")) )
Maintainer: Xiaobei Zhao <xiaobei@binf.ku.dk>
Packaged: 2014-08-27 12:02:34 UTC; xiaobei
Author: Xiaobei Zhao [aut, cre, cph], Albin Sandelin [aut]
Date/Publication: 2014-08-27 14:29:53
Built: R 3.4.0; x86_64-pc-linux-gnu; "Thu, 04 May 2017 08:34:43 +0000";
unix
-- File: /usr/lib/R/site-library/GMD/Meta/package.rds
Warning message:
vignette 'GMD-vignette' has no PDF/HTML
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.