Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order(x, decreasing=TRUE) is broken on CompressedIntegerList objects #21

Open
hpages opened this issue Sep 19, 2019 · 0 comments
Open
Assignees

Comments

@hpages
Copy link
Contributor

hpages commented Sep 19, 2019

library(IRanges)
x1 <- IntegerList(15:11, 21:28, compress=TRUE)

order(x1)
# IntegerList of length 2
# [[1]] 5 4 3 2 1
# [[2]] 1 2 3 4 5 6 7 8

order(x1, decreasing=TRUE)  # BROKEN!
# IntegerList of length 2
# [[1]] 13 12 11 10 9
# [[2]] 3 2 1 -4 -3 -2 -1 0

This in turn breaks sort( , decreasing=TRUE):

sort(x1, decreasing=TRUE)
# Error in seq_len(x_NROW)[i] : 
#   only 0's may be mixed with negative subscripts

Everything looks fine with a SimpleIntegerList object:

x2 <- IntegerList(15:11, 21:28, compress=FALSE)

order(x2)
# IntegerList of length 2
# [[1]] 5 4 3 2 1
# [[2]] 1 2 3 4 5 6 7 8

order(x2, decreasing=TRUE)
# IntegerList of length 2
# [[1]] 1 2 3 4 5
# [[2]] 8 7 6 5 4 3 2 1

sort(x2, decreasing=TRUE)
# IntegerList of length 2
# [[1]] 15 14 13 12 11
# [[2]] 28 27 26 25 24 23 22 21

sessionInfo():

> sessionInfo()
R version 3.6.0 Patched (2019-05-02 r76454)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS:   /home/hpages/R/R-3.6.r76454/lib/libRblas.so
LAPACK: /home/hpages/R/R-3.6.r76454/lib/libRlapack.so

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] stats4    parallel  stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
[1] IRanges_2.19.16     S4Vectors_0.23.23   BiocGenerics_0.31.6

loaded via a namespace (and not attached):
[1] compiler_3.6.0
@hpages hpages self-assigned this Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant