Skip to content

mecfs_bio.asset_generator.csf_coloc_asset_generator

Asset generator for colocalizing one trait GWAS with the Western et al. 2024 CSF aptamers: the CSF source (HapMap3 CSF hit table, remote-tabix window fetcher over the GWAS Catalog harmonised files, Entrez-id gene coordinates from the GRCh38 MAGMA gene table) plugged into the shared protein coloc generator.

The pair budget is larger than PPP's (CSF_SELECTION: 200 pairs, 20 per locus). PPP's budget exists because one PPP pair costs a whole Synapse tar download; one CSF pair costs a tabix index download plus a range read of a few seconds, so 200 pairs take roughly 15-30 minutes. The per-locus cap is raised because several aptamers often target one gene.

Functions:

Attributes:

CSF_COLOC_CONFIG module-attribute

CSF_COLOC_CONFIG = ColocRunConfig(selection=CSF_SELECTION)

CSF_SELECTION module-attribute

CSF_SELECTION = SelectionConfig(
    max_pairs=200, max_per_locus=20
)

generate_csf_coloc_tasks

generate_csf_coloc_tasks(
    base_name: str,
    trait_task: Task,
    trait_model: TraitModel,
    config: ColocRunConfig = CSF_COLOC_CONFIG,
    h4_threshold: float = 0.8,
    manifest_path: Path = CSF_APTAMER_MANIFEST_PATH,
) -> ColocTaskGroup

base_name: prefix of the asset ids ({base_name}_csf_coloc, ...). trait_task: the trait GWAS, genome-reference harmonized to GRCh38. trait_model: quantitative or case-control, as coloc.abf needs.

Source code in mecfs_bio/asset_generator/csf_coloc_asset_generator.py
def generate_csf_coloc_tasks(
    base_name: str,
    trait_task: Task,
    trait_model: TraitModel,
    config: ColocRunConfig = CSF_COLOC_CONFIG,
    h4_threshold: float = 0.8,
    manifest_path: Path = CSF_APTAMER_MANIFEST_PATH,
) -> ColocTaskGroup:
    """
    base_name: prefix of the asset ids ({base_name}_csf_coloc, ...).
    trait_task: the trait GWAS, genome-reference harmonized to GRCh38.
    trait_model: quantitative or case-control, as coloc.abf needs.
    """
    aptamers = load_csf_aptamer_files(manifest_path)
    source = ProteomicsColocSource(
        asset_infix="csf",
        hit_table_task=HAPMAP_3_CSF_HIT_TABLE_5E8,
        gene_coords_task=MAGMA_ENTREZ_GENE_LOCATION_REFERENCE_DATA_BUILD_38_EXTRACTED,
        gene_coords_reader=CsfGeneCoordsReader(aptamers=aptamers),
        fetcher=CsfWindowFetcher(aptamers=aptamers),
    )
    return generate_protein_coloc_tasks(
        base_name=base_name,
        source=source,
        trait_task=trait_task,
        trait_model=trait_model,
        config=config,
        h4_threshold=h4_threshold,
    )