annotate mqparam.py @ 3:2d67fb758956 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:50:09 -0400
parents 256cc0e17454
children 9cb7dcc07dae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
1 """
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
2 Create a project-specific MaxQuant parameter file.
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
3 """
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
4
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
5 import copy
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
6 import ntpath
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
7 import os
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
8 import re
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
9 import yaml
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
10 import xml.etree.ElementTree as ET
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
11 from itertools import zip_longest
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
12 from xml.dom import minidom
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
13
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
14
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
15 def et_add_child(el, name, text, attrib=None):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
16 "Add a child element to an xml.etree.ElementTree.Element"
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
17 child = ET.SubElement(el, name, attrib=attrib if attrib else {})
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
18 child.text = str(text)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
19 return child
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
20
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
21
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
22 class ParamGroup:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
23 """Represents one parameter Group
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
24 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
25
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
26 def __init__(self, root):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
27 """Initialize with its xml.etree.ElementTree root Element.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
28 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
29 self._root = copy.deepcopy(root)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
30
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
31 def set_list_param(self, key, vals):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
32 """Set a list parameter.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
33 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
34 node = self._root.find(key)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
35 if node is None:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
36 raise ValueError('Element {} not found in parameter file'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
37 .format(key))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
38 node.clear()
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
39 node.tag = key
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
40 for e in vals:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
41 et_add_child(node, name='string', text=e)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
42
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
43 def set_simple_param(self, key, value):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
44 """Set a simple parameter.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
45 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
46 node = self._root.find(key)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
47 if node is None:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
48 raise ValueError('Element {} not found in parameter file'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
49 .format(key))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
50 node.text = str(value)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
51
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
52 def set_silac(self, light_labels, medium_labels, heavy_labels):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
53 """Set label modifications.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
54 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
55 if medium_labels and not (heavy_labels or light_labels): # medium omly with heavy and light
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
56 raise Exception("Incorrect SILAC specification. Use medium only together with light and heavy labels.")
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
57 multiplicity = 3 if medium_labels else 2 if heavy_labels else 1
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
58 max_label = str(max(len(light_labels) if light_labels else 0,
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
59 len(medium_labels) if medium_labels else 0,
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
60 len(heavy_labels) if heavy_labels else 0))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
61 self._root.find('multiplicity').text = str(multiplicity)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
62 self._root.find('maxLabeledAa').text = max_label
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
63 node = self._root.find('labelMods')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
64 node[0].text = ';'.join(light_labels) if light_labels else ''
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
65 if multiplicity == 3:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
66 et_add_child(node, name='string', text=';'.join(medium_labels))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
67 if multiplicity > 1:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
68 et_add_child(node, name='string',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
69 text=';'.join(heavy_labels) if heavy_labels else '')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
70
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
71 def set_isobaric_label(self, internalLabel, terminalLabel,
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
72 cm2, cm1, cp1, cp2, tmtLike):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
73 """Add isobaric label info.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
74 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
75 internalLabel: string
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
76 terminalLabel: string
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
77 cm2: (float) correction factor
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
78 cm1: (float) correction factor
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
79 cp1: (float) correction factor
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
80 cp2: (float) correction factor
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
81 tmtLike: bool or string
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
82 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
83 None
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
84 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
85 iso_labels_node = self._root.find('isobaricLabels')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
86 label = et_add_child(iso_labels_node, 'IsobaricLabelInfo', '')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
87 et_add_child(label, 'internalLabel', internalLabel)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
88 et_add_child(label, 'terminalLabel', terminalLabel)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
89 for num, factor in (('M2', cm2), ('M1', cm1), ('P1', cp1), ('P2', cp2)):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
90 et_add_child(label, 'correctionFactor' + num,
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
91 str(float(factor) if factor % 1 else int(factor)))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
92 et_add_child(label, 'tmtLike', str(tmtLike))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
93
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
94
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
95 class MQParam:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
96 """Represents a mqpar.xml and provides methods to modify
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
97 some of its parameters.
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
98 """
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
99
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
100 def __init__(self, mqpar_in, exp_design=None, yaml=None, substitution_rx=r'[^\s\S]'): # no sub by default
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
101 """Initialize MQParam class. mqpar_in can either be a template
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
102 or a already suitable mqpar file.
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
103 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
104 mqpar_in: a template parameter file
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
105 exp_design: a experimental design template (see MaxQuant documentation),
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
106 can be None
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
107 substitution_rx: a regular expression for replacements in the file names.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
108 It is applied before comparing input file names (e.g. from the exp. design)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
109 """
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
110 self.orig_mqpar = mqpar_in
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
111 self.exp_design = exp_design
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
112 self._root = ET.parse(mqpar_in).getroot()
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
113 self.version = self._root.find('maxQuantVersion').text
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
114 # regex for substitution of certain file name characters
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
115 self.substitution_rx = substitution_rx
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
116 self.pg_node = copy.deepcopy(self._root.find('parameterGroups')[0])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
117 self._paramGroups = []
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
118 self.fasta_file_node = copy.deepcopy(self._root.find('fastaFiles')[0])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
119 if yaml:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
120 self._from_yaml(yaml)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
121
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
122 def __getitem__(self, index):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
123 """Return paramGroup if indexed with integer, else try to find
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
124 matching Element in XML root and return its text or None.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
125 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
126 try:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
127 return self._paramGroups[index]
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
128 except TypeError:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
129 ret = self._root.find(index)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
130 return ret.text if ret is not None else None
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
131
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
132 @staticmethod
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
133 def _check_validity(design, len_infiles):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
134 """Perform some checks on the exp. design template"""
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
135 design_len = len(design['Name'])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
136 # 'Name' can be None, we need at least len_infiles valid entries
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
137 match = len(list(filter(lambda x: bool(x), design['Name'])))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
138 if match < len_infiles:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
139 raise Exception(' '.join(["Error parsing experimental design template:",
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
140 "Found only {} matching entries".format(match),
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
141 "for {} input files".format(len_infiles)]))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
142 for i in range(0, design_len):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
143 msg = "(in line " + str(i + 2) + " of experimental design) "
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
144 if not design['Experiment'][i]:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
145 raise ValueError(msg + " Experiment is empty.")
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
146 if design['PTM'][i].lower() not in ('true', 'false'):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
147 raise ValueError(msg + "Defines invalid PTM value, should be 'True' or 'False'.")
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
148 try:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
149 int(design['Fraction'][i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
150 except ValueError as e:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
151 raise ValueError(msg + str(e))
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
152
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
153 def _make_exp_design(self, groups, files):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
154 """Create a dict representing an experimental design from an
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
155 experimental design template and a list input files.
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
156 If the experimental design template is None, create a default
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
157 design with one experiment for each input file and no fractions
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
158 for all files.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
159 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
160 files: list of input file paths
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
161 groups: list of parameter group indices
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
162 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
163 dict: The (complete) experimental design template
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
164 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
165 design = {s: [] for s in ("Name", "PTM", "Fraction", "Experiment", "paramGroup")}
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
166 if not self.exp_design:
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
167 design["Name"] = files
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
168 design["Fraction"] = ('32767',) * len(files)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
169 design["Experiment"] = [os.path.split(f)[1] for f in files]
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
170 design["PTM"] = ('False',) * len(files)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
171 design["paramGroup"] = groups
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
172 else:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
173 with open(self.exp_design) as design_file:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
174 index_line = design_file.readline().strip()
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
175 index = []
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
176 for i in index_line.split('\t'):
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
177 if i in design:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
178 index.append(i)
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
179 else:
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
180 raise Exception("Invalid column index in experimental design template: {}".format(i))
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
181 for line in design_file:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
182 row = line.strip().split('\t')
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
183 for e, i in zip_longest(row, index):
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
184 if i == "Fraction" and not e:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
185 e = '32767'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
186 elif i == "PTM" and not e:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
187 e = 'False'
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
188 design[i].append(e)
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
189 # map files to names in exp. design template
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
190 names = []
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
191 names_to_paths = {}
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
192 # strip path and extension
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
193 for f in files:
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
194 b = os.path.basename(f)
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
195 basename = b[:-11] if b.lower().endswith('.thermo.raw') else b.rsplit('.', maxsplit=1)[0]
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
196 names_to_paths[basename] = f
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
197 for name in design['Name']:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
198 # same substitution as in maxquant.xml,
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
199 # when passing the element identifiers
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
200 fname = re.sub(self.substitution_rx, '_', name)
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
201 names.append(names_to_paths[fname] if fname in names_to_paths
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
202 else None)
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
203 # replace orig. file names with matching links to galaxy datasets
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
204 design['Name'] = names
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
205 design['paramGroup'] = groups
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
206 MQParam._check_validity(design, len(files))
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
207 return design
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
208
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
209 def add_infiles(self, infiles):
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
210 """Add a list of raw/mzxml files to the mqpar.xml.
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
211 If experimental design template was specified,
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
212 modify other parameters accordingly.
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
213 The files must be specified as absolute paths
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
214 for maxquant to find them.
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
215 Also add parameter Groups.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
216 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
217 infiles: a list of infile lists. first dimension denotes the
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
218 parameter group.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
219 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
220 None
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
221 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
222 groups, files = zip(*[(num, f) for num, l in enumerate(infiles) for f in l])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
223 self._paramGroups = [ParamGroup(self.pg_node) for i in range(len(infiles))]
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
224 nodenames = ('filePaths', 'experiments', 'fractions',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
225 'ptms', 'paramGroupIndices', 'referenceChannel')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
226 design = self._make_exp_design(groups, files)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
227 # Get parent nodes from document
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
228 nodes = dict()
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
229 for nodename in nodenames:
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
230 node = self._root.find(nodename)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
231 if node is None:
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
232 raise ValueError('Element {} not found in parameter file'
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
233 .format(nodename))
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
234 nodes[nodename] = node
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
235 node.clear()
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
236 node.tag = nodename
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
237 # Append sub-elements to nodes (one per file)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
238 for i, name in enumerate(design['Name']):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
239 if name:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
240 et_add_child(nodes['filePaths'], 'string', name)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
241 et_add_child(nodes['experiments'], 'string',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
242 design['Experiment'][i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
243 et_add_child(nodes['fractions'], 'short',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
244 design['Fraction'][i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
245 et_add_child(nodes['ptms'], 'boolean',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
246 design['PTM'][i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
247 et_add_child(nodes['paramGroupIndices'], 'int',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
248 design['paramGroup'][i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
249 et_add_child(nodes['referenceChannel'], 'string', '')
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
250
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
251 def translate(self, infiles):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
252 """Map a list of given infiles to the files specified in the parameter file.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
253 Needed for the mqpar upload in galaxy. Removes the path and then tries
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
254 to match the files.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
255 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
256 infiles: list or tuple of the input
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
257 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
258 None
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
259 """
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
260 # kind of a BUG: fails if filename starts with '.'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
261 infilenames = [os.path.basename(f).split('.')[0] for f in infiles]
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
262 filesNode = self._root.find('filePaths')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
263 files_from_mqpar = [e.text for e in filesNode]
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
264 filesNode.clear()
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
265 filesNode.tag = 'filePaths'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
266 for f in files_from_mqpar:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
267 # either windows or posix path
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
268 win = ntpath.basename(f)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
269 posix = os.path.basename(f)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
270 basename = win if len(win) < len(posix) else posix
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
271 basename_with_sub = re.sub(self.substitution_rx, '_',
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
272 basename.split('.')[0])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
273 # match infiles to their names in mqpar.xml,
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
274 # ignore files missing in mqpar.xml
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
275 if basename_with_sub in infilenames:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
276 i = infilenames.index(basename_with_sub)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
277 et_add_child(filesNode, 'string', infiles[i])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
278 else:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
279 raise ValueError("no matching infile found for " + f)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
280
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
281 def add_fasta_files(self, files, parse_rules={}):
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
282 """Add fasta file groups.
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
283 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
284 files: (list) of fasta file paths
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
285 parseRules: (dict) the parse rules as (tag, text)-pairs
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
286 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
287 None
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
288 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
289 fasta_node = self._root.find('fastaFiles')
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
290 fasta_node.clear()
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
291 for f in files:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
292 fasta_node.append(copy.deepcopy(self.fasta_file_node))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
293 fasta_node[-1].find('fastaFilePath').text = f
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
294 for rule in parse_rules:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
295 fasta_node[-1].find(rule).text = parse_rules[rule]
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
296
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
297 def set_simple_param(self, key, value):
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
298 """Set a simple parameter.
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
299 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
300 key: (string) XML tag of the parameter
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
301 value: the text of the parameter XML node
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
302 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
303 None
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
304 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
305 node = self._root.find(key)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
306 if node is None:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
307 raise ValueError('Element {} not found in parameter file'
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
308 .format(key))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
309 node.text = str(value)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
310
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
311 def _from_yaml(self, conf):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
312 """Read a yaml config file.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
313 Args:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
314 conf: (string) path to the yaml conf file
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
315 Returns:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
316 None
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
317 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
318 with open(conf) as f:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
319 conf_dict = yaml.safe_load(f.read())
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
320 paramGroups = conf_dict.pop('paramGroups')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
321 self.add_infiles([pg.pop('files') for pg in paramGroups])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
322 for i, pg in enumerate(paramGroups):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
323 silac = pg.pop('labelMods', False)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
324 if silac:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
325 self[i].set_silac(*silac)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
326 isobaricLabels = pg.pop('isobaricLabels', False)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
327 if isobaricLabels:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
328 for l in isobaricLabels:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
329 self[i].set_isobaric_label(*l)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
330 for el in ['fixedModifications', 'variableModifications', 'enzymes']:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
331 lst = pg.pop(el, None)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
332 if lst is not None:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
333 self[i].set_list_param(el, lst)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
334 for key in pg:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
335 self[i].set_simple_param(key, pg[key])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
336 fastafiles = conf_dict.pop('fastaFiles', False)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
337 if fastafiles:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
338 self.add_fasta_files(fastafiles, parse_rules=conf_dict.pop('parseRules', {}))
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
339 else:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
340 raise Exception('No fasta files provided.')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
341 for key in conf_dict:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
342 self.set_simple_param(key, conf_dict[key])
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
343
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
344 def write(self, mqpar_out):
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
345 """Write pretty formatted xml parameter file.
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
346 Compose it from global parameters and parameter Groups.
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
347 """
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
348 if self._paramGroups:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
349 pg_node = self._root.find('parameterGroups')
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
350 pg_node.remove(pg_node[0])
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
351 for group in self._paramGroups:
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
352 pg_node.append(group._root)
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
353 rough_string = ET.tostring(self._root, 'utf-8', short_empty_elements=False)
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
354 reparsed = minidom.parseString(rough_string)
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
355 pretty = reparsed.toprettyxml(indent="\t")
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
356 even_prettier = re.sub(r"\n\s+\n", r"\n", pretty)
3
2d67fb758956 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents: 0
diff changeset
357 with open(mqpar_out, 'w') as f:
0
256cc0e17454 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
358 print(even_prettier, file=f)