annotate build_mods_loc.py @ 1:7a74818e0eeb draft

Improved some datatype handling
author galaxyp
date Thu, 20 Jun 2013 10:53:16 -0400
parents 0578e296cab4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
1 #!/usr/bin/env python
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
2
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
3 import xml.etree.ElementTree as ET
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
4 from os.path import exists
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
5
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
6 with open("searchgui_mods.loc", "w") as output:
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
7 for mods_path in ["searchGUI_mods.xml", "searchGUI_usermods.xml"]:
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
8 tree = ET.parse(mods_path)
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
9 modifications_el = tree.getroot()
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
10 for mod in modifications_el.findall("{http://www.ncbi.nlm.nih.gov}MSModSpec"):
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
11 name_el = mod.find("{http://www.ncbi.nlm.nih.gov}MSModSpec_name")
0578e296cab4 Initial commit.
galaxyp
parents:
diff changeset
12 output.write("%s\n" % name_el.text.lower())