diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e256ca12a..a181cbfe3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: hooks: - id: isort - repo: https://github.com/python/black - rev: 21.10b0 + rev: 22.3.0 hooks: - id: black language_version: python3 diff --git a/requirements-dev.txt b/requirements-dev.txt index 836eb75bc..8dde91f31 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -14,7 +14,7 @@ partd bed-reader rechunker == 0.3.3 cbgen -cyvcf2; platform_system != "Windows" +cyvcf2 < 0.30.15; platform_system != "Windows" yarl matplotlib asv diff --git a/requirements-doc.txt b/requirements-doc.txt index d760bcadc..045b0fd29 100644 --- a/requirements-doc.txt +++ b/requirements-doc.txt @@ -2,9 +2,6 @@ myst_nb pydata-sphinx-theme sphinx>4,<=4.2.0 sphinx_autodoc_typehints>=1.14.0 -# Work around problem with autodoc_typehints -# https://github.com/theislab/scanpydoc/pull/32 -git+https://github.com/theislab/scanpydoc.git#egg=scanpydoc sphinx-book-theme scanpydoc ipython diff --git a/setup.cfg b/setup.cfg index 7ff4242db..ccd41f694 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,7 +60,7 @@ plink = bed-reader vcf = aiohttp - cyvcf2 + cyvcf2 < 0.30.15 requests yarl bgen = diff --git a/sgkit/stats/aggregation.py b/sgkit/stats/aggregation.py index 98b08556f..1fb16fce9 100644 --- a/sgkit/stats/aggregation.py +++ b/sgkit/stats/aggregation.py @@ -916,7 +916,7 @@ def individual_heterozygosity( # use nan denominator to avoid divide by zero with K - 1 K2 = da.where(K > 1, K, np.nan) AF = AC / K2[..., None] - HI = (1 - da.sum(AF ** 2, axis=-1)) * (K / (K2 - 1)) + HI = (1 - da.sum(AF**2, axis=-1)) * (K / (K2 - 1)) new_ds = create_dataset( {variables.call_heterozygosity: (("variants", "samples"), HI)} ) diff --git a/sgkit/stats/association.py b/sgkit/stats/association.py index 3feafab76..b138720ca 100644 --- a/sgkit/stats/association.py +++ b/sgkit/stats/association.py @@ -78,7 +78,7 @@ def linear_regression( # from projection require no extra terms in variance # estimate for loop covariates (columns of G), which is # only true when an intercept is present. - XLPS = (XLP ** 2).sum(axis=0, keepdims=True).T + XLPS = (XLP**2).sum(axis=0, keepdims=True).T assert XLPS.shape == (n_loop_covar, 1) B = (XLP.T @ YP) / XLPS assert B.shape == (n_loop_covar, n_outcome) @@ -86,7 +86,7 @@ def linear_regression( # Compute residuals for each loop covariate and outcome separately YR = YP[:, np.newaxis, :] - XLP[..., np.newaxis] * B[np.newaxis, ...] assert YR.shape == (n_obs, n_loop_covar, n_outcome) - RSS = (YR ** 2).sum(axis=0) + RSS = (YR**2).sum(axis=0) assert RSS.shape == (n_loop_covar, n_outcome) # Get t-statistics for coefficient estimates T = B / np.sqrt(RSS / dof / XLPS) @@ -382,7 +382,7 @@ def regenie_loco_regression( Y -= Y.mean(axis=0) # Orthogonally project covariates out of phenotype matrix Y -= Q @ (Q.T @ Y) - Y_scale = da.sqrt(da.sum(Y ** 2, axis=0) / (Y.shape[0] - Q.shape[1])) + Y_scale = da.sqrt(da.sum(Y**2, axis=0) / (Y.shape[0] - Q.shape[1])) # Scale Y /= Y_scale[None, :] diff --git a/sgkit/stats/ld.py b/sgkit/stats/ld.py index 35a906bd0..f96acdbf3 100644 --- a/sgkit/stats/ld.py +++ b/sgkit/stats/ld.py @@ -41,8 +41,8 @@ def rogers_huff_r_between(gn0: ArrayLike, gn1: ArrayLike) -> float: # pragma: n n += 1 m0 += x m1 += y - v0 += x ** 2 - v1 += y ** 2 + v0 += x**2 + v1 += y**2 cov += x * y # early out diff --git a/sgkit/stats/popgen.py b/sgkit/stats/popgen.py index ca79ffcbb..45d6b92ca 100644 --- a/sgkit/stats/popgen.py +++ b/sgkit/stats/popgen.py @@ -591,11 +591,11 @@ def Tajimas_D( # calculate the denominator (standard deviation) a2 = (1 / (da.arange(1, n) ** 2)).sum() b1 = (n + 1) / (3 * (n - 1)) - b2 = 2 * (n ** 2 + n + 3) / (9 * n * (n - 1)) + b2 = 2 * (n**2 + n + 3) / (9 * n * (n - 1)) c1 = b1 - (1 / a1) - c2 = b2 - ((n + 2) / (a1 * n)) + (a2 / (a1 ** 2)) + c2 = b2 - ((n + 2) / (a1 * n)) + (a2 / (a1**2)) e1 = c1 / a1 - e2 = c2 / (a1 ** 2 + a2) + e2 = c2 / (a1**2 + a2) d_stdev = da.sqrt((e1 * S) + (e2 * S * (S - 1))) # Let IEEE decide the semantics of division by zero here. The return value @@ -770,7 +770,7 @@ def _Garud_h(haplotypes: ArrayLike) -> ArrayLike: f = counts / n # type: ignore[operator] # compute H1 - h1 = np.sum(f ** 2) + h1 = np.sum(f**2) # compute H12 h12 = np.sum(f[:2]) ** 2 + np.sum(f[2:] ** 2) # type: ignore[index]