reg2gff {tileHMM}R Documentation

Converting Information about Enriched Regions into GFF Format

Description

Creates a GFF formatted file with information about enriched regions.

Usage

reg2gff(regions, post, probe.pos, file = NULL, score.fun = mean, 
    source = "tHMM", feature.type = "posterior_prob", 
    class = "ChIP_region", name = "tHMM")

Arguments

regions A matrix indicating enriched regions (see region.position).
post A vector with posterior probabilities for each probe.
probe.pos A data.frame with columns "chromosome" and "position" providing genomic coordinates for each probe.
file Name of GFF file to create.
score.fun Function used to calculate score of enriched regions.
source Entry for ‘source’ field of GFF file.
feature.type Entry for ‘feature’ field of GFF file.
class Class of documented feature. This is used in the ‘attribute’ field together with name.
name Name of documented feature. This is used in the ‘attribute’ field together with class.

Details

post should provide scores for each probe. These scores are then summarised for each region by applying score.fun to the probe scores in each region. The default for score.fun is mean but any function that accapts a single numeric vector as its argument and returns a scalar can be used.

Value

A GFF formated data.frame is returned invisibly. Usually this function is called for its side effect.

Author(s)

Peter Humburg

References

GFF specification: http://www.sanger.ac.uk/Software/formats/GFF/GFF_Spec.shtml

See Also

region.position

Examples

## 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)

[Package tileHMM version 1.0-2 Index]