get2NearestFeature: Get two nearest upstream and downstream annotation boundary...

Description Usage Arguments Value Note See Also Examples

View source: R/hiAnnotator.R

Description

Given a query object, the function retrieves the two nearest feature upstream and downstream along with their properties from a subject and then appends them as new columns within the query object. When used in genomic context, the function can be used to retrieve two nearest gene upstream and downstream of the genomic position of interest.

Usage

1
2
get2NearestFeature(sites.rd, features.rd, colnam = NULL,
  side = "either", feature.colnam = NULL, relativeTo = "subject")

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!

side

boundary of annotation to use to calculate the nearest distance. Options are '5p','3p', 'either'(default), or 'midpoint'.

feature.colnam

column name from features.rd to be used for retrieving the nearest feature name. By default this is NULL assuming that features.rd has a column that includes the word 'name' somewhere in it.

relativeTo

calculate distance relative to query or subject. Default is 'subject'. See documentation of getNearestFeature for more information.

Value

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

Note

See Also

getNearestFeature, makeGRanges, getFeatureCounts, getSitesInFeature.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Convert a dataframe to GRanges object
data(sites)
alldata.rd <- makeGRanges(sites, soloStart = TRUE)

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

nearestGenes <- get2NearestFeature(alldata.rd, genes.rd, "NearestGene")
nearestGenes
## Not run: 
nearestGenes <- get2NearestFeature(alldata.rd, genes.rd, "NearestGene",
side = "5p")
nearestGenes
nearestGenes <- get2NearestFeature(alldata.rd, genes.rd, "NearestGene",
side = "3p")
nearestGenes

## End(Not run)

hiAnnotator documentation built on Nov. 8, 2020, 7:27 p.m.