cellink.tl.external.make_annot_from_donor_data#
- cellink.tl.external.make_annot_from_donor_data(dd, annot_file, gene_set_file=None, bed_file=None, nomerge=False, run=True, runner=None, scores=None, score_agg='max', gene_coord_file=None, windowsize=100000, out_prefix='ldsc_annot', cleanup_files=True, plink_export_kwargs=None, **kwargs)#
Create a binary or continuous S-LDSC annotation file from a DonorData object.
Exports genotype data to PLINK format, then delegates to
make_annot_from_bimfile(). Passscoresfor continuous mode orgene_set_file/bed_filefor binary mode.- Parameters:
dd (DonorData) – DonorData object containing genotype information.
annot_file (str) – Output annotation file. Should end in
.annot.gz.gene_set_file (str, optional) – Binary mode. File of gene names, one per line.
bed_file (str, optional) – Binary mode. UCSC BED file defining annotation regions.
nomerge (bool, default False) – Binary mode. Count overlapping BED intervals instead of merging.
run (bool, default True) – Binary mode. If
False, return the command without executing.runner (LDSCRunner, optional) – Binary mode. LDSC runner.
scores (pd.Series, optional) – Continuous mode. Per-gene scores indexed by gene IDs matching
gene_coord_file.score_agg ({"max", "sum", "mean"}, default "max") – Continuous mode. Aggregation rule for overlapping gene windows.
gene_coord_file (str, optional) – Gene coordinate file. Required in continuous mode.
windowsize (int, default 100_000) – Flanking window in bp around each gene body.
out_prefix (str, default "ldsc_annot") – Prefix for temporary PLINK files created during export.
cleanup_files (bool, default True) – Remove temporary .bed/.bim/.fam files after writing.
plink_export_kwargs (dict, optional) – Extra keyword arguments forwarded to
to_plink().**kwargs – Binary mode. Extra flags forwarded to
make_annot.py.
- Return type:
- Returns:
dict Same as
make_annot_from_bimfile().
Examples
Binary annotation:
>>> make_annot_from_donor_data( ... dd=my_donor_data, ... annot_file="CD8_Naive.annot.gz", ... gene_set_file="CD8_Naive.GeneSet", ... gene_coord_file="gene_coords.txt", ... )
Continuous annotation:
>>> make_annot_from_donor_data( ... dd=my_donor_data, ... annot_file="CD8_Naive.annot.gz", ... scores=specificity_df["CD8 Naive"], ... gene_coord_file="gene_coords.txt", ... )