Learn R Programming

hiAnnotator (version 1.6.2)

getSitesInFeature: Find overlapping positions/ranges that match between the query and subject.

Description

When used in genomic context, the function annotates genomic positions of interest with information like if they were in a gene or cpg island or whatever annotation that was supplied in the subject.

Usage

getSitesInFeature(sites.rd, features.rd, colnam = NULL, asBool = FALSE,
  feature.colnam = NULL, parallel = FALSE, allSubjectCols = FALSE,
  overlapType = "any")

Arguments

sites.rd
GRanges object to be used as the query.
features.rd
GRanges object to be used as the subject or the annotation table.
colnam
column name to be added to sites.rd for the newly calculated annotation...serves a core! If allSubjectCols=TRUE, then this is used as a prefix to all metadata column.
asBool
Flag indicating whether to return results as TRUE/FALSE or the property of an overlapping feature..namely feature name and orientation if available. Defaults to FALSE.
feature.colnam
column name from features.rd to be used for retrieving the feature name. By default this is NULL assuming that features.rd has a column that includes the word 'name' somewhere in it. Not required if asBool=TRUE or allSubjectCols=TRUE
parallel
use parallel backend to perform calculation with foreach. Defaults to FALSE. Not applicable when asBool=T. If no parallel backend is registered, then a serial version of foreach is ran using registerDoSEQ.
allSubjectCols
Flag indicating whether to return all annotations or metadata columns from features.rd. Defaults to FALSE.
overlapType
see findOverlaps. Defaults to 'any'

Value

  • a GRanges object with new annotation columns appended at the end of sites.rd.

See Also

makeGRanges, getFeatureCounts, getNearestFeature.

Examples

Run this code
# Convert a dataframe to GRanges object
data(sites)
alldata.rd <- makeGRanges(sites,soloStart=TRUE)

data(genes)
genes.rd <- makeGRanges(genes)

InGenes <- getSitesInFeature(alldata.rd,genes.rd,"InGene")
InGenes
InGenes <- getSitesInFeature(alldata.rd,genes.rd,"InGene",asBool=TRUE)
InGenes
## Parallel version of getSitesInFeature
InGenes <- getSitesInFeature(alldata.rd,genes.rd,"InGene",asBool=TRUE,
parallel=TRUE)
InGenes
InGenes <- getSitesInFeature(alldata.rd,genes.rd,"InGene",
allSubjectCols=TRUE, parallel=TRUE)
InGenes

Run the code above in your browser using DataLab