Example #1
0
def pipeline_validation_experiment(location_file, true_type, true_location, pedigree, debug=False, remove_partial_calls=False):
    '''Load (the ''true'') genotypes from an external source. Load a list of locations from ''location_file''. Impute them and compare
    with the true genotypes.'''
    g = extract_genotypes(location_file)
    t = ImputationSet(pedigree, g)
    if true_type == 'iplex': true_genotype = im.imputation.reader.iplex_to_genotype(true_location, t)  # os.environ['OBER'] + '/data/impute/rare/to_livne_20121205', t)
    else: raise ValueError('Unsupported true genotype format ''%s''' % (true_type,))
    problem = Problem(pedigree, true_genotype)
    p, t = impute_problem(problem, debug=debug, remove_partial_calls=remove_partial_calls)
    return p, t
Example #2
0
#!/usr/bin/env python
'''
============================================================
Hutt Kids - compute chr 22 phasing stats. 

Created on July 15, 2013
@author: Oren Livne <*****@*****.**>
============================================================
'''
import impute as im, os, numpy as np
from impute.imputation.ImputationSet import ImputationSet

path = os.environ['OBER_OUT'] + '/kids'
chrom = 22
prefix = path + '/cytosnp/chr%d/cytosnp.imputed' % (chrom,)

# Load phasing result
problem = im.io.read_npz(prefix + '.phased.npz')
t = ImputationSet.from_problem(problem)
c = im.v.iv.stats_computer(t, problem.g)
s = c.stats()

Example #3
0
 def test_read_snps_to_impute(self):
     '''Test loading SNPs to be imputed from an NPZ file generated with cgi2plink
     (by way of io_genotype.write()).'''
     a = ImputationSet.load(im.itu.IMPUTE_RARE)
     g = a.genotype
     assert_size_equals(g, 146, 98)