コード例 #1
0
ファイル: new_lacy.py プロジェクト: pjmartinez/pypedal
# VERSION: 2.0.0b5 (14DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_metrics
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

# Example taken from Lacy (1989), Appendix A.
    example = pyp_newclasses.loadPedigree(optionsfile='new_lacy.ini',debugLoad=True)
    example.printoptions()
    if example.kw['messages'] == 'verbose':
        print '='*80
        print '[INFO]: Calling pyp_metrics.effective_founders_lacy at %s' % (pyp_nice_time())
    pyp_metrics.effective_founders_lacy(example)

# Example taken from Boichard et al. (1997), Figure 2 / Table II.
    example2a = pyp_newclasses.loadPedigree(optionsfile='new_format.ini')
    if example2a.kw['messages'] == 'verbose':
        print '='*80
        print '[INFO]: Calling pyp_metrics.effective_founders_lacy at %s' % (pyp_nice_time())
    pyp_metrics.effective_founders_lacy(example2a)
    if example2a.kw['messages'] == 'verbose':
        print '='*80
        print 'Calling a_effective_founders_boichard() at %s' % (pyp_nice_time())
コード例 #2
0
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal.pyp_utils import pyp_nice_time

import numpy
import time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

    example = pyp_newclasses.loadPedigree(optionsfile='new_amatrix.ini')

    amatrix = pyp_newclasses.NewAMatrix(example.kw)
    amatrix.form_a_matrix(example.pedigree)

    # Here's how to save a matrix to a binary file.
    #    amatrix.save('boichard2_pedigree.bin')

    # Here's how to load a matrix from a binary file.
    #    amatrix2 = pyp_newclasses.NewAMatrix(example.kw)
    #    amatrix2.load('boichard2_pedigree.bin')

    # Calculate coefficients of inbreeding on this pedigree.
    print '\tEntering pyp_nrm.inbreeding() at %s' % (pyp_nice_time())
    example_inbreeding = pyp_nrm.inbreeding(example, method='vanraden')
    print '\tReturning from pyp_nrm.inbreeding() at %s' % (pyp_nice_time())
コード例 #3
0
ファイル: new_doug.py プロジェクト: pjmartinez/pypedal
#!/usr/bin/python

###############################################################################
# NAME: new_doug.py
# VERSION: 2.0.0b5 (13DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_newclasses
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_doug.ini')

    if example.kw['messages'] == 'verbose':
        print '[INFO]: Calling pyp_graphics.draw_pedigree() at %s' % (pyp_nice_time())

    pyp_graphics.draw_pedigree(example, gfilename='doug_below',
        gtitle='Doug the German Shepherd (B)', gorient='p', gname=1, gdirec='',
        gfontsize=12, garrow=0, gtitloc='b')

    pyp_graphics.draw_pedigree(example, gfilename='doug_above',
        gtitle='Doug the German Shepherd (A)', gorient='p', gname=1, gdirec='',
        gfontsize=12, garrow=0, gtitloc='t')

    pyp_graphics.draw_pedigree(example, gfilename='doug_p_rl_notitle',
        gtitle='', gorient='p', gname=1, gdirec='RL', gfontsize=12)
コード例 #4
0
#!/usr/bin/python

###############################################################################
# NAME: new_graphics.py
# VERSION: 2.0.0b5 (19DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_renumbering.ini')

    print '-'*80
    print 'INFO: Pedigree ID map: %s' % (example.idmap)
    print '-'*80
    print 'INFO: Pedigree ID reverse map: %s' % (example.backmap)
    print '-'*80
    myinbr = pyp_nrm.inbreeding(example)
    print 'INFO: Coefficients of inbreeding: %s' % (myinbr)

    pyp_graphics.draw_pedigree(example,gfilename='new_renumbering',gtitle='My  Pedigree')
コード例 #5
0
ファイル: new_methods.py プロジェクト: pjmartinez/pypedal
# VERSION: 2.0.0b5 (19DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_metrics
from PyPedal import pyp_nrm
from PyPedal import pyp_utils
from PyPedal.pyp_utils import pyp_nice_time

if __name__=='__main__':

    print 'Starting pypedal.py at %s' % ( pyp_nice_time() )

    example = pyp_newclasses.loadPedigree(optionsfile='new_format.ini')
    #pyp_utils.assign_offspring(example)
    #print 'First ID: %s' % ( example.kw['id_first'] )
    #print 'Last ID: %s' % ( example.kw['id_last'] )

    inbr, reln = inbr, reln = pyp_nrm.inbreeding(example,method='vanraden',rels=1)
    print 'inbr: ', inbr
    print 'reln: ', reln

    example.nrm = pyp_newclasses.NewAMatrix(example.kw)
    example.nrm.form_a_matrix(example.pedigree)
    example.nrm.save('Amatrix.txt')

    inbr2, reln2 = pyp_nrm.inbreeding(example,method='vanraden',rels=1)
    print 'inbr2: ', inbr2
    print 'reln2: ', reln2
コード例 #6
0
# NAME: new_reporting.py
# VERSION: 2.0.0b15 (18SE{SEPTEMBET2006)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_jbc
from PyPedal import pyp_network
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_metrics

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='newfoundland.ini')

    print example.idmap
    print example.backmap
    print example.namemap
    print example.namebackmap

    newf_f = pyp_nrm.inbreeding(example)
    print newf_f['fx'][example.idmap[
        example.namemap['Kaptn Kvols von Widdersdorf']]]

##    dussel_id = example.idmap[example.namemap['King von der Dussel']]
##    print 'dussel_id: ', dussel_id
##
##    print 'Empirical proof that ancestor loss coefficients are the same'
##    print 'as pedigree completeness.'
コード例 #7
0
ファイル: new_networkx.py プロジェクト: pjmartinez/pypedal
from PyPedal import pyp_newclasses
from PyPedal import pyp_network
from PyPedal.pyp_utils import pyp_nice_time

try:
    import networkx
except ImportError:
    logging.error('The networkx module could not be imported in pyp_network.  Routines using networkx functionality are not available.')

if __name__=='__main__':

    print 'Starting pypedal.py at %s' % ( pyp_nice_time() )
    print '\tLoading pedigree at %s' % ( pyp_nice_time() )

    example = pyp_newclasses.loadPedigree(optionsfile='new_networkx.ini')

    print 'Calling pyp_network.ped_to_graph()'
    ng = pyp_network.ped_to_graph(example)

#    print 'The graph has %d nodes' % len(ng.nodes())
#    print ng.nodes()
#    print ng.edges()
#
##     print 'Drawing graph madeup.ps'
##     networkx.drawing.draw(ng)
##     networkx.drawing.savefig("madeup.ps")
##
##     print 'Drawing graph madeup.dot'
##     networkx.drawing.write_dot(ng,path="madeup.dot")
##     networkx.drawing.draw_nxpydot(ng)
コード例 #8
0
ファイル: example_a_matrix.py プロジェクト: sam-m888/pypedal
options = {}  
options['pedfile'] = 'new_amatrix.ped'
options['pedname'] = 'A Large Dog Pedigree'
options['pedformat'] = 'asdgb'
options['messages'] = 'verbose'
options['renumber'] = 1

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_utils.pyp_nice_time())

    # example is a PyPedal NewPedigree object that stores the individual
    # animal records, as well as other information about the pedigree.
    # Most things are done by calling methods on example, or by passing
    # it to functions.
    example = pyp_newclasses.loadPedigree(optionsfile='new_amatrix.ini')

    # We're going to create an instance of the NewAMatrix class, which we
    # can use to store relationship matrices, and then create the A matrix
    # from the pedigree stored in example. Note that we can only store
    # matrices that we can allocate in memory!
    amatrix = pyp_newclasses.NewAMatrix(example.kw)
    amatrix.form_a_matrix(example.pedigree)

    # Here's how to save the A matrix to a binary file.
    amatrix.save('boichard2_pedigree.bin')

    # Here's how to load the A matrix from a binary file.
    amatrix2 = pyp_newclasses.NewAMatrix(example.kw)
    amatrix2.load('boichard2_pedigree.bin')
コード例 #9
0
ファイル: newfoundland.py プロジェクト: pjmartinez/pypedal
# NAME: new_reporting.py
# VERSION: 2.0.0b15 (18SE{SEPTEMBET2006)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_jbc
from PyPedal import pyp_network
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_metrics

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='newfoundland.ini')

    print example.idmap
    print example.backmap
    print example.namemap
    print example.namebackmap

    newf_f = pyp_nrm.inbreeding(example)
    print newf_f['fx'][example.idmap[example.namemap['Kaptn Kvols von Widdersdorf']]]

##    dussel_id = example.idmap[example.namemap['King von der Dussel']]
##    print 'dussel_id: ', dussel_id
##
##    print 'Empirical proof that ancestor loss coefficients are the same'
##    print 'as pedigree completeness.'
##
コード例 #10
0
options = {}
options['messages'] = 'verbose'
options['renumber'] = 1
#options['pedfile'] = 'new_renumbering.ped'
options['pedfile'] = 'mrode.ped'
#options['pedformat'] = 'asdgb'
options['pedformat'] = 'asd'
options['pedname'] = 'My Pedigree'
options['matrix_type'] = 'sparse'
options['renumber'] = 0
options['pedigree_is_renumbered'] = 1

if __name__ == '__main__':

    # example = pyp_newclasses.loadPedigree(optionsfile='new_inbreeding.ini')
    example = pyp_newclasses.loadPedigree(options)
    print example

    print '[DEBUG]: matrix_type = ', example.kw['matrix_type']

    print 'Started computing inbreeding at %s' % (pyp_nice_time())
    example_inbreeding_vr = pyp_nrm.inbreeding(example, method='vanraden')
    example_inbreeding_ml = pyp_nrm.inbreeding(example, method='meu_luo')
    example_inbreeding_qu = pyp_nrm.inbreeding(example, method='mod_meu_luo')
    print 'Finished computing inbreeding at %s' % (pyp_nice_time())

    # print example_inbreeding
    # print example_inbreeding['fx'][28]
    print '\nVanRaden                  : ', example_inbreeding_vr['metadata']
    print '\nMeuwissen and Luo         : ', example_inbreeding_ml['metadata']
    print '\nModified Meuwissen and Luo: ', example_inbreeding_qu['metadata']
コード例 #11
0
ファイル: new_reporting.py プロジェクト: pjmartinez/pypedal
# NAME: new_reporting.py
# VERSION: 2.0.0b7 (11APRIL2006)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_network
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
#from PyPedal import pyp_reports
from PyPedal import pyp_metrics

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_reporting.ini')
    #example.printoptions()

    #pyp_reports.pdfPedigreeMetadata(example, titlepage = 1, reporttitle = 'Metadada for My Pedigree', reportauthor = 'John B. Cole, PhD')

    #pyp_reports.pdfPedigreeMetadata(example, titlepage = 1, reportauthor = 'John B. Cole, PhD', reportfile = 'metadata_report.pdf')

    ib = pyp_nrm.inbreeding(example)
    #coi_by_year = pyp_reports.meanMetricBy(example,metric='fa',byvar='by',createpdf=1)
    #coi_by_year

    #print ib
    #for _e in example.pedigree:
        #print _e.name, _e.fa

    print example.kw['paper_size']
コード例 #12
0
ファイル: new_subpedigree.py プロジェクト: pjmartinez/pypedal
#!/usr/bin/python

###############################################################################
# NAME: new_subpedigree.py
# VERSION: 2.0.0b14 (16MAY2006)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_graphics
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_utils
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_subpedigree.ini')
    print '='*70
    keepid = []
    for k in ['Clover','Dewey','Wicket']:
        ped = pyp_nrm.recurse_pedigree(example,example.idmap[example.namemap[k]],[])
        for p in ped:
            if p.animalID not in keepid:
                keepid.append(p.animalID)
        if example.idmap[example.namemap[k]] not in keepid:
            keepid.append(example.idmap[example.namemap[k]])
    example2 = pyp_utils.subpedigree(example,keepid)
    example2.metadata.printme()
コード例 #13
0
###############################################################################
# NAME: new_graphics3.py
# VERSION: 2.0.0b15 (18SEPTEMBER2006)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_demog
from PyPedal import pyp_graphics
from PyPedal import pyp_jbc
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_metrics
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

    example = pyp_newclasses.loadPedigree(optionsfile='new_graphics3.ini')
    if example.kw['messages'] == 'verbose':
        print '[INFO]: Calling pyp_graphics.new_draw_pedigree() at %s' % (
            pyp_nice_time())
    pyp_graphics.new_draw_pedigree(example,
                                   gfilename='graphics3',
                                   gtitle='graphics3 pedigree',
                                   gorient='p')

    pyp_jbc.color_pedigree(example,gfilename='graphics3', ghatch='0', \
        metric='sons', gtitle='Nodes are colored by number of sons.', \
        gprog='dot', gname=1)
コード例 #14
0
ファイル: test_reordering.py プロジェクト: wintermind/pypedal
###############################################################################
# NAME: new_amatrix.py
# VERSION: 2.0.0rc7 (07MAY2008)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import  pyp_newclasses
from PyPedal import  pyp_nrm
from PyPedal.pyp_utils import pyp_nice_time

import numpy
import time

options = {}
options['messages'] = 'verbose'
options['pedfile'] = 'vizsla_ped3.csv'
options['pedformat'] = 'asd'
options['reorder'] = 1
options['reorder_max_rounds'] = 1000
options['has_header'] = 1
options['sepchar'] = ','
options['pedname'] = 'Viszla Pedigree'
options['debug_messages'] = 0

if __name__ == '__main__':

    print 'PyPedal started at %s' % (pyp_nice_time())
    viszla = pyp_newclasses.loadPedigree(options, debugLoad=True)
    print 'PyPedal stopped at %s' % (pyp_nice_time())
コード例 #15
0
#     print '\n3 gen inbreeding: %s' % ( example_inbreeding )
#     print '\nMean 3 gen CoI: %s' % ( example_inbreeding['metadata']['all']['f_avg'] )

# This is an advanced example that uses dict4ini to read
# configurations for multiple pedigrees from the same file.
    from PyPedal import dict4ini
    import sys
    kw_all = dict4ini.DictIni('new_inbreeding2multiple.ini')
    if len(kw_all) == 0:
        sys.exit(0)
    kw_all = kw_all.dict()
    kw_noinbred = kw_all['noinbreeding']
    kw_horse = kw_all['horse']

#     noinbred = pyp_newclasses.loadPedigree(kw_noinbred)
    horse = pyp_newclasses.loadPedigree(kw_horse)

#     noinbred_inbreeding = pyp_nrm.inbreeding(noinbred, method='vanraden', gens=3)
#     print '\nNoinbred 3 gen inbreeding: %s' % ( noinbred_inbreeding )
#     print '\nNoinbred mean 3 gen CoI: %s' % ( noinbred_inbreeding['metadata']['all']['f_avg'] )
#
#     pyp_graphics.draw_pedigree(horse, gfilename='blue_joe',
#         gtitle='Blue Joe\'s Pedigree', gorient='p', gname=1, gdirec='RL',
#         gfontsize=12, garrow=0, gtitloc='b')

##    print '\nRen ID\tName\n------\t----'
##    for _k in horse.backmap.keys():
##        print '%s\t%s' % ( _k, horse.pedigree[int(_k)-1].name )

##    print '-'*80
コード例 #16
0
ファイル: new_inbreeding.py プロジェクト: pjmartinez/pypedal
options = {}
options['messages'] = 'verbose'
options['renumber'] = 1
#options['pedfile'] = 'new_renumbering.ped'
options['pedfile'] = 'mrode.ped'
#options['pedformat'] = 'asdgb'
options['pedformat'] = 'asd'
options['pedname'] = 'My Pedigree'
options['matrix_type'] = 'sparse'
options['renumber'] = 0
options['pedigree_is_renumbered'] = 1

if __name__ == '__main__':

    # example = pyp_newclasses.loadPedigree(optionsfile='new_inbreeding.ini')
    example = pyp_newclasses.loadPedigree(options)
    print example

    print '[DEBUG]: matrix_type = ', example.kw['matrix_type']

    print 'Started computing inbreeding at %s' % (pyp_nice_time())
    example_inbreeding_vr = pyp_nrm.inbreeding(example,method='vanraden')
    example_inbreeding_ml = pyp_nrm.inbreeding(example,method='meu_luo')
    example_inbreeding_qu = pyp_nrm.inbreeding(example,method='mod_meu_luo')
    print 'Finished computing inbreeding at %s' % (pyp_nice_time())

    # print example_inbreeding
    # print example_inbreeding['fx'][28]
    print '\nVanRaden                  : ', example_inbreeding_vr['metadata']
    print '\nMeuwissen and Luo         : ', example_inbreeding_ml['metadata']
    print '\nModified Meuwissen and Luo: ', example_inbreeding_qu['metadata']
コード例 #17
0
ファイル: new_options.py プロジェクト: ImproveStats/pypedal
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

    print '=' * 80

    # This should fail because we are providing neither a dictionary
    # of options or a configuration file name.
    print 'This load should fail'
    myped1 = pyp_newclasses.loadPedigree()
    print myped1

    print '-' * 80

    # This should fail because we are providing an empty dictionary
    # and there is no configuration file named pypedal.ini in the
    # examples directory.
    options = {}
    print 'This load should fail'
    myped2 = pyp_newclasses.loadPedigree(options)
    print myped2

    print '-' * 80

    # This should work because we are providing a dictionary of
コード例 #18
0
ファイル: new_lacy.py プロジェクト: ImproveStats/pypedal
# VERSION: 2.0.0b5 (14DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_metrics
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

    # Example taken from Lacy (1989), Appendix A.
    example = pyp_newclasses.loadPedigree(optionsfile='new_lacy.ini',
                                          debugLoad=True)
    example.printoptions()
    if example.kw['messages'] == 'verbose':
        print '=' * 80
        print '[INFO]: Calling pyp_metrics.effective_founders_lacy at %s' % (
            pyp_nice_time())
    pyp_metrics.effective_founders_lacy(example)

    # Example taken from Boichard et al. (1997), Figure 2 / Table II.
    example2a = pyp_newclasses.loadPedigree(optionsfile='new_format.ini')
    if example2a.kw['messages'] == 'verbose':
        print '=' * 80
        print '[INFO]: Calling pyp_metrics.effective_founders_lacy at %s' % (
            pyp_nice_time())
    pyp_metrics.effective_founders_lacy(example2a)
    if example2a.kw['messages'] == 'verbose':
コード例 #19
0
ファイル: new_format.py プロジェクト: ImproveStats/pypedal
#!/usr/bin/python

###############################################################################
# NAME: new_format.py
# VERSION: 2.0.0b5 (13DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses

if __name__ == '__main__':

    # Example taken from Boichard et al. (1997), Figure 2 / Table II.
    example2a = pyp_newclasses.loadPedigree(optionsfile='new_format.ini')
    example2a.metadata.printme()
コード例 #20
0
ファイル: new_sqlite.py プロジェクト: pjmartinez/pypedal
from PyPedal import pyp_newclasses
from PyPedal import pyp_metrics
from PyPedal import pyp_nrm
from PyPedal import pyp_io
from PyPedal import pyp_graphics

options = {}
# This is the name of the input tile.
options['pedfile'] = ''
# This is a descriptor used in some output.
options['pedname'] = 'Text Stream'
# Don't mess with these options.
options['messages'] = 'verbose'
options['renumber'] = 1
options['pedformat'] = 'ASD'
options['assign_sexes'] = 1

if __name__ == "__main__":

    pedstream = 'a1,s1,d1\na2,s2,d2\na3,a1,a2\n'
    test = pyp_newclasses.loadPedigree(options,pedsource='textstream',pedstream=pedstream)

    test.kw['database_name'] = 'test_pypedal_save'
    test.kw['dbtable_name'] = 'test'
    test.savedb(drop=True)

    test2 = pyp_newclasses.loadPedigree(options,pedsource='db')
    test2.metadata.printme()

    test2.savegraph(pedoutfile='test.adj')
コード例 #21
0
ファイル: new_graphics.py プロジェクト: pjmartinez/pypedal
# NAME: new_graphics.py
# VERSION: 2.0.0b5 (13DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_db
from PyPedal import pyp_graphics
from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal import pyp_reports
from PyPedal.pyp_utils import pyp_nice_time

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_graphics.ini')
#     example_inbreeding = pyp_nrm.inbreeding(example)

    pyp_graphics.rmuller_spy_matrix_pil(example.nrm.nrm, fname='dog_sparsity.png', cutoff=0.01, do_outline=0, height=example.nrm.nrm.shape[0], width=example.nrm.nrm.shape[0])

    pyp_graphics.rmuller_pcolor_matrix_pil(example.nrm.nrm, fname='dog_long_pcolored.png', do_outline=0, height=example.nrm.nrm.shape[0], width=example.nrm.nrm.shape[0])

    #pyp_db.loadPedigreeTable(example)
    pyp_db.deleteTable(example)
    pyp_db.populatePedigreeTable(example)
    coi_by_year = pyp_reports.meanMetricBy(example, metric='fa', byvar='by')
    print 'coi_by_year: ', coi_by_year
    cby = coi_by_year
    del(cby[1900])
    pyp_graphics.plot_line_xy(coi_by_year, gfilename='dog_coi_by_year',
        gtitle='', gxlabel='Birth year', gylabel='Coefficient of inbreeding')
コード例 #22
0
ファイル: new_simulate_2.py プロジェクト: pjmartinez/pypedal
#!/usr/bin/python

###############################################################################
# NAME: new_simulate.py
# VERSION: 2.0.0b15 (08JUNE2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import  pyp_newclasses
from PyPedal import  pyp_graphics
from PyPedal import  pyp_network
import networkx

if __name__ == '__main__':

    for i in range(1):
        print 'Simulating and drawing pedigree %d' % ( i )
        example = pyp_newclasses.loadPedigree(optionsfile='new_simulate.ini')
        print example
コード例 #23
0
ファイル: new_simulate.py プロジェクト: ImproveStats/pypedal
# NAME: new_simulate.py
# VERSION: 2.0.0b15 (08JUNE2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_graphics
from PyPedal import pyp_network
import networkx

if __name__ == '__main__':

    for i in range(1):
        print 'Simulating and drawing pedigree %d' % (i)
        example = pyp_newclasses.loadPedigree(optionsfile='new_simulate.ini')
        print example

        #_gfn = 'simulated_pedigree_%d' % ( i )
        _gfn = 'simulated_pedigree'
        _gt = 'Simulated Pedigree %d' % (i)
        pyp_graphics.draw_pedigree(example,
                                   gfilename=_gfn,
                                   gtitle=_gt,
                                   gformat='ps',
                                   garrow=0,
                                   gclusters=0)

        #print 'Animal\tOriginal\tSire\tDam\tSex\tGen'
        #for _p in example.pedigree:
        #print '%s\t%s\t\t%s\t%s\t%s\t%s' % ( _p.animalID, _p.originalID, _p.sireID, _p.damID, _p.sex, _p.gen )
コード例 #24
0
from PyPedal import pyp_nrm
from PyPedal import pyp_io
from PyPedal import pyp_graphics

options = {}
# This is the name of the input tile.
options['pedfile'] = ''
# This is a descriptor used in some output.
options['pedname'] = 'Text Stream'
# Don't mess with these options.
options['messages'] = 'verbose'
options['renumber'] = 1
options['pedformat'] = 'ASD'
options['assign_sexes'] = 1

if __name__ == "__main__":

    pedstream = 'a1,s1,d1\na2,s2,d2\na3,a1,a2\n'
    test = pyp_newclasses.loadPedigree(options,
                                       pedsource='textstream',
                                       pedstream=pedstream)

    test.kw['database_name'] = 'test_pypedal_save'
    test.kw['dbtable_name'] = 'test'
    test.savedb(drop=True)

    test2 = pyp_newclasses.loadPedigree(options, pedsource='db')
    test2.metadata.printme()

    test2.savegraph(pedoutfile='test.adj')
コード例 #25
0
#!/usr/bin/python

###############################################################################
# NAME: new_ids.py
# VERSION: 2.0.0b5 (14DECEMBER2005)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses

if __name__ == '__main__':

    example = pyp_newclasses.loadPedigree(optionsfile='new_ids.ini')

    for _p in example.pedigree:
        _p.printme()
コード例 #26
0
ファイル: new_options.py プロジェクト: pjmartinez/pypedal
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal.pyp_utils import pyp_nice_time

if __name__=='__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())

    print '='*80

    # This should fail because we are providing neither a dictionary
    # of options or a configuration file name.
    print 'This load should fail'
    myped1 = pyp_newclasses.loadPedigree()
    print myped1

    print '-'*80

    # This should fail because we are providing an empty dictionary
    # and there is no configuration file named pypedal.ini in the
    # examples directory.
    options = {}
    print 'This load should fail'
    myped2 = pyp_newclasses.loadPedigree(options)
    print myped2

    print '-'*80

    # This should work because we are providing a dictionary of
コード例 #27
0
###############################################################################
# NAME: new_amatrix.py
# VERSION: 2.0.0rc7 (07MAY2008)
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import pyp_newclasses
from PyPedal import pyp_nrm
from PyPedal.pyp_utils import pyp_nice_time

import numpy
import time

options = {}
options['messages'] = 'verbose'
options['pedfile'] = 'vizsla_ped3.csv'
options['pedformat'] = 'asd'
options['reorder'] = 1
options['reorder_max_rounds'] = 1000
options['has_header'] = 1
options['sepchar'] = ','
options['pedname'] = 'Viszla Pedigree'
options['debug_messages'] = 0

if __name__ == '__main__':

    print 'PyPedal started at %s' % (pyp_nice_time())
    viszla = pyp_newclasses.loadPedigree(options, debugLoad=True)
    print 'PyPedal stopped at %s' % (pyp_nice_time())
コード例 #28
0
ファイル: new_decompose.py プロジェクト: ImproveStats/pypedal
# AUTHOR: John B. Cole, PhD ([email protected])
# LICENSE: LGPL
###############################################################################

from PyPedal import  pyp_newclasses
from PyPedal import  pyp_nrm
from PyPedal.pyp_utils import pyp_nice_time

import numpy
import numpy.linalg
import time

if __name__ == '__main__':

    print 'Starting pypedal.py at %s' % (pyp_nice_time())
    example = pyp_newclasses.loadPedigree(optionsfile='new_decompose.ini')
    amatrix = pyp_newclasses.NewAMatrix(example.kw)
    amatrix.form_a_matrix(example.pedigree)

    print '-'*80
    print 'Calling a_decompose()'
    print '====================='
    D, T  = pyp_nrm.a_decompose(example)
    print 'D: ', D
    print 'T: ', T

    print '-'*80
    print 'Calculating Ainv from D and T'
    print '============================='
    l = example.metadata.num_records
    Tinv = numpy.linalg.inv(T)