コード例 #1
0
ファイル: phase_main.py プロジェクト: orenlivne/ober
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
ファイル: TestPhaseTrivialAll.py プロジェクト: orenlivne/ober
 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
ファイル: phase_main.py プロジェクト: orenlivne/ober
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
ファイル: TestPhaseTrivialAll.py プロジェクト: orenlivne/ober
 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
ファイル: TestPhaseTrivialDuo.py プロジェクト: orenlivne/ober
 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
ファイル: phase_main.py プロジェクト: orenlivne/ober
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
ファイル: phase_main.py プロジェクト: orenlivne/ober
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
ファイル: phase_main.py プロジェクト: orenlivne/ober
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
ファイル: debug_sib_phasing.py プロジェクト: orenlivne/ober
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
ファイル: phase_main.py プロジェクト: orenlivne/ober
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))