Skip to content

Commit abba58d

Browse files
tomwhitemergify[bot]
authored andcommitted
Formatting changes from Black
1 parent 07f31ff commit abba58d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

sgkit/stats/aggregation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def individual_heterozygosity(
916916
# use nan denominator to avoid divide by zero with K - 1
917917
K2 = da.where(K > 1, K, np.nan)
918918
AF = AC / K2[..., None]
919-
HI = (1 - da.sum(AF ** 2, axis=-1)) * (K / (K2 - 1))
919+
HI = (1 - da.sum(AF**2, axis=-1)) * (K / (K2 - 1))
920920
new_ds = create_dataset(
921921
{variables.call_heterozygosity: (("variants", "samples"), HI)}
922922
)

sgkit/stats/association.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ def linear_regression(
7878
# from projection require no extra terms in variance
7979
# estimate for loop covariates (columns of G), which is
8080
# only true when an intercept is present.
81-
XLPS = (XLP ** 2).sum(axis=0, keepdims=True).T
81+
XLPS = (XLP**2).sum(axis=0, keepdims=True).T
8282
assert XLPS.shape == (n_loop_covar, 1)
8383
B = (XLP.T @ YP) / XLPS
8484
assert B.shape == (n_loop_covar, n_outcome)
8585

8686
# Compute residuals for each loop covariate and outcome separately
8787
YR = YP[:, np.newaxis, :] - XLP[..., np.newaxis] * B[np.newaxis, ...]
8888
assert YR.shape == (n_obs, n_loop_covar, n_outcome)
89-
RSS = (YR ** 2).sum(axis=0)
89+
RSS = (YR**2).sum(axis=0)
9090
assert RSS.shape == (n_loop_covar, n_outcome)
9191
# Get t-statistics for coefficient estimates
9292
T = B / np.sqrt(RSS / dof / XLPS)
@@ -382,7 +382,7 @@ def regenie_loco_regression(
382382
Y -= Y.mean(axis=0)
383383
# Orthogonally project covariates out of phenotype matrix
384384
Y -= Q @ (Q.T @ Y)
385-
Y_scale = da.sqrt(da.sum(Y ** 2, axis=0) / (Y.shape[0] - Q.shape[1]))
385+
Y_scale = da.sqrt(da.sum(Y**2, axis=0) / (Y.shape[0] - Q.shape[1]))
386386
# Scale
387387
Y /= Y_scale[None, :]
388388

sgkit/stats/ld.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def rogers_huff_r_between(gn0: ArrayLike, gn1: ArrayLike) -> float: # pragma: n
4141
n += 1
4242
m0 += x
4343
m1 += y
44-
v0 += x ** 2
45-
v1 += y ** 2
44+
v0 += x**2
45+
v1 += y**2
4646
cov += x * y
4747

4848
# early out

sgkit/stats/popgen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ def Tajimas_D(
591591
# calculate the denominator (standard deviation)
592592
a2 = (1 / (da.arange(1, n) ** 2)).sum()
593593
b1 = (n + 1) / (3 * (n - 1))
594-
b2 = 2 * (n ** 2 + n + 3) / (9 * n * (n - 1))
594+
b2 = 2 * (n**2 + n + 3) / (9 * n * (n - 1))
595595
c1 = b1 - (1 / a1)
596-
c2 = b2 - ((n + 2) / (a1 * n)) + (a2 / (a1 ** 2))
596+
c2 = b2 - ((n + 2) / (a1 * n)) + (a2 / (a1**2))
597597
e1 = c1 / a1
598-
e2 = c2 / (a1 ** 2 + a2)
598+
e2 = c2 / (a1**2 + a2)
599599
d_stdev = da.sqrt((e1 * S) + (e2 * S * (S - 1)))
600600

601601
# Let IEEE decide the semantics of division by zero here. The return value
@@ -770,7 +770,7 @@ def _Garud_h(haplotypes: ArrayLike) -> ArrayLike:
770770
f = counts / n # type: ignore[operator]
771771

772772
# compute H1
773-
h1 = np.sum(f ** 2)
773+
h1 = np.sum(f**2)
774774

775775
# compute H12
776776
h12 = np.sum(f[:2]) ** 2 + np.sum(f[2:] ** 2) # type: ignore[index]

0 commit comments

Comments
 (0)