comparison init.py @ 4:dcd39bcc7481 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
author galaxyp
date Sat, 11 Apr 2020 11:49:19 -0400
parents 175e062b6a17
children
comparison
equal deleted inserted replaced
3:175e062b6a17 4:dcd39bcc7481
3 modifications/enzymes.xml. 3 modifications/enzymes.xml.
4 4
5 TODO: Append function: only add modifications that are not 5 TODO: Append function: only add modifications that are not
6 already present, add modification entries to conda maxquant 6 already present, add modification entries to conda maxquant
7 7
8 Authors: Damian Glaetzer <d.glaetzer@mailbox.org> 8 Usage: init.py [-m MODS_FILE] [-e ENZYMES_FILE]
9
10 Usage: init.py [-a] [-m MODS_FILE] [-e ENZYMES_FILE]
11 FILES are the modifications/enzymes.xml of MaxQuant, located at 9 FILES are the modifications/enzymes.xml of MaxQuant, located at
12 <ANACONDA_DIR>/pkgs/maxquant-<VERSION>/bin/conf/. 10 <ANACONDA_DIR>/pkgs/maxquant-<VERSION>/bin/conf/.
13 (for conda installations) 11 (for conda installations)
14 12
15 Updates modification parameters in macros.xml. 13 Updates modification parameters in macros.xml.
38 help="enzymes.xml of maxquant") 36 help="enzymes.xml of maxquant")
39 args = parser.parse_args() 37 args = parser.parse_args()
40 38
41 if args.modifications: 39 if args.modifications:
42 mods_root = ET.parse(args.modifications).getroot() 40 mods_root = ET.parse(args.modifications).getroot()
43
44 mods = mods_root.findall('modification') 41 mods = mods_root.findall('modification')
45 standard_mods = [] 42 standard_mods = []
46 label_mods = [] 43 label_mods = []
44 iso_labels = []
47 for m in mods: 45 for m in mods:
48 if (m.findtext('type') == 'Standard' or m.findtext('type') == 'AaSubstitution'): 46 if (m.findtext('type') == 'Standard' or m.findtext('type') == 'AaSubstitution'):
49 standard_mods.append(m.get('title')) 47 standard_mods.append(m.get('title'))
50 elif m.findtext('type') == 'Label': 48 elif m.findtext('type') == 'Label':
51 label_mods.append(m.get('title')) 49 label_mods.append(m.get('title'))
50 elif m.findtext('type') == 'IsobaricLabel':
51 iso_labels.append(m.get('title'))
52 52
53 if args.enzymes: 53 if args.enzymes:
54 enzymes_root = ET.parse(args.enzymes).getroot() 54 enzymes_root = ET.parse(args.enzymes).getroot()
55
56 enzymes = enzymes_root.findall('enzyme') 55 enzymes = enzymes_root.findall('enzyme')
57 enzymes_list = [e.get('title') for e in enzymes] 56 enzymes_list = [e.get('title') for e in enzymes]
58 57
59 macros_root = ET.parse('./macros.xml').getroot() 58 macros_root = ET.parse('./macros.xml').getroot()
60 for child in macros_root: 59 for child in macros_root:
61 if child.get('name') == 'modification' and args.modifications: 60 if child.get('name') == 'modification' and args.modifications:
62 build_list(child, 'modification', standard_mods) 61 build_list(child, 'modification', standard_mods)
63 elif child.get('name') == 'label' and args.modifications: 62 elif child.get('name') == 'label' and args.modifications:
64 build_list(child, 'label', label_mods) 63 build_list(child, 'label', label_mods)
64 elif child.get('name') == 'iso_labels' and args.modifications:
65 build_list(child, 'iso_labels', iso_labels)
65 elif child.get('name') == 'proteases' and args.enzymes: 66 elif child.get('name') == 'proteases' and args.enzymes:
66 build_list(child, 'proteases', enzymes_list) 67 build_list(child, 'proteases', enzymes_list)
67 68
68 rough_string = ET.tostring(macros_root, 'utf-8') 69 rough_string = ET.tostring(macros_root, 'utf-8')
69 reparsed = minidom.parseString(rough_string) 70 reparsed = minidom.parseString(rough_string)