annotate build_mods_loc.py @ 0:d4b6c9eae635 draft

Initial commit.
author galaxyp
date Fri, 10 May 2013 17:22:51 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
1 #!/usr/bin/env python
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
2
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
3 import xml.etree.ElementTree as ET
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
4 from os.path import exists
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
5
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
6 mods_path = "extended_modifications.xml"
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
7
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
8 if not exists(mods_path):
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
9 mods_path = "modifications.xml"
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
10
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
11 tree = ET.parse(mods_path)
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
12 modifications_el = tree.getroot()
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
13
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
14 with open("maxquant_mods.loc", "w") as output:
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
15 for mod in modifications_el.getchildren():
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
16 if mod.find("type").text.strip() == "standard":
d4b6c9eae635 Initial commit.
galaxyp
parents:
diff changeset
17 output.write("%s\n" % mod.attrib["title"])