Mercurial > repos > galaxyp > openms
diff build_mods_loc.py @ 2:cf0d72c7b482 draft
Update.
author | galaxyp |
---|---|
date | Fri, 10 May 2013 17:31:05 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build_mods_loc.py Fri May 10 17:31:05 2013 -0400 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import xml.etree.ElementTree as ET + +tree = ET.parse('unimod.xml') +ns = '{http://www.unimod.org/xmlns/schema/unimod_2}' +modifications_el = tree.getroot().find('%smodifications' % ns) + + +def to_label(title, site): + return "%s (%s)" % (title, site) + + +labels = [] +for mod in modifications_el.findall('%smod' % ns): + for specificity in mod.findall('%sspecificity' % ns): + title = mod.get('title') + site = specificity.get('site') + labels.append(to_label(title, site)) + +with open("openms_mods.loc", "w") as output: + for mod in sorted(labels, key=str.lower): + output.write("%s\n" % mod)