In a function for plotting pairwise genome alignments, I am concatenating all sequence levels of some GRanges objects. This can create seqlengths that are longer than what R's
integer format can support. Unfortunately, my attempts to use the
numeric format instead did not work as
seqlengths() coerces its input to integer format as in the example below.
> gr <- GRanges("chr1:1-2") > seqlengths(gr) <- 3e9 Warning message: In .normarg_seqlengths(value, seqnames(x)) : NAs introduced by coercion to integer range
And I could not cheat the system as a validation function will block me from putting other things than integers in the S4 slot.
> gr@seqinfo@seqlengths <- 3e9 Error in (function (cl, name, valueClass) : assignment of an object of class “numeric” is not valid for @‘seqlengths’ in an object of class “Seqinfo”; is(value, "integer") is not TRUE
Would it be possible to allow integer
numeric values as
seqlengths, for instance after validating them with the
is.wholenumber workaround suggested in
is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol