Question: Error in GenomeInfoDb:::getDanglingSeqlevels
gravatar for Bogdan
2.2 years ago by
Palo Alto, CA, USA
Bogdan570 wrote:

Dear all, please could you advise on how I shall understand and how could I possibly fix the following error :

I am using a R scripts that calls ggbio and the human chomosomes (chr1, chr2, etc ...), and it used to work well before R.3.4.0. On R.3.4.0, the error I am getting is below, and shall I follow the suggestions (at the end of the error message), it does not really work (yet). thanks a lot !


Error in GenomeInfoDb:::getDanglingSeqlevels(x, new2old = new2old, force = force,  :
  The following seqlevels are to be dropped but are currently in use (i.e. have ranges on them): chr1, chr10, chr11, chr12, chr13, chr14,
  chr15, chr16, chr17, chr18, chr19, chr2, chr20, chr22, chr3, chr4, chr5, chr6, chr7, chr8, chr9, chrX. Please use the 'pruning.mode'
  argument to control how to prune 'x', that is, how to remove the ranges in 'x' that are on these sequences. For example, do something
  seqlevels(x, pruning.mode="coarse") <- new_seqlevels
  keepSeqlevels(x, new_seqlevels, pruning.mode="coarse")


> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/
LAPACK: /usr/lib/lapack/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

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

other attached packages:
[1] BiocInstaller_1.26.0

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0   


ggbio • 1.1k views
ADD COMMENTlink modified 2.1 years ago • written 2.2 years ago by Bogdan570
Answer: Error in GenomeInfoDb:::getDanglingSeqlevels
gravatar for Valerie Obenchain
2.2 years ago by
United States
Valerie Obenchain6.7k wrote:

The seqlevel() setter was modified last year to include a pruning.mode argument. The error message shows the code necessary to drop seqlevels in using  this argument. This is documented, with examples, on the ?seqlevels man page.

If you are seeing this error from running a function in ggbio and not your own code then likely the problem is how ggbio is calling seqlevels<-. Looking at the ggbio source code, it's likely related to this replacement:

~/repos/svn/Rpacks/ggbio/R >grep seqlevels *
plotGrandLinear.R:      seqlevels(.h.pos) <- seqlevels(obj)

I would suggest contacting the ggbio author and asking them to update the code to

seqlevels(.h.pos, pruning.mode="coarse") <- seqlevels(obj)



ADD COMMENTlink written 2.2 years ago by Valerie Obenchain6.7k


Note that the behavior of the seqlevels() setter has not changed when it needs to drop seqlevels that are in use: by default it has been raising an error since the beginning (unless called with force=TRUE). What has changed in BioC 3.5 is that now the user can control what to do in this situation by using the new pruning.mode argument (it replaces the force argument). So if seqlevels(.h.pos) <- seqlevels(obj) worked in BioC < 3.5, it should still work in BioC >= 3.5 (as long as no used seqlevels need to be dropped).

Another thing that has changed is the default behavior of keepSeqlevels()dropSeqlevels(), and keepStandardChromosomes(): now they behave consistently with the seqlevels() setter i.e. they raise an error instead of silently dropping the seqlevels that are in use. So calls to these functions now fail in this situation. The fix is to specify a pruning mode, typically the "coarse" mode.

All this to say that if upgrading from BioC < 3.5 to BioC >= 3.5 causes code that used to work to break with an error like the one reported by the OP, then you need to look for calls to keepSeqlevels(), dropSeqlevels(), and keepStandardChromosomes() and identify those that need pruning.mode="coarse" (not all of them necessarily need this).  Calls to the seqlevels() setter that don't use force=TRUE shouldn't need to be touched (and if they use force=TRUE, now they should use pruning.mode="coarse" instead).

Hope this helps,


ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by Hervé Pagès ♦♦ 14k

Dear Herve, many thanks ;) it is working now.

ADD REPLYlink written 2.1 years ago by Bogdan570

Dear Valerie, thank you very much for your help ;)

ADD REPLYlink written 2.2 years ago by Bogdan570
Answer: Error in GenomeInfoDb:::getDanglingSeqlevels
gravatar for Bogdan
2.1 years ago by
Palo Alto, CA, USA
Bogdan570 wrote:

Dear Herve, many thanks for your detailed message and precious help ;). I will update my R code accordingly. 

ADD COMMENTlink written 2.1 years ago by Bogdan570
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 339 users visited in the last hour