Пример #1
0
#!/usr/bin/env python
'''
============================================================
Re-generate all test sets (chr22 data).

Created on August 16, 2012
@author: Oren Livne <*****@*****.**>
============================================================
'''
from impute.phasing import examples
from impute.preprocess import convert
from impute.phasing.examples import CHR22
from impute import impute_test_util as itu

# Need to be done once given the original PLINK TPED Hutterites data set
convert.main(pedigree=itu.HUTT_PED,
             prefix=CHR22 + '/hutt',
             npz=CHR22 + '/hutt.npz',
             target='npz',
             debug=True)

for stage in xrange(1, 5):
    examples.phase_chr22('hutt.%snpz' % ('stage%d.' %
                                         (stage - 1, ) if stage > 1 else ''),
                         'hutt.stage%d.npz' % (stage, ),
                         stage=stage)

examples.generate_test_sets()
Пример #2
0
    (options, args) = parser.parse_args(sys.argv[1:])
    if len(args) != 4:
        print usage
        sys.exit(1)

    # in_dir =  'phasing.20121130/split_chr'
    # out_dir = 'phasing.20121130/individual'
    # chrom = 5
    # part = 0
    in_dir, out_dir, chrom, part = args[0], args[1], int(args[2]), int(args[3])
    print 'Running phasing in stages'
    print 'in_dir  = %s' % (in_dir,)
    print 'out_dir = %s' % (out_dir,)
    print 'chrom   = %d' % (chrom,)
    print 'part    = %d' % (part,)

    out_dir = '%s/chr%d' % (out_dir, chrom)
    util.mkdir_if_not_exists(out_dir)
    
    npz_file = '%s/hutt.stage0.npz' % (out_dir,)
    if not os.path.exists(npz_file) and options.stage == 0:
        convert.main(pedigree=itu.HUTT_PED,
                     prefix='%s/chr%d/hutt_chr%d_part%d' % (in_dir, chrom, chrom, part),
                     npz=npz_file, target='npz', debug=True)
    
    for stage in (range(1, 5) if options.stage == 0 else [options.stage]):
        phase.main(pedigree=itu.HUTT_PED,
                          input='%s/hutt.stage%d.npz' % (out_dir, stage - 1),
                          output='%s/hutt.stage%d.npz' % (out_dir, stage),
                          stage=stage, debug=options.debug)
Пример #3
0
#!/usr/bin/env python
'''
============================================================
Re-generate all test sets (chr22 data).

Created on August 16, 2012
@author: Oren Livne <*****@*****.**>
============================================================
'''
from impute.phasing import examples
from impute.preprocess import convert
from impute.phasing.examples import CHR22
from impute import impute_test_util as itu

# Need to be done once given the original PLINK TPED Hutterites data set
convert.main(pedigree=itu.HUTT_PED, prefix=CHR22 + '/hutt', npz=CHR22 + '/hutt.npz', target='npz', debug=True)

for stage in xrange(1, 5):
    examples.phase_chr22('hutt.%snpz' % ('stage%d.' % (stage - 1,) if stage > 1 else ''),
                         'hutt.stage%d.npz' % (stage,),
                         stage=stage)

examples.generate_test_sets()
Пример #4
0
    # chrom = 5
    # part = 0
    in_dir, out_dir, chrom, part = args[0], args[1], int(args[2]), int(args[3])
    print "Running phasing in stages"
    print "in_dir  = %s" % (in_dir,)
    print "out_dir = %s" % (out_dir,)
    print "chrom   = %d" % (chrom,)
    print "part    = %d" % (part,)

    out_dir = "%s/chr%d" % (out_dir, chrom)
    util.mkdir_if_not_exists(out_dir)

    npz_file = "%s/hutt.stage0.npz" % (out_dir,)
    if not os.path.exists(npz_file) and options.stage == 0:
        convert.main(
            pedigree=itu.HUTT_PED,
            prefix="%s/chr%d/hutt_chr%d_part%d" % (in_dir, chrom, chrom, part),
            npz=npz_file,
            target="npz",
            debug=True,
        )

    for stage in range(1, 5) if options.stage == 0 else [options.stage]:
        phase.main(
            pedigree=itu.HUTT_PED,
            input="%s/hutt.stage%d.npz" % (out_dir, stage - 1),
            output="%s/hutt.stage%d.npz" % (out_dir, stage),
            stage=stage,
            debug=options.debug,
        )