def nsharehelper(x): if x % 1000 == 0: print 'Random draw %s' % x if args.matchkinship: ns = match_kinship_sample(affinds, fullinds, threshold=0.001) else: ns = random.sample(fullinds, naff) return shares(ns, shared, nmark)
def sbool(affs, shared, nmark): return shares(affs, shared, nmark) / float(npairs(affs))
def spairs(affs, shared, nmark): return shares(affs, shared, nmark)
with open(args.kinship) as kinshf: for line in kinshf: fam, ida, idb, phi = line.strip().split() ida = tuple(fam, ida) idb = tuple(fam, idb) if not {ida, idb} <= fullinds: continue else: kinship[frozenset({ida, idb})] = float(phi) for a,b in combinations(fullinds, 2): pair = frozenset({a,b}) if pair not in kinship: kinship[pair] = 0 print 'Calculating sharing from affecteds' affshare = shares(affinds, shared, nmark) print 'Model: %s' % args.model print 'Calculating emperical p-values from %s draws of %s individuals' % (args.nrep, naff) print 'Using %s processes' % args.njobs def nsharehelper(x): if x % 1000 == 0: print 'Random draw %s' % x if args.matchkinship: ns = match_kinship_sample(affinds, fullinds, threshold=0.001) else: ns = random.sample(fullinds, naff) return shares(ns, shared, nmark) if args.njobs > 1: