-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsimplifyHMM.Rd
57 lines (51 loc) · 1.73 KB
/
simplifyHMM.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simplifyHMM.R
\name{simplifyHMM}
\alias{simplifyHMM}
\title{convenience function for adding simplified names & colors to a ChromHMM track}
\usage{
simplifyHMM(HMM, cols = NULL, how = c("MNEMONIC", "STATE", "NUMBER"))
}
\arguments{
\item{HMM}{a GRanges containing a ChromHMM track}
\item{cols}{color table (will be loaded if not provided)}
\item{how}{one of `MNEMONIC` (default), `STATE`, or `NUMBER`}
}
\value{
the same ChromHMM track, but simplified and colored simply
}
\description{
convenience function for adding simplified names & colors to a ChromHMM track
}
\details{
if simplifying further than 5-6 states, fix the map first
}
\examples{
# simpler even than the defaults:
data(remc18state, package="chromophobe")
simpler <- remc18state
simpler$SIMPLE <- sub("(Promoter|Enhancer)", "Active", simpler$SIMPLE)
simpler$SIMPLE <- sub("(Transcribed|Het_Rpt_Qui)", "Other", simpler$SIMPLE)
simpler[simpler$SIMPLE == "Other", "RGBSIMPLE"] <- "255,255,255"
data(chr19_HMM, package="chromophobe")
simplerHMM <- simplifyHMM(chr19_HMM, cols=simpler)
with(simplerHMM, table(name))
# blueprint HMM simplification (better to use hg38, though)
\dontrun{
data(FDFT1)
bpHMMfiles <- list.files(patt="BlueprintChromHMM.*hg19.bed.gz$")
names(bpHMMfiles) <- sapply(strsplit(bpHMMfiles,"\\\\."),`[`,1)
bpHMMs <- GRangesList(lapply(bpHMMfiles, import, which=FDFT1))
data(blueprint12state)
simplified <- GRangesList(lapply(bpHMMs, simplifyHMM,
cols=blueprint12state, how="NUMBER"))
genome(simplified) <- "hg19"
for (i in names(simplified)) compressAndExportHMM(simplified[[i]], i)
}
}
\references{
http://compbio.mit.edu/ChromHMM/
}
\seealso{
colorHMM
}