user11285468
user11285468

Reputation: 11

invalid class “GRanges” object: 1: 'x@seqnames' is not parallel to 'x

This simple code:

library(GenomicRanges)

GRanges(c("chr1", "chr1", "chr1"), c(109810200, 109810201, 109810544))

fails with rather cryptic exception:

Error in validObject(.Object) : invalid class “GRanges” object: 1: 'x@seqnames' is not parallel to 'x' invalid class “GRanges” object: 2: 'x@strand' is not parallel to 'x'

Additionally when I try to provide seqlengths:

GRanges(
  c("chr1", "chr1", "chr1"), 
  c(109810200, 109810201, 109810544),
  seqlengths=c(1, 1, 1))

I get:

Error in .normargSeqlengths(seqlengths, seqnames) : length of supplied 'seqlengths' must equal the number of sequences

which suggests that some data is dropped in the process. But I cannot figure out why it happens.

I'd be grateful for any insights into what's going on here.

Environment:

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux buster/sid

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
[1] GenomicRanges_1.34.0 GenomeInfoDb_1.18.2  IRanges_2.16.0      
[4] S4Vectors_0.20.1     BiocGenerics_0.28.0 

loaded via a namespace (and not attached):
[1] zlibbioc_1.28.0        compiler_3.5.2         XVector_0.22.0        
[4] GenomeInfoDbData_1.2.0 RCurl_1.95-4.12        bitops_1.0-6 

Upvotes: 1

Views: 877

Answers (1)

Turkuler
Turkuler

Reputation: 21

I was getting the same error. Then I converted both seqnames and ranges to characters and interestingly it worked!

Upvotes: 2

Related Questions