mecfs_bio.build_system.task.fast_ct_ldsc.trait_matrix
Stack the aligned traits of a fast CT-LDSC study into (S, T) matrices over the shared context.
Glossary: S is the number of context (regression) SNPs and T the number of traits. Column t of z and n holds trait t's aligned z-score and per-SNP sample size (NaN where the trait lacks the variant), in context row order.
Classes:
-
TraitMatrix–The study's traits over the shared context: z and n are (S, T); aliases, diagnostics and
Functions:
-
assert_valid_study–A study needs at least two traits with unique aliases, ordered by lower-cased alias.
-
estimate_trait_contexts–Each trait's own-set LDSC heritability fit (estimate_trait_context), in column order.
-
load_trait_matrix–Read every aligned trait and stack it, asserting each was aligned to this context.
-
multi_trait_table_meta– -
study_deps–
TraitMatrix
The study's traits over the shared context: z and n are (S, T); aliases, diagnostics and sample_infos are length T, in column order.
Attributes:
-
aliases(tuple[str, ...]) – -
context(PppLdscContext) – -
diagnostics(tuple[AlignmentDiagnostics, ...]) – -
n(ndarray) – -
sample_infos(tuple[PhenotypeInfo, ...]) – -
z(ndarray) –
assert_valid_study
A study needs at least two traits with unique aliases, ordered by lower-cased alias.
Source code in mecfs_bio/build_system/task/fast_ct_ldsc/trait_matrix.py
estimate_trait_contexts
Each trait's own-set LDSC heritability fit (estimate_trait_context), in column order.
Source code in mecfs_bio/build_system/task/fast_ct_ldsc/trait_matrix.py
load_trait_matrix
load_trait_matrix(
index_task: FastCtLdscVariantIndexTask,
aligned_tasks: Sequence[FastCtLdscAlignedTraitTask],
fetch: Fetch,
) -> TraitMatrix
Read every aligned trait and stack it, asserting each was aligned to this context.