Last data update: 2014.03.03

R: Clustering PWMs Computation
motifDistancesR Documentation

Clustering PWMs Computation

Description

Set of functions to perfom clustering of PWMs.

Usage

	motifDistances(inputPWM, DBscores=jaspar.scores, cc="PCC", align="SWU", top=5, go=1, ge=0.5) 
	motifHclust(x,...)
	motifCutree(tree,k=NULL, h=NULL)

Arguments

inputPWM, DBscores, cc, align, top, go, ge

Option for the PWMs distances computation. Refere to motifMatch.

x,...

Arguments to pass to the hclust function. See hclust.

tree, k, h

Arguments to pass to the cutree function. See cutree.

Details

This function are made to perform motifs clustering.

The ‘motifDistances’ function computes the distances between each pair of motifs using the specified alignment.

The ‘motifHclust’ and ‘motifCutree’ functions are simple redefinition of ‘hclust’ and ‘cutree’.

Author(s)

Eloi Mercier <emercier@chibi.ubc.ca>

Examples

#####Database and Scores#####
path <- system.file(package="MotIV")
jaspar <- readPWMfile(paste(path,"/extdata/jaspar2010.txt",sep=""))
jaspar.scores <- readDBScores(paste(path,"/extdata/jaspar2010_PCC_SWU.scores",sep=""))

#####Input#####
data(FOXA1_rGADEM)
motifs <- getPWM(gadem)
motifs.trimed <- lapply(motifs,trimPWMedge, threshold=1)

#####Analysis#####
foxa1.analysis.jaspar <- motifMatch(inputPWM=motifs,align="SWU",cc="PCC",database=jaspar,DBscores=jaspar.scores,top=5)

#####Clustering#####
d <- motifDistances(getPWM(foxa1.analysis.jaspar))
hc <- motifHclust(d)
plot(hc)
f <- motifCutree(hc, k=2)
foxa1.combine <- combineMotifs(foxa1.analysis.jaspar, f, exact=FALSE, name=c("Group1", "Group2"), verbose=TRUE)

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(MotIV)
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit


Attaching package: 'MotIV'

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

    filter

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/MotIV/motifDistance.Rd_%03d_medium.png", width=480, height=480)
> ### Name: motifDistances
> ### Title: Clustering PWMs Computation
> ### Aliases: motifDistances motifHclust motifCutree
> ### Keywords: misc
> 
> ### ** Examples
> 
> #####Database and Scores#####
> path <- system.file(package="MotIV")
> jaspar <- readPWMfile(paste(path,"/extdata/jaspar2010.txt",sep=""))
> jaspar.scores <- readDBScores(paste(path,"/extdata/jaspar2010_PCC_SWU.scores",sep=""))
> 
> #####Input#####
> data(FOXA1_rGADEM)
> motifs <- getPWM(gadem)
> motifs.trimed <- lapply(motifs,trimPWMedge, threshold=1)
> 
> #####Analysis#####
> foxa1.analysis.jaspar <- motifMatch(inputPWM=motifs,align="SWU",cc="PCC",database=jaspar,DBscores=jaspar.scores,top=5)

	Ungapped Alignment
	Scores read
	Database read
	Motif matches : 5
> 
> #####Clustering#####
> d <- motifDistances(getPWM(foxa1.analysis.jaspar))
> hc <- motifHclust(d)
> plot(hc)
> f <- motifCutree(hc, k=2)
> foxa1.combine <- combineMotifs(foxa1.analysis.jaspar, f, exact=FALSE, name=c("Group1", "Group2"), verbose=TRUE)
motiv object contains 7 motifs.
3 motifs combined : m1 m2 m6
4 motifs combined : m3 m4 m5 m7
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>