Пример #1
0
for freq in args.freqs:
    chr, idx, maf = freq
    maf = float(maf)
    chr, idx = int(chr), int(idx)
    # TODO: Sort out frequency semantics
    template.chromosomes[chr].frequencies[idx] = 1-maf
    
# Simulation method
if args.method.lower() == 'constrained':
    sim = ConstrainedMendelianSimulation(template, replications=args.replications)
elif args.method.lower() == 'genedrop':
    sim = NaiveGeneDroppingSimulation(template, replications=args.replications)

# Read effects file
if args.effectfile:
    trait = Architecture.from_file(args.effectsfile)
    trait.name = 'affected'
else:
    trait = Architecture('affected','dichotomous')

# More effects. Specified effects override file effects.
if args.effects:
    for effect in args.effects:
        chr, pos, a, k = effect
        locus = int(chr), int(pos)
        a, k = int(a), int(k)
        trait.add_effect(locus, a, k)
    if args.lthresh:
        trait.set_liability_threshold(args.lthresh)

if args.effects or args.effectfile: