Association and Utilities¶
High-level association testing helpers and label-table utilities used across plotting and dimensionality-reduction workflows.
GWAS and admixture mapping¶
- snputils.run_gwas(phe_path, snp_path, results_path='gwas.tsv.gz', phe_id=None, batch_size=256, memory=None, return_results=True, quantitative=None, verbose=False, covar=None, covar_path=None, covar_col_nums=None, covar_variance_standardize=False, ci=None, adjust=False, keep_path=None, remove_path=None, exclude_path=None, vcf_backend='polars')[source]¶
Run variant-level association testing.
phe_pathmay be a phenotype file path or an in-memoryPhenotypeObject.snp_pathmay be a genotype file path, reader, or in-memorySNPObject.covarmay be a covariate file path or an in-memoryCovariateObject;covar_pathis retained as a backward-compatible alias.phe_idis required only when the phenotype input is a file path. Results are written toresults_path(default: gwas.tsv.gz).
- snputils.run_admixture_mapping(phe_path, lai_source=None, results_path='admixmap.tsv.gz', phe_id=None, batch_size=256, keep_hla=False, memory=None, return_results=True, quantitative=None, verbose=False, covar=None, covar_path=None, covar_col_nums=None, covar_variance_standardize=False, ci=None, adjust=False, keep_path=None, remove_path=None)[source]¶
Run window-level admixture mapping from a local ancestry file or LAI object.
- Parameters:
phe_path – Phenotype file path or in-memory
PhenotypeObject.lai_source – Local ancestry source. Pass an MSP/FLARE file path or an in-memory
LocalAncestryObject.results_path – Output TSV path or directory (default: admixmap.tsv.gz).
phe_id – Phenotype column name to analyze. Required when
phe_pathis a file path; inferred fromPhenotypeObject.phenotype_namefor in-memory phenotype input.covar – Covariate file path or in-memory
CovariateObject.covar_pathis retained as a backward-compatible alias.
Both functions accept file paths or in-memory objects and return a DataFrame with per-variant statistics suitable for Visualization.
Sample labels¶
- snputils.read_labels(file, sep='\t')[source]¶
Read an individual-label table used by dimensionality-reduction plots.
The returned DataFrame has
indIDcoerced to string and must include at leastindIDandlabelcolumns.
Label tables must include indID and label columns. They are used by scatter plots, mdPCA, and maasMDS.