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, ...)

Arguments

regions

The $regions output from calculatePvalues.

genomicState

A GRanges object created with makeGenomicState. It can be either the genomicState$fullGenome or genomicState$codingGenome component.

annotate

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:

verbose

If TRUE basic status updates will be printed along the way.

ignore.strand

Passed on to findOverlaps-methods and countOverlaps. Default: TRUE.

Passed to extendedMapSeqlevels, countOverlaps and findOverlaps-methods.

Value

A list with elements countTable and annotationList (only if annotate=TRUE).

countTable

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.

annotationList

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.

Details

You might want to specify arguments such as minoverlap to control how the overlaps are determined. See findOverlaps for further details.

Author

Andrew Jaffe, Leonardo Collado-Torres

Examples

## Annotate regions, first two only
annotatedRegions <- annotateRegions(
    regions = genomeRegions$regions[1:2],
    genomicState = genomicState$fullGenome, minoverlap = 1
)
#> 2024-12-13 15:13:04.349366 annotateRegions: counting
#> 2024-12-13 15:13:04.403325 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
#> 
#>