File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ Sgkit functions are compatible with this idiom by default and this example shows
255
255
Xarray and Pandas operations in a single pipeline:
256
256
257
257
.. ipython :: python
258
+ :okwarning:
258
259
259
260
import sgkit as sg
260
261
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:
276
277
# Assign a "cohort" variable that splits samples into two groups
277
278
.assign(sample_cohort = np.repeat([0 , 1 ], ds.dims[' samples' ] // 2 ))
278
279
# 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
283
283
)
284
284
285
285
This is possible because sgkit functions nearly always take a ``Dataset `` as the first argument, create new
You can’t perform that action at this time.
0 commit comments