Skip to content

Commit

Permalink
Merge branch 'master' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
nvictus committed Dec 19, 2024
2 parents fa8c251 + 03f781f commit 897ca01
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3,9", "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.12"
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "cooler"
version = "0.10.2"
description = "Sparse binary format for genomic interaction matrices."
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "BSD-3-Clause"}
authors = [
{name = "Nezar Abdennur", email = "nabdennur@gmail.com"},
Expand All @@ -29,7 +29,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -39,7 +38,7 @@ classifiers = [
readme = "README.md"

dependencies = [
"numpy>=1.9, <2",
"numpy>=1.26,<3",
"scipy>=0.16",
"pandas>1.5",
"h5py>=2.5",
Expand All @@ -59,7 +58,7 @@ all = [
"ipytree>=0.2.2",
"ipywidgets>=8.0.0",
"matplotlib",
"pypairix; platform_system != 'Windows'",
# "pypairix; platform_system != 'Windows'", # doesn't compile, see 4dn-dcic/pairix#79
"psutil",
"pysam; platform_system != 'Windows'",
]
Expand Down
3 changes: 2 additions & 1 deletion src/cooler/_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import warnings
from bisect import bisect_right
from collections import OrderedDict, defaultdict
from typing import Any, Iterator, Literal
from collections.abc import Iterator
from typing import Any, Literal

import h5py
import multiprocess as mp
Expand Down
9 changes: 5 additions & 4 deletions src/cooler/_typing.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from __future__ import annotations

from typing import Callable, Dict, Iterable, Optional, Tuple, TypeVar, Union
from collections.abc import Iterable
from typing import Callable, Optional, TypeVar, Union

import numpy as np
import pandas as pd

T = TypeVar('T')
U = TypeVar('U')
MapFunctor = Callable[[Callable[[T], U], Iterable[T]], Iterable[U]]
GenomicRangeSpecifier = Union[str , Tuple[str, Optional[int], Optional[int]]]
GenomicRangeTuple = Tuple[str, int, int]
Tabular = Union[pd.DataFrame, Dict[str, np.ndarray]]
GenomicRangeSpecifier = Union[str , tuple[str, Optional[int], Optional[int]]]
GenomicRangeTuple = tuple[str, int, int]
Tabular = Union[pd.DataFrame, dict[str, np.ndarray]]

__all__ = ["GenomicRangeSpecifier", "GenomicRangeTuple", "MapFunctor", "Tabular"]
3 changes: 2 additions & 1 deletion src/cooler/core/_rangequery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Callable, Iterator
from collections.abc import Iterator
from typing import Any, Callable

import h5py
import numpy as np
Expand Down
6 changes: 3 additions & 3 deletions src/cooler/core/_selectors.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations

from typing import Any, Callable, List, Optional, Tuple, Union, overload
from typing import Any, Callable, Optional, Union, overload

import pandas as pd

ColumnsArg = Optional[Union[str, List[str]]]
GenomicRangeArg = Optional[Union[str, Tuple[str, Optional[int], Optional[int]]]]
ColumnsArg = Optional[Union[str, list[str]]]
GenomicRangeArg = Optional[Union[str, tuple[str, Optional[int], Optional[int]]]]
FieldArg = Optional[str]


Expand Down
2 changes: 1 addition & 1 deletion src/cooler/core/_tableops.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get(
data[field] = pd.Categorical.from_codes(
dset[lo:hi], sorted(dt, key=dt.__getitem__), ordered=True
)
elif dset.dtype.type == np.string_:
elif dset.dtype.type == np.bytes_:
data[field] = dset[lo:hi].astype("U")
else:
data[field] = dset[lo:hi]
Expand Down
3 changes: 2 additions & 1 deletion src/cooler/create/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import posixpath
import tempfile
import warnings
from collections.abc import Iterable
from datetime import datetime
from typing import Any, Iterable
from typing import Any

import h5py
import numpy as np
Expand Down
7 changes: 4 additions & 3 deletions src/cooler/create/_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import warnings
from bisect import bisect_left
from collections import Counter, OrderedDict
from collections.abc import Iterator
from functools import partial
from typing import Any, Callable, Iterator
from typing import Any, Callable

import h5py
import numpy as np
Expand Down Expand Up @@ -112,8 +113,8 @@ def _sanitize_records(
return chunk

# Find positional anchor columns, convert to zero-based if needed
anchor1 = np.array(chunk[anchor_field + suffixes[0]])
anchor2 = np.array(chunk[anchor_field + suffixes[1]])
anchor1 = chunk[anchor_field + suffixes[0]].to_numpy(copy=True)
anchor2 = chunk[anchor_field + suffixes[1]].to_numpy(copy=True)
if is_one_based:
anchor1 -= 1
anchor2 -= 1
Expand Down
3 changes: 2 additions & 1 deletion src/cooler/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"""
from __future__ import annotations

from collections.abc import Iterable, Iterator, Sequence
from functools import partial, reduce
from typing import Any, Callable, Iterable, Iterator, Sequence
from typing import Any, Callable

from multiprocess import Lock

Expand Down
5 changes: 3 additions & 2 deletions src/cooler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import os
import re
from collections import OrderedDict, defaultdict
from collections.abc import Generator, Iterable, Iterator
from contextlib import contextmanager
from typing import IO, Any, Generator, Iterable, Iterator
from typing import IO, Any

import h5py
import numpy as np
Expand Down Expand Up @@ -627,7 +628,7 @@ def infer_meta(x, index=None): # pragma: no cover
"m": np.timedelta64(1),
"S": np.str_("foo"),
"a": np.str_("foo"),
"U": np.unicode_("foo"),
"U": np.str_("foo"),
"O": "foo",
}

Expand Down

0 comments on commit 897ca01

Please sign in to comment.