# Path: pydigree/ibs.py
# def get_ibs_states(ind1, ind2, chromosome_index, missingval=64):
# def chromwide_ibs(a, b, c, d, missingval=64):


import pydigree
import itertools
import argparse
import numpy as np
from pydigree.ibs import ibs
                    nargs='*', dest='onlypeds')
parser.add_argument('--writedist', 
                    help='Write null distribution to file')
parser.add_argument('--include-marryins', 
                    dest='remove_mif', action='store_false',
                    help='Include affected marry-in founders in IBD scores')
parser.add_argument('--scorefunction', '-s', 
                    dest='scorefunc', default='sbool')
parser.add_argument('--seed', type=int, help='Random seed', default=None)
args = parser.parse_args()


if args.seed is not None:
    pydigree.set_seed(args.seed)


def spairs(inds, loc):
    
    "Returns total number of IBD alleles"

    r = [ibs(j.get_genotype(loc, checkhasgeno=False),
             k.get_genotype(loc, checkhasgeno=False)) 
         for j, k in itertools.combinations(inds, 2)]
    return sum(r)

def sbool(inds, loc):
    
    "Returns proportion of pairs IBD != 0"

    npairs = float(len(inds) * (len(inds) - 1) / 2)

# Path: pydigree/ibs.py
# def get_ibs_states(ind1, ind2, chromosome_index, missingval=64):
# def chromwide_ibs(a, b, c, d, missingval=64):


# Path: scripts/genedrop.py
import pydigree
import itertools
import argparse
import numpy as np
from pydigree.ibs import ibs

                    nargs='*', dest='onlypeds')
parser.add_argument('--writedist', 
                    help='Write null distribution to file')
parser.add_argument('--include-marryins', 
                    dest='remove_mif', action='store_false',
                    help='Include affected marry-in founders in IBD scores')
parser.add_argument('--scorefunction', '-s', 
                    dest='scorefunc', default='sbool')
parser.add_argument('--seed', type=int, help='Random seed', default=None)
args = parser.parse_args()


if args.seed is not None:
    pydigree.set_seed(args.seed)


def spairs(inds, loc):
    
    "Returns total number of IBD alleles"

    r = [ibs(j.get_genotype(loc, checkhasgeno=False),
             k.get_genotype(loc, checkhasgeno=False)) 
         for j, k in itertools.combinations(inds, 2)]
    return sum(r)

def sbool(inds, loc):
    
    "Returns proportion of pairs IBD != 0"

    npairs = float(len(inds) * (len(inds) - 1) / 2)

    r = [ibs(j.get_genotype(loc, checkhasgeno=False),