gff2index {tileHMM} | R Documentation |
Creates a logical vector indicating probes in annotated regions from information in a GFF formatted file.
gff2index(gff, pos)
gff |
GFF file (see Details). |
pos |
A data.frame with chromosome names in its first column and
probe positions in the second column. |
The GFF file can be provided in several ways. Either as data.frame
, as
a character string providing the name of a GFF file or as a connection
object
pointing to a GFF file.
A logical vector with one entry for each probe in pos
. TRUE
indicates probes that
are inside a region that is annotated in the provided GFF file.
Peter Humburg
GFF specification: http://www.sanger.ac.uk/Software/formats/GFF/GFF_Spec.shtml
region.position
and reg2gff
for the reverse operation.
## create two state HMM with t distributions state.names <- c("one","two") transition <- c(0.1, 0.02) 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 "two" reg.pos <- region.position(vit.res$stateSeq, region="two") ## calculate posterior probability for state "two" post <- posterior(obs, model, log=FALSE)[1,] ## create gff annotations gff <- reg2gff(reg.pos, post, pos) ## extract probe calls from gff annotation probe.idx <- gff2index(gff, pos)