Mercurial > repos > galaxyp > maxquant
annotate test_mqparam.py @ 10:f522c08e900c draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 63e45d43f403514ab0ceafaf441d761866f1eb7e"
author | galaxyp |
---|---|
date | Fri, 12 Mar 2021 08:41:06 +0000 |
parents | 37d669de2828 |
children |
rev | line source |
---|---|
4
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
1 """Tests for mqparam class. If testing a new MaxQuant version, |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
2 create a new parameter file using '<MAXQUANT_CMD> -c ./mqpar.xml' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
3 """ |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
4 |
9
37d669de2828
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 5e4f8567c0145de8c6f9344fe4ee4c3bf2a81e59"
galaxyp
parents:
4
diff
changeset
|
5 import xml.etree.ElementTree as ET |
37d669de2828
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 5e4f8567c0145de8c6f9344fe4ee4c3bf2a81e59"
galaxyp
parents:
4
diff
changeset
|
6 |
4
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
7 import pytest |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
8 from mqparam import MQParam, ParamGroup |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
9 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
10 TEMPLATE_PATH = './test-data/template.xml' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
11 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
12 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
13 def mk_pg_root(): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
14 mqpar = ET.parse(TEMPLATE_PATH).getroot() |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
15 return mqpar.find('.parameterGroups/parameterGroup') |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
16 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
17 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
18 class TestParamGroup: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
19 def test_list_param(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
20 t = ParamGroup(mk_pg_root()) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
21 t.set_list_param('enzymes', ('test 1', 'test 2')) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
22 assert len(t._root.find('enzymes')) == 2 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
23 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
24 t.set_list_param('variableModifications', ('Oxidation (M)', )) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
25 assert t._root.find('variableModifications')[0].text == 'Oxidation (M)' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
26 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
27 with pytest.raises(ValueError): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
28 t.set_list_param('foo', []) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
29 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
30 def test_simple_params(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
31 t = ParamGroup(mk_pg_root()) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
32 t.set_simple_param('fastLfq', False) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
33 assert t._root.find('.fastLfq').text == 'False' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
34 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
35 with pytest.raises(ValueError): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
36 t.set_simple_param('foo', 2) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
37 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
38 def test_silac(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
39 t = ParamGroup(mk_pg_root()) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
40 t.set_silac(None, None, ('Arg10', 'Lys4')) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
41 assert t._root.find('.maxLabeledAa').text == '2' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
42 assert t._root.find('.multiplicity').text == '2' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
43 assert t._root.find('.labelMods')[1].text == 'Arg10;Lys4' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
44 assert t._root.find('.labelMods')[0].text == '' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
45 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
46 def test_isobaric_label(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
47 t = ParamGroup(mk_pg_root()) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
48 t.set_isobaric_label('iTRAQ4plex-Lys114', 'iTRAQ4plex-Nter114', 0.3, 1, 1.2, 0, True) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
49 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
50 assert len(t._root.find('isobaricLabels')) == 1 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
51 assert len(t._root.find('isobaricLabels')[0]) == 7 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
52 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
53 t.set_isobaric_label('iTRAQ4plex-Lys115', 'iTRAQ4plex-Nter115', 0.3, 1.0, 1.2, 0, True) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
54 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
55 assert len(t._root.find('isobaricLabels')) == 2 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
56 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
57 tag_list = [el.tag for el in t._root.find('isobaricLabels')[1]] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
58 assert tag_list == ['internalLabel', 'terminalLabel', 'correctionFactorM2', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
59 'correctionFactorM1', 'correctionFactorP1', 'correctionFactorP2', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
60 'tmtLike'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
61 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
62 text_list = [el.text for el in t._root.find('isobaricLabels')[1]] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
63 assert text_list == ['iTRAQ4plex-Lys115', 'iTRAQ4plex-Nter115', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
64 '0.3', '1', '1.2', '0', 'True'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
65 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
66 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
67 class TestMQParam: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
68 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
69 def test_version(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
70 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
71 assert t._root.find('maxQuantVersion').text == '1.6.10.43' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
72 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
73 def test_validity_check(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
74 design = {'Name': ['Test1', 'Test2'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
75 'Fraction': ['2', 32767], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
76 'PTM': ['False', 'False'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
77 'Experiment': ['e1', 'e1'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
78 'paramGroup': [0, 0]} |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
79 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
80 assert MQParam._check_validity(design, 2) is None |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
81 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
82 design['Name'][0] = None |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
83 with pytest.raises(Exception): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
84 MQParam._check_validity(design, 2) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
85 design['Name'][0] = 'Test1' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
86 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
87 design['Experiment'][0] = '' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
88 with pytest.raises(ValueError): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
89 MQParam._check_validity(design, 2) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
90 design['Experiment'][0] = 'e1' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
91 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
92 design['Fraction'][0] = 'foo' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
93 with pytest.raises(ValueError): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
94 MQParam._check_validity(design, 2) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
95 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
96 def test_exp_design(self, tmpdir): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
97 # default experimental design when None is specified |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
98 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
99 design = t._make_exp_design((0, 0), ('./Test1.mzXML', './Test2.mzXML')) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
100 assert design['Name'] == ('./Test1.mzXML', './Test2.mzXML') |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
101 assert design['Fraction'] == ('32767', '32767') |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
102 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
103 # valid experimental design |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
104 e1 = tmpdir / "e1.txt" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
105 e1.write('Name\tExperiment\tFraction\tPTM\nTest1\te1\nTest2\te1\t\tfalse') |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
106 t.exp_design = str(e1) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
107 design = t._make_exp_design((0, 0), ('./Test1.mzXML', './Test2.mzXML')) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
108 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
109 assert design == {'Name': ['./Test1.mzXML', './Test2.mzXML'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
110 'Experiment': ['e1', 'e1'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
111 'Fraction': ['32767', '32767'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
112 'PTM': ['False', 'false'], |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
113 'paramGroup': (0, 0)} |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
114 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
115 # invalid header |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
116 e2 = tmpdir / "e2.txt" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
117 e2.write('Name\tExperiment\tFraction\tPTM\tparamGroup\n') |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
118 t.exp_design = str(e2) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
119 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
120 with pytest.raises(Exception): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
121 design = t._make_exp_design(('./Test2.mzXML',), (0,)) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
122 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
123 def test_add_infiles(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
124 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
125 t.add_infiles([('/path/Test1.mzXML', '/path/Test2.mzXML'), |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
126 ('/path/Test3.mzXML', '/path/Test4.mzXML')]) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
127 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
128 assert [e.text for e in t._root.find('filePaths')] == ['/path/Test1.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
129 '/path/Test2.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
130 '/path/Test3.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
131 '/path/Test4.mzXML'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
132 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
133 assert [e.text for e in t._root.find('paramGroupIndices')] == ['0', '0', '1', '1'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
134 assert t[1] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
135 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
136 def test_translate(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
137 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
138 t.add_infiles([('/posix/path/to/Test1.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
139 '/posix/path/to/Test2.mzXML'), |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
140 ('/path/dummy.mzXML',)]) # mqparam is not designed for windows |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
141 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
142 t._root.find('filePaths')[2].text = r'D:\Windows\Path\Test3.mzXML' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
143 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
144 t.translate(('/galaxy/working/Test3.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
145 '/galaxy/working/Test1.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
146 '/galaxy/working/Test2.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
147 '/galaxy/working/Test4.mzXML')) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
148 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
149 assert [e.text for e in t._root.find('filePaths')] == ['/galaxy/working/Test1.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
150 '/galaxy/working/Test2.mzXML', |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
151 '/galaxy/working/Test3.mzXML'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
152 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
153 def test_fasta_files(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
154 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
155 t.add_fasta_files(('test1', 'test2'), |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
156 parse_rules={'identifierParseRule': r'>([^\s]*)'}) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
157 assert len(t._root.find('fastaFiles')) == 2 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
158 assert t._root.find('fastaFiles')[0].find("fastaFilePath").text == 'test1' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
159 assert t._root.find('fastaFiles')[0].find("identifierParseRule").text == '>([^\\s]*)' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
160 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
161 def test_simple_param(self): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
162 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
163 t.set_simple_param('minUniquePeptides', 4) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
164 assert t._root.find('.minUniquePeptides').text == '4' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
165 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
166 with pytest.raises(ValueError): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
167 t.set_simple_param('foo', 3) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
168 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
169 def test_from_yaml(self, tmpdir): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
170 conf1 = tmpdir / "conf1.yml" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
171 conf1.write(r""" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
172 numThreads: 4 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
173 fastaFiles: [test1.fasta,test2.fasta] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
174 parseRules: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
175 identifierParseRule: ^>.*\|(.*)\|.*$ |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
176 paramGroups: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
177 - files: [Test1.mzXML,Test2.mzXML] # paramGroup 0 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
178 fixedModifications: [mod1,mod2] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
179 lfqMode: 1 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
180 - files: [Test3.mzXML,Test4.mzXML] # paramGroup 1 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
181 labelMods: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
182 - [] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
183 - [] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
184 - [label1,label2] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
185 """) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
186 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
187 t = MQParam(TEMPLATE_PATH) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
188 t._from_yaml(str(conf1)) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
189 assert t['numThreads'] == '4' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
190 assert [child.text for child in t[1]._root.find('labelMods')] == ['', 'label1;label2'] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
191 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
192 def test_write(self, tmpdir): |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
193 yaml_conf = tmpdir / "conf.yml" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
194 yaml_conf.write(r""" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
195 numThreads: 4 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
196 fastaFiles: [test1.fasta,test2.fasta] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
197 parseRules: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
198 identifierParseRule: ^>.*\|(.*)\|.*$ |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
199 paramGroups: |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
200 - files: [Test1.mzXML,Test2.mzXML] # paramGroup 0 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
201 fixedModifications: [mod1] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
202 variableModifications: [mod2,mod3] |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
203 maxMissedCleavages: 1 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
204 """) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
205 mqpar_out = tmpdir / "mqpar.xml" |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
206 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
207 t = MQParam(TEMPLATE_PATH, yaml=str(yaml_conf)) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
208 t.write(str(mqpar_out)) |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
209 |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
210 test = ET.parse(str(mqpar_out)).getroot() |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
211 assert test.find('numThreads').text == '4' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
212 assert test.find('fastaFiles')[1].find('identifierParseRule').text == '^>.*\\|(.*)\\|.*$' |
dcd39bcc7481
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
213 assert [el.text for el in test.find('parameterGroups')[0].find('variableModifications')] == ['mod2', 'mod3'] |