
Orders a vector of indices according to their corresponding genomic locations (chromosome and position). This function is useful for sorting site sites or other genomic features by their physical positions.
Source:R/utils.R
orderByLoc.RdOrders a vector of indices according to their corresponding genomic locations (chromosome and position). This function is useful for sorting site sites or other genomic features by their physical positions.
Arguments
- x
Character or integer vector. Indices or identifiers to be ordered
- array
Character. Array platform type, either "450K" or "EPIC" (default: "450K")
- genome
Character. Genome version, either "hg38", "hg19", or "hs1" (default: "hg38")
- genomic_locs
Data frame. Optional pre-computed genomic locations. If NULL, locations will be retrieved using getSortedGenomicLocs (default: NULL)
Examples
# Order site indices by genomic location
site_ids <- c("cg00000029", "cg00000108", "cg00000109")
ordered_indices <- orderByLoc(site_ids, array = "450K")
# Order using pre-computed genomic locations
locs <- getSortedGenomicLocs("EPIC", "hg38")
ordered_indices <- orderByLoc(site_ids, genomic_locs = locs)