malariagen_data.af1.Af1.snp_allele_frequencies_advanced#
- Af1.snp_allele_frequencies_advanced(transcript: str, area_by: str, period_by: Literal['year', 'quarter', 'month'], sample_sets: Sequence[str] | str | None = None, sample_query: str | None = None, sample_query_options: dict | None = None, min_cohort_size: int = 10, drop_invariant: bool = True, variant_query: str | None = None, site_mask: str | None = None, nobs_mode: Literal['called', 'fixed'] = 'called', ci_method: Literal['normal', 'agresti_coull', 'beta', 'wilson', 'binom_test'] | None = 'wilson', chunks: int | str | Tuple[int | str, ...] | Callable[[Tuple[int, ...]], int | str | Tuple[int | str, ...]] = 'native', inline_array: bool = True) Dataset #
Group samples by taxon, area (space) and period (time), then compute SNP allele frequencies.
Parameters#
- transcriptstr
Gene transcript identifier.
- area_bystr
Column name in the sample metadata to use to group samples spatially. E.g., use “admin1_iso” or “admin1_name” to group by level 1 administrative divisions, or use “admin2_name” to group by level 2 administrative divisions.
- period_by{‘year’, ‘quarter’, ‘month’}
Length of time to group samples temporally.
- 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.
- 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.
- min_cohort_sizeint, optional, default: 10
Minimum cohort size. Raise an error if the number of samples is less than this value.
- drop_invariantbool, optional, default: True
If True, drop variants not observed in the selected samples.
- variant_querystr or None, optional
A pandas query to be evaluated against variants.
- site_maskstr or None, optional
Which site filters mask to apply. See the site_mask_ids property for available values.
- nobs_mode{‘called’, ‘fixed’}, optional, default: ‘called’
Method for calculating the denominator when computing frequencies. If “called” then use the number of called alleles, i.e., number of samples with non-missing genotype calls multiplied by 2. If “fixed” then use the number of samples multiplied by 2.
- ci_method{‘normal’, ‘agresti_coull’, ‘beta’, ‘wilson’, ‘binom_test’} or None, optional, default: ‘wilson’
Method to use for computing confidence intervals, passed through to statsmodels.stats.proportion.proportion_confint.
- chunksint or str or tuple of int or str or Callable[[typing.Tuple[int, …]], int or str or tuple of int or str], optional, default: ‘native’
Define how input data being read from zarr should be divided into chunks for a dask computation. If ‘native’, use underlying zarr chunks. If a string specifying a target memory size, e.g., ‘300 MiB’, resize chunks in arrays with more than one dimension to match this size. If ‘auto’, let dask decide chunk size. If ‘ndauto’, let dask decide chunk size but only for arrays with more than one dimension. If ‘ndauto0’, as ‘ndauto’ but only vary the first chunk dimension. If ‘ndauto1’, as ‘ndauto’ but only vary the second chunk dimension. If ‘ndauto01’, as ‘ndauto’ but only vary the first and second chunk dimensions. Also, can be a tuple of integers, or a callable which accepts the native chunks as a single argument and returns a valid dask chunks value.
- inline_arraybool, optional, default: True
Passed through to dask from_array().
Returns#
- Dataset
The resulting dataset contains data has dimensions “cohorts” and “variants”. Variables prefixed with “cohort” are 1-dimensional arrays with data about the cohorts, such as the area, period, taxon and cohort size. Variables prefixed with “variant” are 1-dimensional arrays with data about the variants, such as the contig, position, reference and alternate alleles. Variables prefixed with “event” are 2-dimensional arrays with the allele counts and frequency calculations.