def make_pheno(pheno_name, use_maf, use_af, use_ac, use_ns):
ns = random.randrange(100, 10_000)
num_chromosomes = ns*2
with TSVWriter(f'input_files/assoc-files/{pheno_name}.txt') as writer:
for v in variants:
if v['chrom'] == '1' and v['pos'] == 869334 or random.random() < 100 / len(variants):
d = dict(
chrom=v['chrom'],
pos=v['pos'],
ref=v['ref'],
alt=v['alt'],
pval=format_float(random.random()),
)
ac = random.randrange(0,num_chromosomes+1) # allow MAF=0 b/c I'm sure somebody will.
af = ac / num_chromosomes
if use_maf: d['maf'] = format_float(min(af, 1-af))
if use_af: d['af'] = format_float(af)
if use_ac: d['ac'] = ac
if use_ns: d['ns'] = ns
writer.writerow(d)
评论列表
文章目录