Skip to content

Commit

Permalink
change dtypes of seqnames to unsigned integers
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Oct 23, 2024
1 parent b5d005d commit 3d3fa68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/genomicranges/GenomicRanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ def _sanitize_seqnames(self, seqnames, seqinfo):
seqnames = np.asarray([self._reverse_seqindex[x] for x in seqnames])

if len(seqnames) == 0:
seqnames = seqnames.astype(np.int8)
seqnames = seqnames.astype(np.uint8)
else:
num_uniq = np.max(seqnames)
if num_uniq < 2**8:
seqnames = seqnames.astype(np.int8)
seqnames = seqnames.astype(np.uint8)
elif num_uniq < 2**16:
seqnames = seqnames.astype(np.int16)
seqnames = seqnames.astype(np.uint16)
elif num_uniq < 2**32:
seqnames = seqnames.astype(np.int32)
seqnames = seqnames.astype(np.uint32)

return seqnames

Expand Down

0 comments on commit 3d3fa68

Please sign in to comment.