Sort GRangesList elements by chromosome and position
sortGRL( GRL, splitColname = "splitColname", keep_order = TRUE, verbose = FALSE, ... )
GRL | GRangesList to be sorted. |
---|---|
splitColname | intermediate colname used to split values
from GRanges to GRangesList. It only needs to be defined
if for some reason the default "splitColname" is already
in |
keep_order | logical indicating whether to maintain the
input order of GRanges; |
... | additional arguments are ignored. |
GRangesList sorted by chromosome and position.
This function sorts GRangesList elements by chromosome and
position, using the default sort routine for GRanges objects.
It accomplishes the task by sorting the GRanges elements, then
splitting that GRanges into a GRangesList based upon the
original names(GrangesList)
.
Other jam GRanges functions:
addGRLgaps()
,
addGRgaps()
,
annotateGRLfromGRL()
,
annotateGRfromGR()
,
assignGRLexonNames()
,
closestExonToJunctions()
,
combineGRcoverage()
,
exoncov2polygon()
,
findOverlapsGRL()
,
flattenExonsBy()
,
getFirstStrandedFromGRL()
,
getGRLgaps()
,
getGRcoverageFromBw()
,
getGRgaps()
,
grl2df()
,
jam_isDisjoint()
,
make_ref2compressed()
,
spliceGR2junctionDF()
,
stackJunctions()
gr12 <- GenomicRanges::GRanges( seqnames=rep(c("chr1", "chr2", "chr1"), c(3,3,3)), ranges=IRanges::IRanges( start=c(100, 200, 400, 500, 300, 100, 200, 400, 600), width=c(50,50,50, 50,50,50, 50,50,50) ), strand=rep(c("+", "-", "+"), c(3,3,3)), gene_name=rep(c("GeneA", "GeneB", "GeneC"), each=3) ) grl <- GenomicRanges::split(gr12, GenomicRanges::values(gr12)$gene_name); grl;#> GRangesList object of length 3: #> $GeneA #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 100-149 + | GeneA #> [2] chr1 200-249 + | GeneA #> [3] chr1 400-449 + | GeneA #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneB #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr2 500-549 - | GeneB #> [2] chr2 300-349 - | GeneB #> [3] chr2 100-149 - | GeneB #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneC #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 200-249 + | GeneC #> [2] chr1 400-449 + | GeneC #> [3] chr1 600-649 + | GeneC #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #>GenomicRanges::sort(grl);#> GRangesList object of length 3: #> $GeneA #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 100-149 + | GeneA #> [2] chr1 200-249 + | GeneA #> [3] chr1 400-449 + | GeneA #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneB #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr2 100-149 - | GeneB #> [2] chr2 300-349 - | GeneB #> [3] chr2 500-549 - | GeneB #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneC #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 200-249 + | GeneC #> [2] chr1 400-449 + | GeneC #> [3] chr1 600-649 + | GeneC #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #>sortGRL(grl);#> GRangesList object of length 3: #> $GeneA #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 100-149 + | GeneA #> [2] chr1 200-249 + | GeneA #> [3] chr1 400-449 + | GeneA #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneB #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr2 100-149 - | GeneB #> [2] chr2 300-349 - | GeneB #> [3] chr2 500-549 - | GeneB #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneC #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 200-249 + | GeneC #> [2] chr1 400-449 + | GeneC #> [3] chr1 600-649 + | GeneC #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #>sortGRL(grl, keep_order=FALSE);#> GRangesList object of length 3: #> $GeneA #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 100-149 + | GeneA #> [2] chr1 200-249 + | GeneA #> [3] chr1 400-449 + | GeneA #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneC #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr1 200-249 + | GeneC #> [2] chr1 400-449 + | GeneC #> [3] chr1 600-649 + | GeneC #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #> #> $GeneB #> GRanges object with 3 ranges and 1 metadata column: #> seqnames ranges strand | gene_name #> <Rle> <IRanges> <Rle> | <character> #> [1] chr2 100-149 - | GeneB #> [2] chr2 300-349 - | GeneB #> [3] chr2 500-549 - | GeneB #> ------- #> seqinfo: 2 sequences from an unspecified genome; no seqlengths #>