This function takes the regions found in calculatePvalues and assigns them genomic states contructed with makeGenomicState. The main workhorse functions are countOverlaps and findOverlaps.
annotateRegions(regions, genomicState, annotate = TRUE, ...)
The $regions
output from calculatePvalues.
A GRanges object created with makeGenomicState.
It can be either the genomicState$fullGenome
or
genomicState$codingGenome
component.
If TRUE
then the regions are annotated by the genomic
state. Otherwise, only the overlaps between the regions and the genomic
states are computed.
Arguments passed to other methods and/or advanced arguments. Advanced arguments:
If TRUE
basic status updates will be printed along
the way.
Passed on to
findOverlaps-methods and
countOverlaps. Default: TRUE
.
Passed to extendedMapSeqlevels, countOverlaps and findOverlaps-methods.
A list with elements countTable
and annotationList
(only if annotate=TRUE
).
This is a data.frame with the number of overlaps from the
regions vs the genomic states with one type per column. For example, if
fullOrCoding='full'
then the columns are exon
,
intergenic
and intron
.
This is a GRangesList
with the genomic states
that overlapped with the regions. The
names of this GRangesList
correspond to the region index in
regions
.
You might want to specify arguments such as minoverlap
to control
how the overlaps are determined. See findOverlaps
for further details.
## Annotate regions, first two only
annotatedRegions <- annotateRegions(
regions = genomeRegions$regions[1:2],
genomicState = genomicState$fullGenome, minoverlap = 1
)
#> 2023-05-07 06:01:06.680359 annotateRegions: counting
#> 2023-05-07 06:01:06.759836 annotateRegions: annotating
annotatedRegions
#> $countTable
#> exon intergenic intron
#> 1 1 0 0
#> 2 1 0 0
#>
#> $annotationList
#> GRangesList object of length 2:
#> $`1`
#> GRanges object with 1 range and 4 metadata columns:
#> seqnames ranges strand | theRegion tx_id
#> <Rle> <IRanges> <Rle> | <character> <IntegerList>
#> 2238 chr21 47409522-47409566 + | exon 72950
#> tx_name gene
#> <CharacterList> <IntegerList>
#> 2238 uc002zhu.1 55
#> -------
#> seqinfo: 1 sequence from hg19 genome
#>
#> $`2`
#> GRanges object with 1 range and 4 metadata columns:
#> seqnames ranges strand | theRegion tx_id
#> <Rle> <IRanges> <Rle> | <character> <IntegerList>
#> 2250 chr21 47411924-47411986 + | exon 72950
#> tx_name gene
#> <CharacterList> <IntegerList>
#> 2250 uc002zhu.1 55
#> -------
#> seqinfo: 1 sequence from hg19 genome
#>
#>