Skip to content

Commit d798e95

Browse files
tomwhitemergify[bot]
authored andcommitted
1 parent b42b0b8 commit d798e95

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
hooks:
1313
- id: isort
1414
- repo: https://github.com/python/black
15-
rev: 20.8b1
15+
rev: 21.10b0
1616
hooks:
1717
- id: black
1818
language_version: python3

sgkit/io/bgen/bgen_reader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def _read_metafile_partition(path: Path, partition: int) -> pd.DataFrame:
175175

176176

177177
def read_metafile(path: PathType) -> dd.DataFrame:
178-
""" Read cbgen metafile containing partitioned variant info """
178+
"""Read cbgen metafile containing partitioned variant info"""
179179
with bgen_metafile(path) as mf:
180180
divisions = [mf.partition_size * i for i in range(mf.npartitions)] + [
181181
mf.nvariants - 1
@@ -189,7 +189,7 @@ def read_metafile(path: PathType) -> dd.DataFrame:
189189

190190

191191
def read_samples(path: PathType) -> pd.DataFrame:
192-
""" Read BGEN .sample file """
192+
"""Read BGEN .sample file"""
193193
df = pd.read_csv(path, sep=" ", skiprows=[1], usecols=[0])
194194
df.columns = ["sample_id"]
195195
return df

sgkit/io/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
def dataframe_to_dict(
2424
df: dd.DataFrame, dtype: Optional[Mapping[str, DType]] = None
2525
) -> Mapping[str, ArrayLike]:
26-
""" Convert dask dataframe to dictionary of arrays """
26+
"""Convert dask dataframe to dictionary of arrays"""
2727
arrs = {}
2828
for c in df:
2929
a = df[c].to_dask_array(lengths=True)

sgkit/stats/pca.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def pca_est(
2828
random_state: RandomStateType = 0,
2929
variable: str = "call_alternate_allele_count",
3030
) -> BaseEstimator:
31-
""" Create PCA estimator """
31+
"""Create PCA estimator"""
3232
if ploidy is None:
3333
if "ploidy" not in ds.dims:
3434
raise ValueError(
@@ -79,7 +79,7 @@ def pca_fit(
7979
variable: str = "call_alternate_allele_count",
8080
check_missing: bool = True,
8181
) -> BaseEstimator:
82-
""" Fit PCA estimator """
82+
"""Fit PCA estimator"""
8383
AC = _allele_counts(ds, variable, check_missing=check_missing)
8484
return est.fit(da.asarray(AC).T)
8585

@@ -92,7 +92,7 @@ def pca_transform(
9292
check_missing: bool = True,
9393
merge: bool = True,
9494
) -> Dataset:
95-
""" Apply PCA estimator to new data """
95+
"""Apply PCA estimator to new data"""
9696
AC = _allele_counts(ds, variable, check_missing=check_missing)
9797
projection = est.transform(da.asarray(AC).T)
9898
new_ds = Dataset(
@@ -111,7 +111,7 @@ def _get(est: BaseEstimator, attr: str, fn: Any = lambda v: v) -> Optional[Array
111111

112112

113113
def pca_stats(ds: Dataset, est: BaseEstimator, *, merge: bool = True) -> Dataset:
114-
""" Extract attributes from PCA estimator """
114+
"""Extract attributes from PCA estimator"""
115115
new_ds = {
116116
variables.sample_pca_component: (
117117
("variants", "components"),

sgkit/tests/test_pca.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def simulate_cohort_genotypes(
1717
n_variant: int, n_sample: int, n_cohort: int, seed: int = 0
1818
) -> NDArray:
19-
""" Sample genotypes from distinct ancestral populations """
19+
"""Sample genotypes from distinct ancestral populations"""
2020
rs = np.random.RandomState(seed)
2121
# Determine size of each cohort (which will be roughly equal)
2222
cohort_sizes = list(map(len, np.array_split(np.arange(n_sample), n_cohort)))
@@ -38,7 +38,7 @@ def simulate_dataset(
3838
n_cohort: Optional[int] = None,
3939
chunks: Any = (None, None),
4040
) -> Dataset:
41-
""" Simulate dataset with optional population structure """
41+
"""Simulate dataset with optional population structure"""
4242
ds = simulate_genotype_call_dataset(n_variant, n_sample, seed=0)
4343
if n_cohort:
4444
ac = simulate_cohort_genotypes(
@@ -284,7 +284,7 @@ def validate_allel_comparison(ds_sg: Dataset, ds_sk: Dataset) -> None:
284284

285285

286286
def _align_vectors(x: ArrayLike, axis: int) -> ArrayLike:
287-
""" Align vectors to common, arbitrary half-space """
287+
"""Align vectors to common, arbitrary half-space"""
288288
assert x.ndim == 2
289289
v = np.random.RandomState(1).rand(x.shape[axis])
290290
signs = np.dot(x, v)[:, np.newaxis] if axis == 1 else np.dot(v[np.newaxis], x)

0 commit comments

Comments
 (0)