getSitesInFeature {hiAnnotator} | R Documentation |
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.
getSitesInFeature( sites.rd, features.rd, colnam = NULL, asBool = FALSE, feature.colnam = NULL, parallel = FALSE, allSubjectCols = FALSE, overlapType = "any" )
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
|
allSubjectCols |
Flag indicating whether to return all annotations or metadata columns from features.rd. Defaults to FALSE. |
overlapType |
see |
a GRanges object with new annotation columns appended at the end of sites.rd.
If parallel=TRUE, then be sure to have a parallel backend registered
before running the function. One can use any of the following libraries
compatible with foreach
: doMC, doSMP, doSNOW,
doMPI. For example: library(doMC); registerDoMC(2)
makeGRanges
, getFeatureCounts
,
getNearestFeature
.
# 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 ## Not run: 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 ## End(Not run)