4.2.2 The Anatomy of a Program

The hartl.ped program is fairly simple, but it demonstrates some of the things that you can easily do with PyPedal. Please note that while I have placed these comamnds in a file, you can also walk through the steps using the Python command line. Most of the print statements are there to provide feedback while the program is running. It is not a big deal with a small pedigree, but it is nice to know that something is happening when you throw a large pedigree at PyPedal(). I have put in line numbers for ease os reference, but if you are working along with the tutorial at the command line you should not type in the line numbers.

001 print 'Starting pypedal.py at %s' % asctime(localtime(time()))
002 print '\tPreprocessing pedigree at %s' % asctime(localtime(time()))
003 example = preprocess('hartl.ped',sepchar=' ')
004 example = renumber(example,'example',io='yes')
005 print '\tCalling set_ancestor_flag at %s' % asctime(localtime(time()))
006 set_ancestor_flag(example,'example',io='yes')
007 print '\tCollecting pedigree metadata at %s' % asctime(localtime(time()))
008 example_meta = Pedigree(example,'example.ped','example_meta')
009 print '\tCalling a_effective_founders_lacy() at %s' % asctime(localtime(time()))
010 a_effective_founders_lacy(example,filetag='example')
011 print '\tCalling a_effective_founders_boichard() at %s' % asctime(localtime(time()))
012 a_effective_founders_boichard(example,filetag='example')
013 print '\tCalling a_effective_ancestors_definite() at %s' % asctime(localtime(time()))
014 a_effective_ancestors_definite(example,filetag='example')
015 print '\tCalling a_effective_ancestors_indefinite() at %s' % asctime(localtime(time()))
016 a_effective_ancestors_indefinite(example,filetag='example',n=10)
017 print '\tCalling related_animals() at %s' % asctime(localtime(time()))
018 list_a = related_animals(example[14].animalID,example)
019 print list_a
020 print '\tCalling related_animals() at %s' % asctime(localtime(time()))
021 list_b = related_animals(example[9].animalID,example)
022 print list_b
023 print '\tCalling common_ancestors() at %s' % asctime(localtime(time()))
024 list_r = common_ancestors(example[14].animalID,example[9].animalID,example)
025 print list_r
026 print 'Stopping pypedal.py at %s' % asctime(localtime(time()))