Build GPos from IPos
2
0
Entering edit mode
maltethodberg ▴ 170
@maltethodberg-9690
Last seen 10 days ago
Denmark

It would be great if one could construct a GPos from and IPos, similarly to how one can construct a GRanges from an IRanges:

GRanges(seqnames=rep("chr1", 3), ranges=IRanges(start=1:3, width=1)) # Works

GPos(seqnames=rep("chr1", 3), ranges=IPos(1:3)) # Doesn't work

genomicranges granges gpos • 1.1k views
ADD COMMENT
2
Entering edit mode
@herve-pages-1542
Last seen 2 days ago
Seattle, WA, United States

This is another reasonable feature request. Also added to the TODO list: https://github.com/Bioconductor/GenomicRanges/issues/13

Thanks,

H.

ADD COMMENT
2
Entering edit mode
@herve-pages-1542
Last seen 2 days ago
Seattle, WA, United States

Hi,

This works with the latest devel version of GenomicRanges (1.37.13):

GPos("A", pos=IPos("3-8"))
# StitchedGPos object with 9 positions and 0 metadata columns:
#       seqnames       pos strand
#          <Rle> <integer>  <Rle>
#   [1]        A         3      *
#   [2]        A         4      *
#   [3]        A         5      *
#   [4]        A         6      *
#   [5]        A         7      *
#   [6]        A         8      *
#   -------
#   seqinfo: 1 sequence from an unspecified genome; no seqlengths

GPos("chr1", pos=IPos(1:3))
# UnstitchedGPos object with 3 positions and 0 metadata columns:
#       seqnames       pos strand
#          <Rle> <integer>  <Rle>
#   [1]     chr1         1      *
#   [2]     chr1         2      *
#   [3]     chr1         3      *
#   -------
#  seqinfo: 1 sequence from an unspecified genome; no seqlengths

However, please note that the 2nd argument of the GPos() constructor function is named pos rather than ranges:

args(GRanges)
# function (seqnames = NULL, ranges = NULL, strand = NULL, ..., 
#     seqinfo = NULL, seqlengths = NULL) 
# NULL

args(GPos)
# function (seqnames = NULL, pos = NULL, strand = NULL, ...,
#     seqinfo = NULL,  seqlengths = NULL, stitch = NA) 
# NULL

Also note that IPos and GPos objects now exist in 2 flavors: unstitched and stitched. The stitched flavor corresponds to what IPos and GPos objects used to be. See ?IPos and ?GPos for more information.

Best,

H.

ADD COMMENT

Login before adding your answer.

Traffic: 508 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6