simplifyHMM: convenience function for adding simplified names & colors to...

View source: R/simplifyHMM.R

simplifyHMMR Documentation

convenience function for adding simplified names & colors to a ChromHMM track

Description

convenience function for adding simplified names & colors to a ChromHMM track

Usage

simplifyHMM(HMM, cols = NULL, how = c("MNEMONIC", "STATE", "NUMBER"))

Arguments

HMM

a GRanges containing a ChromHMM track

cols

color table (will be loaded if not provided)

how

one of 'MNEMONIC' (default), 'STATE', or 'NUMBER'

Details

if simplifying further than 5-6 states, fix the map first

Value

the same ChromHMM track, but simplified and colored simply

References

http://compbio.mit.edu/ChromHMM/

See Also

colorHMM

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)
## Not run: 
  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)

## End(Not run)


ttriche/chromophobe documentation built on Oct. 14, 2024, 11:59 a.m.