def fit_alternative_model(self): ibd_model = MixedModel(self.pedigrees, outcome=self.outcome, fixed_effects=self.fixed_effects) ibd_model.add_genetic_effect() ranef = RandomEffect(self.analysis_individuals, 'IBD', incidence_matrix='eye', covariance_matrix=self.ibd_matrix) ibd_model.add_random_effect(ranef) ibd_model.fit_model() ibd_model.maximize(verbose=self.verbose, method=self.maximization) return ibd_model
def fit_null_model(self): null_model = MixedModel(self.pedigrees, outcome=self.outcome, fixed_effects=self.fixed_effects) null_model.add_genetic_effect() null_model.fit_model() null_model.maximize(method=self.maximization, verbose=self.verbose) return null_model
def vc_linkage(locus): ibd_model = MixedModel( peds, outcome=args.outcome, fixed_effects=args.fixefs) add_relat_mat = null_model.covariance_matrices[0] additive = RandomEffect(analysis_individuals, 'additive', incidence_matrix='eye', covariance_matrix=add_relat_mat) ibdmat = sgs.ibd_matrix(analysis_individuals, locus, location_type='index', onlywithin=args.onlywithin) ranef = RandomEffect(analysis_individuals, 'IBD', incidence_matrix='eye', covariance_matrix=ibdmat) ibd_model.add_random_effect(additive) ibd_model.add_random_effect(ranef) ibd_model.fit_model() ibd_model.maximize( verbose=args.verbose, method=args.maxmethod, starts=args.starts) return ibd_model
pydigree.io.read_phenotypes(peds, args.phen) # Get valid individuals from phenotypes analysis_individuals = [x for x in peds.individuals if args.outcome in x.phenotypes] # Read SGS data print 'Reading SGS data' sgs = read_germline(args.sgs) print 'Updating references' sgs.update_segment_references(peds) 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) null_model.summary() llik_null = null_model.loglikelihood() print 'Done' analysis_individuals = null_model.observations() def vc_linkage(locus): ibd_model = MixedModel( peds, outcome=args.outcome, fixed_effects=args.fixefs) add_relat_mat = null_model.covariance_matrices[0] additive = RandomEffect(analysis_individuals,