Skip to content

Commit

Permalink
apply patch suggested by @maxcoulter
Browse files Browse the repository at this point in the history
This will fix #363
  • Loading branch information
zkamvar committed Sep 22, 2024
1 parent f9fddd2 commit f61ec5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
CHANGES IN ADEGENET VERSION 2.1.11

BUG FIX

- genlight objects subset without any arguments to loci no longer gain an
extra byte. (reported: @maxcoulter, #363)

CHANGES IN ADEGENET VERSION 2.1.10

CRAN MAINTENANCE
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: adegenet
Title: Exploratory Analysis of Genetic and Genomic Data
Version: 2.1.10
Version: 2.1.11
Authors@R:
c(person(given = "Thibaut",
family = "Jombart",
Expand Down
5 changes: 4 additions & 1 deletion R/glHandle.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# Take a raw vector, subset the bits and then convert to integers.
xint <- as.integer(rawToBits(x)[i])
# Figure out how many zeroes are needed to pad the end.
zeroes <- 8 - (length(xint) %% 8)
extra_bits <- length(xint) %% 8
# https://github.com/thibautjombart/adegenet/issues/363
# Fix to a bug caught by @maxcoulter. In the case
zeroes <- if (extra_bits > 0) 8 - extra_bits else 0
# Convert the integer vector with zeroes on the end back into a raw vector.
return(packBits(c(xint, rep(0L, zeroes))))
}
Expand Down

0 comments on commit f61ec5c

Please # to comment.