gff2index: Extract Probe Calls from GFF File

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/utils.R

Description

Creates a logical vector indicating probes in annotated regions from information in a GFF formatted file.

Usage

1
gff2index(gff, pos)

Arguments

gff

GFF file (see Details).

pos

A data.frame with chromosome names in its first column and probe positions in the second column.

Details

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.

Value

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.

Author(s)

Peter Humburg

References

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

See Also

region.position and reg2gff for the reverse operation.

Examples

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

tileHMM documentation built on May 30, 2017, 3:41 a.m.