Given the output of fullCoverage, coerce the coverage to a GRanges object.

coerceGR(sample, fullCov, ...)

Arguments

sample

The name or integer index of the sample of interest to coerce to a GRanges object.

fullCov

A list where each element is the result from loadCoverage used with returnCoverage = TRUE. Can be generated using fullCoverage.

...

Arguments passed to other methods and/or advanced arguments. Advanced arguments:

verbose

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

seqlengths

A named vector with the sequence lengths of the chromosomes. This argument is passed to GRanges. By default this is NULL and inferred from the data.

Passed to define_cluster.

Value

A GRanges object with score metadata vector containing the coverage information for the specified sample. The ranges reported are only those for regions of the genome with coverage greater than zero.

See also

Author

Leonardo Collado-Torres

Examples

## Create a small fullCov object with data only for chr21
fullCov <- list("chr21" = genomeDataRaw)

## Coerce to a GRanges the first sample
gr <- createBwSample("ERR009101",
    fullCov = fullCov,
    seqlengths = c("chr21" = 48129895)
)
#> 2024-12-13 15:13:06.774664 coerceGR: coercing sample ERR009101
#> 2024-12-13 15:13:06.796681 createBwSample: exporting bw for sample ERR009101

## Explore the output
gr
#> GRanges object with 16 ranges and 1 metadata column:
#>         seqnames            ranges strand |     score
#>            <Rle>         <IRanges>  <Rle> | <integer>
#>   chr21    chr21 47410303-47410336      * |         1
#>   chr21    chr21 47410687-47410688      * |         1
#>   chr21    chr21 47410699-47410734      * |         1
#>   chr21    chr21 47410951-47410955      * |         1
#>   chr21    chr21          47411924      * |         1
#>     ...      ...               ...    ... .       ...
#>   chr21    chr21 47415237-47415272      * |         1
#>   chr21    chr21 47415317-47415352      * |         1
#>   chr21    chr21 47417629-47417664      * |         1
#>   chr21    chr21 47417674-47417676      * |         1
#>   chr21    chr21 47418035-47418067      * |         1
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome


## Coerces fullCoverage() output to GRanges for a given sample