예제 #1
0
def phaser_stages13(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser(),
                             family_phaser(),
                             family_child_comparison_phaser(),
                             ], debug=debug, print_times=print_times)
예제 #2
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(pedigree=itu.HUTT_PED, prefix=itu.GENOTYPE_SAMPLE, haplotype=None)
     self.phaser = new_phaser_chain([trivial_phaser()])
예제 #3
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # Test phaser, doesn't matter which here
     self.phaser = new_phaser_chain([trivial_phaser()])
     # Generate a non-trivial Problem
     self.problem = itu.Templates.problem_family(itu.FAMILY13, haplotype=True)
예제 #4
0
def nuclear_family_phaser(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser(),
                             family_phaser(),
                             family_child_comparison_phaser(),
                             family_sib_comparison_phaser(),
                             ], debug=debug, print_times=print_times)
예제 #5
0
파일: phase.py 프로젝트: orenlivne/ober
def __build_phaser(options):
    '''Bulid and return the phasing processing chain by options - factory method.'''
    if options.stage == 0:
        # 07-DEC-12: disabling stage 4 (family_sib_comparison_phaser) since it degrades phasing & imputation
        chain = [
                 prepare_phaser(),
                 trivial_phaser(),
                 family_phaser(),
                 family_child_comparison_phaser(),
                 phase_distant.family_sib_comparison_phaser(),
                 phase_distant.distant_phaser()
                 ]
    elif options.stage == 1: chain = [prepare_phaser(), trivial_phaser()]
    elif options.stage == 2: chain = [family_phaser()]
    elif options.stage == 3: chain = [family_child_comparison_phaser()]
    elif options.stage == 4: chain = [phase_distant.family_sib_comparison_phaser()]
    elif options.stage == 5: chain = [phase_distant.distant_phaser()]
    return chain
예제 #6
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(pedigree=itu.HUTT_PED,
                                  prefix=itu.GENOTYPE_SAMPLE,
                                  haplotype=None)
     self.phaser = new_phaser_chain([trivial_phaser()])
예제 #7
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(prefix=itu.GENOTYPE_DUO, haplotype=None, pedigree=itu.GENOTYPE_DUO + '.tfam')
     self.phaser = trivial_phaser()
     # Expected results
     self.solution = Problem(self.problem.pedigree, io_genotype.read('plink', 'genotype', prefix=itu.GENOTYPE_DUO_SOLUTION))
예제 #8
0
def phaser_stages13(debug=False, print_times=False):
    return new_phaser_chain([
        prepare_phaser(),
        trivial_phaser(),
        family_phaser(),
        family_child_comparison_phaser(),
    ],
                            debug=debug,
                            print_times=print_times)
예제 #9
0
def nuclear_family_phaser(debug=False, print_times=False):
    return new_phaser_chain([
        prepare_phaser(),
        trivial_phaser(),
        family_phaser(),
        family_child_comparison_phaser(),
        family_sib_comparison_phaser(),
    ],
                            debug=debug,
                            print_times=print_times)
예제 #10
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(prefix=itu.GENOTYPE_TRIO, haplotype=None, pedigree=itu.GENOTYPE_TRIO + '.tfam')
     self.phaser = trivial_phaser()
     
     # Expected results
     self.solution = Problem(self.problem.pedigree, io_genotype.read('plink', 'genotype', prefix=itu.GENOTYPE_TRIO_SOLUTION))
예제 #11
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     
     # Load test data ready from previous phasing stagees 
     self.problem = io.read_npz(itu.FAMILY_TOO_ZEROED_STAGE1)
     self.family = self.problem.families()[0]
     self.phaser = phase_core.PhaseDecorator(FilterChain([trivial_phaser(),
                                                          family_phaser(),
                                                          family_child_comparison_phaser()]))
     self.comparator = ic.ChildComparator(Struct(problem=self.problem, params=PhaseParam()), self.family)
예제 #12
0
파일: phase.py 프로젝트: orenlivne/ober
def __build_phaser(options):
    '''Bulid and return the phasing processing chain by options - factory method.'''
    if options.stage == 0:
        # 07-DEC-12: disabling stage 4 (family_sib_comparison_phaser) since it degrades phasing & imputation
        chain = [
            prepare_phaser(),
            trivial_phaser(),
            family_phaser(),
            family_child_comparison_phaser(),
            phase_distant.family_sib_comparison_phaser(),
            phase_distant.distant_phaser()
        ]
    elif options.stage == 1:
        chain = [prepare_phaser(), trivial_phaser()]
    elif options.stage == 2:
        chain = [family_phaser()]
    elif options.stage == 3:
        chain = [family_child_comparison_phaser()]
    elif options.stage == 4:
        chain = [phase_distant.family_sib_comparison_phaser()]
    elif options.stage == 5:
        chain = [phase_distant.distant_phaser()]
    return chain
예제 #13
0
    def setUp(self):
        '''Load test data and expected results.'''
        unittest.TestCase.setUp(self)

        # Load test data ready from previous phasing stagees
        self.problem = io.read_npz(itu.FAMILY13_STAGE2)
        self.family = self.problem.families()[0]
        self.phaser = phase_core.PhaseDecorator(
            FilterChain([
                trivial_phaser(),
                family_phaser(),
                family_child_comparison_phaser()
            ]))
        self.comparator = ic.ChildComparator(
            Struct(problem=self.problem, params=PhaseParam()), self.family)
예제 #14
0
def prepare_and_trivial_phaser(debug=False, print_times=False):
    return new_phaser_chain(
        [prepare_phaser(), trivial_phaser()],
        debug=debug,
        print_times=print_times)
예제 #15
0
The segments obtained on different platforms (chips) should
be similar (in their base-pair beginning and end positions). 

Created on August 2, 2013
@author: Oren Livne <*****@*****.**>
============================================================
'''
import impute as im, os, numpy as np, matplotlib.pyplot as P, sys
from impute.kids.hutt_kids import get_sib_ids, read_chip_problem, chip_data_set
from impute.phasing.phase_trivial import trivial_phaser

####################################################################################
if __name__ == '__main__':

    path = os.environ['OBER_OUT'] + '/kids'
    chrom = 22
    debug = 1
    num_processes = 1  # 4
    params = im.PhaseParam()
    
    sibs = get_sib_ids(path)
    sib = 842  # Has high imputation call rate but high re-phasing error rate

    chip = 'cytosnp'
    p = im.io.read_npz('%s/%s/chr%d/%s.npz' % (path, chip, chrom, chip_data_set(chip)))
    
    # Run stage 1 so that we can step through the code and find why SNP 1700
    # is phased to 2,1 instead of 1,2
    phaser = trivial_phaser()
    problem = phaser.run(p, im.PhaseParam(selected_samples=np.array([842]), debug=True, print_times=True))
예제 #16
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.phaser = new_phaser_chain([trivial_phaser(), family_phaser(), family_child_comparison_phaser()])
예제 #17
0
def prepare_and_trivial_phaser(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser()
                             ], debug=debug, print_times=print_times)
예제 #18
0
============================================================
'''
import impute as im, os, numpy as np, matplotlib.pyplot as P, sys
from impute.kids.hutt_kids import get_sib_ids, read_chip_problem, chip_data_set
from impute.phasing.phase_trivial import trivial_phaser

####################################################################################
if __name__ == '__main__':

    path = os.environ['OBER_OUT'] + '/kids'
    chrom = 22
    debug = 1
    num_processes = 1  # 4
    params = im.PhaseParam()

    sibs = get_sib_ids(path)
    sib = 842  # Has high imputation call rate but high re-phasing error rate

    chip = 'cytosnp'
    p = im.io.read_npz('%s/%s/chr%d/%s.npz' %
                       (path, chip, chrom, chip_data_set(chip)))

    # Run stage 1 so that we can step through the code and find why SNP 1700
    # is phased to 2,1 instead of 1,2
    phaser = trivial_phaser()
    problem = phaser.run(
        p,
        im.PhaseParam(selected_samples=np.array([842]),
                      debug=True,
                      print_times=True))