Skip to content

Commit 6730123

Browse files
Tristan DennisTristan Dennis
authored andcommitted
add docstring
1 parent cc5ed2d commit 6730123

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

malariagen_data/anoph/to_plink.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .snp_data import AnophelesSnpData
1010
from . import base_params
1111
from . import pca_params
12+
from numpydoc_decorator import doc # type: ignore
1213

1314

1415
class PlinkConverter(
@@ -23,6 +24,26 @@ def __init__(
2324
# to the superclass constructor.
2425
super().__init__(**kwargs)
2526

27+
@doc(
28+
summary="""
29+
Write Anopheles biallelic SNP data to the Plink binary file format.
30+
""",
31+
extended_summary="""
32+
This function writes biallelic SNPs to the Plink binary file format. It enables
33+
subsetting to specific regions (`region`), selecting specific sample sets, or lists of
34+
samples, randomly downsampling sites, and specifying filters based on missing data and
35+
minimum minor allele count (see the docs for `biallelic_snp_calls` for more information).
36+
The `overwrite` parameter, set to true, will enable overwrite of data with the same
37+
hash values (e.g. with a different randomly selected number of sites).
38+
""",
39+
returns=("Binary Plink output files: .bed, .bim, .fam"),
40+
notes="""
41+
This computation may take some time to run, depending on your computing
42+
environment. Unless the `overwrite` parameter is set to `True`, results will be loaded
43+
from a previous computation, if performed, and if the `results_cache` parameter was
44+
set when instantiating the API client.
45+
""",
46+
)
2647
def _create_plink_outfile(
2748
self,
2849
*,

tests/anoph/test_plink_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_plink_converter(fixture, api: PlinkConverter, tmp_path):
105105
api.biallelic_snps_to_plink(**plink_params)
106106

107107
# Test to see if bed, bim, fam output files exist.
108-
file_path = f"{tmp_path}/{plink_params['region']}.{plink_params['n_snps']}.{plink_params['min_minor_ac']}.{plink_params['thin_offset']}.{plink_params['max_missing_an']}"
108+
file_path = f"{tmp_path}/{plink_params['region']}.{plink_params['n_snps']}.{plink_params['min_minor_ac']}.{plink_params['max_missing_an']}.{plink_params['thin_offset']}"
109109

110110
assert os.path.exists(f"{file_path}.bed")
111111
assert os.path.exists(f"{file_path}.bim")

0 commit comments

Comments
 (0)