A function that takes the users input regions
(as '.BED' or GRanges object input) and checks if they are valid
genomic regions.
check_region(regions)
regions | Input of either a GRanges object or a BED file containing Genomic Regions the user wants to build a RSE object for. |
---|
A text output, and if seqlevels(regions)
returns a valid
output, the regions
GRanges object will be returned.
The GRanges Object can then be used in the libd_rse function.
## Define a single example genomic region as GRanges object genomic_regions <- GenomicRanges::GRanges('chr1:1-100:+') check_region(genomic_regions)#>#>#> GRanges object with 1 range and 0 metadata columns: #> seqnames ranges strand #> <Rle> <IRanges> <Rle> #> [1] chr1 1-100 + #> ------- #> seqinfo: 1 sequence from an unspecified genome; no seqlengths## As BED file input bed_file <- file.path(tempdir(), 'genomic_regions.bed') rtracklayer::export.bed(genomic_regions, bed_file) check_region(bed_file)#>#>#> GRanges object with 1 range and 2 metadata columns: #> seqnames ranges strand | name score #> <Rle> <IRanges> <Rle> | <character> <numeric> #> [1] chr1 1-100 + | <NA> 0 #> ------- #> seqinfo: 1 sequence from an unspecified genome; no seqlengths