cellink.tl.external.bedgraph_to_snp_annotation#
- cellink.tl.external.bedgraph_to_snp_annotation(bedgraph, bim_file, out_prefix, *, use_bedtools=True)#
Convert a bedgraph file to an S-LDSC annotation file (.annot.gz).
Implements the logic of GSSG’s
bedgraph_to_annot.py. Each SNP in the BIM file is assigned the score of the bedgraph interval it falls within (0 if not covered).- Parameters:
bedgraph (
DataFrame|str|Path) – Bedgraph DataFrame with columns (chr, start, end, score), or path to file.bim_file (
str|Path) – PLINK BIM file defining SNP positions.out_prefix (
str) – Output prefix; the file{out_prefix}.annot.gzis written.use_bedtools (
bool(default:True)) – If True and bedtools is available, use bedtools intersect (more robust). Otherwise falls back to pure-Python interval lookup.
- Return type:
- Returns:
Path Path to the written annotation file.