## create two state HMM with t distributions
state.names <- c("one","two")
transition <- c(0.1, 0.2)
location <- c(1, 2)
scale <- c(1, 1)
df <- c(4, 6)
model <- getHMM(list(a=transition, mu=location, sigma=scale, nu=df),
state.names)
## obtain observation sequence from model
obs <- sampleSeq(model, 100)
## make up some genomic probe coordinates
pos <- data.frame(chromosome = rep("chr1", times = 100),
position = seq(1, 4000, length = 100))
## compute most likely state sequence for obs
vit.res <- viterbi(model, obs)
## find regions attributed to state "one"
reg.pos <- region.position(vit.res$stateSeq, region="one")
## calculate posterior probability for state "one"
post <- posterior(obs, model, log=FALSE)[1,]
## create gff annotations
gff <- reg2gff(reg.pos, post, pos)
Run the code above in your browser using DataLab