Exemple #1
0
print('Reading phenotypes')
pyd.io.read_phenotypes(peds, args.phen)
print('Reading genotypes')
genodata = pyd.io.plink.read_plink(pedfile=args.geno,
                                   mapfile=args.map)

peds.update(genodata)

print('Fitting polygenic model')
null_model = MixedModel(peds, outcome=args.outcome, fixed_effects=args.fixefs)
null_model.add_genetic_effect()
null_model.fit_model()
null_model.maximize(method=args.maxmethod,
                    verbose=args.verbose,
                    restricted=False)
null_model.summary()
llik_null = null_model.loglikelihood()


def parse_range(rangestr):
    chrom, span = rangestr.split(':')
    chrom = chrom.replace('chr', '')
    span = [int(x) for x in span.split('-')]
    return chrom, span[0], span[1]

granges = [parse_range(x) for x in args.range]


def tableformat(*cells):
    return ''.join(['{:<12}'.format(x) for x in cells])
Exemple #2
0
print('Reading phenotypes')
pyd.io.read_phenotypes(peds, args.phen)
print('Reading genotypes')
genodata = pyd.io.plink.read_plink(pedfile=args.geno,
                                   mapfile=args.map)

peds.update(genodata)

print('Fitting polygenic model')
null_model = MixedModel(peds, outcome=args.outcome, fixed_effects=args.fixefs)
null_model.add_genetic_effect()
null_model.fit_model()
null_model.maximize(method=args.maxmethod,
                    verbose=args.verbose,
                    restricted=False)
null_model.summary()
llik_null = null_model.loglikelihood()


def parse_range(rangestr):
    chrom, span = rangestr.split(':')
    chrom = chrom.replace('chr', '')
    span = [int(x) for x in span.split('-')]
    return chrom, span[0], span[1]

granges = [parse_range(x) for x in args.range]


def tableformat(*cells):
    return ''.join(['{:<12}'.format(x) for x in cells])
Exemple #3
0
print('Calculating Kinships')
m.add_genetic_effect()

if args.d7:
    m.add_genetic_effect(kind='dominance')

print('Done')
m.fit_model()

if args.center:
    m.y = m._centery()

if args.inflate:
    m.y *= 100
if args.garbley:
    m.y = np.matrix(np.random.normal(10, 5, len(m.y))).T

starts = args.starts
if starts is not None:
    starts = [float(x) for x in starts]
m.maximize(method=args.maxmethod, verbose=True, starts=starts, restricted=args.reml)

m.summary()

if args.interact:
    try:
        from IPython import embed
        embed()
    except ImportError:
        print("IPython not found!")
Exemple #4
0
m = MixedModel(peds, outcome=args.outcome, fixed_effects=args.fixefs)
print('Calculating Kinships')
m.add_genetic_effect()

if args.d7:
    m.add_genetic_effect(kind='dominance')

print('Done')
m.fit_model()

if args.inflate:
    m.y *= 100
if args.garbley:
    m.y = np.matrix(np.random.normal(10, 5, len(m.y))).T

starts = args.starts
if starts is not None:
    starts = [float(x) for x in starts]
m.maximize(method=args.maxmethod, verbose=True,
           starts=starts, restricted=args.reml)

m.summary()

if args.interact:
    try:
        from IPython import embed
        embed()
    except ImportError:
        print("IPython not found!")