NewPedigree::save() tries never to overwrite your data. If you do not pass a filename argument a file whose name is derived from, but not the same as, the original pedigree filename will be used. The string "_saved" will be appended to the filename in order to distinguish it from the original pedigree file.
There are a few points that you need to be aware of when using NewPedigree::save(). First, you may use any column separator you choose but the empty string (sepchar=''); if you try and do this the sepchar will be changed to the global default (currently " "), and a message written to the log. That means that there is no way for you to run all of the columns in your pedigree file together such that they cannot easily be separated. Sorry. You can use anoy other string you like to separate your columns (spaces, columns, and tabs have been tested).It IS possible to write an incomplete pedigree file, that is, a file which does not include animal, sire, and dam information. PyPedal checks the pedformat to see if it contains either 'asd' or 'ASD' and warns you if it does not, but it will happily write the file you tell it to. The burden is on you, the user, to make sure that your output file contains all of the information you want. Finally, you can write whatever attribute you like to whichever column you like in the output file. For the sake of your sanity I strongly recommend that you always place the animal, sire, and dam IDs in the first three columns, but you're an adult and may do what you like.
Maybe a couple of examples will help clear that up. Here's the simplest case, taking defaults:
test.save('test_save_asd.ped')
# test_save_asd.ped created by PyPedal at Tue Sep 28 16:39:36 2010 # Current pedigree metadata: # pedigree file: test_save_asd.ped # pedigree name: Untitled # pedigree format: asd # NOTE: Animal, sire, and dam IDs are RENUMBERED IDs, not original IDs! # Original pedigree metadata: # pedigree file: ../simulated_pedigree.ped # pedigree name: Untitled # pedigree format: asdxg 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 ... 21 19 10 22 9 12 23 1 10 24 1 21 25 13 8
test.save('test_save_asd_csv.ped', sepchar=',')
1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 ...
test.save('test_save_combo_all.ped', pedformat = 'asdgxbfrnylepASDLhHu')
1 0 0 0 m 01011900 0.0 Unknown_Breed 7 1900 0 -999 -999.0 7 Unknown_Name Unknown_Name ['1900000000000000071__1', '1900000000000000071__2'] 57361b5fd9993f00437fbe4c4675feca Unknown_Herd 2 0 0 0 m 01011900 0.0 Unknown_Breed 6 1900 0 -999 -999.0 6 Unknown_Name Unknown_Name ['1900000000000000061__1', '1900000000000000061__2'] 57361b5fd9993f00437fbe4c4675feca Unknown_Herd 3 0 0 0 m 01011900 0.0 Unknown_Breed 5 1900 0 -999 -999.0 5 Unknown_Name Unknown_Name ['1900000000000000051__1', '1900000000000000051__2'] 57361b5fd9993f00437fbe4c4675feca Unknown_Herd 4 0 0 0 f 01011900 0.0 Unknown_Breed 3 1900 0 -999 -999.0 3 Unknown_Name Unknown_Name ['1900000000000000031__1', '1900000000000000031__2'] 57361b5fd9993f00437fbe4c4675feca Unknown_Herd 5 0 0 0 f 01011900 0.0 Unknown_Breed 2 1900 0 -999 -999.0 2 Unknown_Name Unknown_Name ['1900000000000000021__1', '1900000000000000021__2'] 57361b5fd9993f00437fbe4c4675feca Unknown_Herd ...
test.save('test_save_peterson.ped', pedformat = 'asd', sepchar = '...Kneel before Zod!...'
1...Kneel before Zod!...0...Kneel before Zod!...0 2...Kneel before Zod!...0...Kneel before Zod!...0 3...Kneel before Zod!...0...Kneel before Zod!...0 4...Kneel before Zod!...0...Kneel before Zod!...0 5...Kneel before Zod!...0...Kneel before Zod!...0 ...
# But, wait, can this actually work? options2 = options options2['pedfile'] = 'test_save_peterson.ped' options2['sepchar'] = '...Kneel before Zod!...' options2['pedformat'] = 'asd' test2 = pyp_newclasses.loadPedigree(options2)
[INFO]: Logfile untitled_pedigree.log instantiated.
[INFO]: Preprocessing test_save_peterson.ped
[INFO]: Opening pedigree file test_save_peterson.ped
[INFO]: Renumbering pedigree at Wed Sep 29 13:42:05 2010
[INFO]: Reordering pedigree at Wed Sep 29 13:42:05 2010
[INFO]: Renumbering at Wed Sep 29 13:42:05 2010
[INFO]: Updating ID map at Wed Sep 29 13:42:05 2010
[INFO]: Assigning offspring at Wed Sep 29 13:42:05 2010
[INFO]: Creating pedigree metadata object
[INFO]: Instantiating a new PedigreeMetadata() object...
[INFO]: Naming the Pedigree()...
[INFO]: Assigning a filename...
[INFO]: Attaching a pedigree...
[INFO]: Setting the pedcode...
[INFO]: Counting the number of animals in the pedigree...
[INFO]: Counting and finding unique sires...
[INFO]: Counting and finding unique dams...
[INFO]: Setting renumbered flag...
[INFO]: Counting and finding unique generations...
[INFO]: Counting and finding unique birthyears...
[INFO]: Counting and finding unique founders...
[INFO]: Counting and finding unique herds...
[INFO]: Detaching pedigree...
Metadata for Untitled (test_save_peterson.ped)
Records: 25
Unique Sires: 7
Unique Dams: 7
Unique Gens: 1
Unique Years: 1
Unique Founders: 6
Unique Herds: 1
Pedigree Code: asd
See About this document... for information on suggesting changes.