<commit_before>#!/usr/bin/env python
import sys

from pydigree.simulation import ConstrainedMendelianSimulation
from pydigree import read_ped, read_gs_chromosome_template

fixedlocus = 0, 10

peds = read_ped(sys.argv[1])
peds.add_chromosome(read_gs_chromosome_template(sys.argv[2]))

sim = ConstrainedMendelianSimulation(peds)
sim.add_genotype_constraint(peds['1']['1'], fixedlocus, 4, 'P')
sim.add_ibd_constraint(peds['1']['3'], peds['1']['1'], fixedlocus, 'P')
for i in xrange(100):
    sim.replicate()
    print peds['1']['1'].get_genotype(fixedlocus), peds['1']['3'].get_genotype(fixedlocus)

print 'done'
<commit_msg>add trait modelling<commit_after>#!/usr/bin/env python
import sys

from pydigree.simulation import *
from pydigree import read_ped, read_gs_chromosome_template

fixedlocus = 0, 4
print 'Reading ped'
peds = read_ped(sys.argv[1])
print 'Reading chromosome'
peds.add_chromosome(read_gs_chromosome_template(sys.argv[2]))

sim = ConstrainedMendelianSimulation(peds)

trait = Architecture('affected', type='dichotomous')
trait.add_effect(fixedlocus, {(4,2): 1, (4,1): 1, (1,1): 0})
trait.set_liability_threshold(.5)
sim.set_trait(trait)

sim.add_genotype_constraint(peds['1']['1'], fixedlocus, 4, 'P')
sim.add_ibd_constraint(peds['1']['3'], peds['1']['1'], fixedlocus, 'P')
for i in xrange(100):
    print 'Replicate %s' % i
    sim.replicate()


{'fraction_non_alphanumeric': 0.16152716593245228, 'fraction_numerical': 0.0315712187958884, 'mean_word_length': 7.572327044025157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '393108', 'n_tokens_mistral': 561, 'n_tokens_neox': 518, 'n_words': 96}