LD data from CEU hg18
Description
LD data from CEU hg18, based on ftp://ftp.ncbi.nlm.nih.gov/hapmap/ld_data/latest
Algo for computing:
import pandas as pd
rule ld_blocks:
input:
expand("blocks/{chromosome}_blocks.gz", chromosome=["chr{}".format(c) for c in list(range(1, 23)) + ["X"]])
rule get_blocks:
output:
"blocks/{chromosome}_blocks.gz"
run:
c = wildcards.chromosome
f = r"ftp://ftp.ncbi.nlm.nih.gov/hapmap/ld_data/latest/ld_{}_CEU.txt.gz".format(c)
print(f)
df = pd.read_csv(f,
sep=" ", header=None, usecols=[0, 1, 8])
print(df.head())
df.columns = "Start End Block".split()
ls = df.groupby("Block").agg({"Start": "first", "End": "last", "Block": ["first", "count"]}).reset_index(drop=True)
ls.columns = "Start End LDBlock Count".split()
lengths = ls["End"] - ls["Start"]
ls.insert(ls.shape[1], "Length", lengths)
ls.insert(0, "Chromosome", c)
ls.to_csv(output[0], sep="\t", index=None)
Files
Files
(483.4 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:c011be4066c822e554392dc0d97214b6
|
483.4 kB | Download |