malariagen_data.ag3.Ag3.phenotype_binary#

Ag3.phenotype_binary(sample_sets: Sequence[str] | str | None = None, insecticide: str | List[str] | None = None, dose: float | List[float] | None = None, phenotype: str | List[str] | None = None, sample_query: str | None = None, sample_query_options: dict | None = None, cohort_size: int | None = None, min_cohort_size: int | None = None, max_cohort_size: int | None = None) Series#

Convert phenotype data into binary format for statistical analysis.

Parameters#

sample_setssequence of str or str or None, optional

List of sample sets and/or releases. Can also be a single sample set or release.

insecticidestr or list of str or None or None, optional

Insecticide name(s) to filter by. Can be a single insecticide name or a list of names.

dosefloat or list of float or None or None, optional

Insecticide dose(s) to filter by. Can be a single dose value or a list of dose values.

phenotypestr or list of str or None or None, optional

Phenotype outcome(s) to filter by. Can be a single phenotype value (e.g., ‘alive’, ‘dead’) or a list of values.

sample_querystr or None, optional

A pandas query string to be evaluated against the sample metadata, to select samples to be included in the returned data.

sample_query_optionsdict or None, optional

A dictionary of arguments that will be passed through to pandas query() or eval(), e.g. parser, engine, local_dict, global_dict, resolvers.

cohort_sizeint or None, optional

Randomly down-sample to this value if the number of samples in the cohort is greater. Raise an error if the number of samples is less than this value.

min_cohort_sizeint or None, optional

Minimum cohort size. Raise an error if the number of samples is less than this value.

max_cohort_sizeint or None, optional

Randomly down-sample to this value if the number of samples in the cohort is greater.

Returns#

binarySeries

Pandas Series indexed by sample_id with binary classification: 1 for resistant, 0 for susceptible, NaN for unknown.