Skip to content

Commit a3feb0a

Browse files
tomwhitemergify[bot]
authored andcommitted
Fix Fst usage in Getting Started guide
1 parent 0e27171 commit a3feb0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/getting_started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ Sgkit functions are compatible with this idiom by default and this example shows
255255
Xarray and Pandas operations in a single pipeline:
256256

257257
.. ipython:: python
258+
:okwarning:
258259
259260
import sgkit as sg
260261
ds = sg.simulate_genotype_call_dataset(n_variant=100, n_sample=50, missing_pct=.1)
@@ -276,10 +277,9 @@ Xarray and Pandas operations in a single pipeline:
276277
# Assign a "cohort" variable that splits samples into two groups
277278
.assign(sample_cohort=np.repeat([0, 1], ds.dims['samples'] // 2))
278279
# Compute Fst between the groups
279-
# TODO: Refactor based on https://github.com/pystatgen/sgkit/pull/260
280-
.pipe(lambda ds: sg.Fst(*(g[1] for g in ds.groupby('sample_cohort'))))
281-
# Extract the single Fst value from the resulting array
282-
.item(0)
280+
.pipe(sg.Fst)
281+
# Extract the Fst values for cohort pairs
282+
.stat_Fst.values
283283
)
284284
285285
This is possible because sgkit functions nearly always take a ``Dataset`` as the first argument, create new

0 commit comments

Comments
 (0)