redavids / phylogenetics-tools

Handy tools for working with phylogenetic data
MIT License
1 stars 1 forks source link

write python script to do fileswap on a whole folder #2

Open redavids opened 9 years ago

redavids commented 9 years ago

taxonfixer.fileswap('/Users/ruthdavidson/code/phylogenetics-tools/tests/feefifofum','/Users/ruthdavidson/code/phylogenetics-tools/tests/feefifofumswap','newick')

makes a file feefifofumswap (this is specified by user) with integer taxon names as well as a file feefifofum.taxon_key which is function of input file name feefifofum that has dict showing the conversion

H = open('/Users/ruthdavidson/code/phylogenetics-tools/tests/feefifofum.taxon_key','r') H.read() "{'fee': 2, 'fa': 1, 'fi': 3, 'foo': 5, 'fum': 6, 'fo': 4}"

There are tests here let me know if you want other tests. Going to use this module to make a python script that does this on a whole folder at a time.

redavids commented 9 years ago

We want the function fileswap to take a list of files, because if you have two files with tree1 = ((a,b),(c,d)); in file 1 tree2 = ((a,b),(c,e)); in file2, then the taxon conversion dictionaries will be different.

Then we can write a script to convert whole folders on the command line.

jed, clone this respository and then type git checkout -b jed-edit to make you own branch. Then once the issue is resolved we can merge the branches.