1
// --------------------------------------------------------------------------
2
// OpenMS -- Open-Source Mass Spectrometry
3
// --------------------------------------------------------------------------
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
7
// This software is released under a three-clause BSD license:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of any author or any participating institution
14
// may be used to endorse or promote products derived from this software
15
// without specific prior written permission.
16
// For a full list of authors, refer to the file AUTHORS.
17
// --------------------------------------------------------------------------
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
// --------------------------------------------------------------------------
31
// $Maintainer: Stephan Aiche$
32
// $Authors: Stephan Aiche$
33
// --------------------------------------------------------------------------
35
#include <OpenMS/CONCEPT/ClassTest.h>
37
///////////////////////////
38
#include <OpenMS/ANALYSIS/QUANTITATION/ItraqFourPlexQuantitationMethod.h>
39
///////////////////////////
41
using namespace OpenMS;
44
START_TEST(ItraqFourPlexQuantitationMethod, "$Id: ItraqFourPlexQuantitationMethod_test.C 11266 2013-05-21 08:12:56Z aiche $")
46
/////////////////////////////////////////////////////////////
47
/////////////////////////////////////////////////////////////
49
ItraqFourPlexQuantitationMethod* ptr = 0;
50
ItraqFourPlexQuantitationMethod* null_ptr = 0;
51
START_SECTION(ItraqFourPlexQuantitationMethod())
53
ptr = new ItraqFourPlexQuantitationMethod();
54
TEST_NOT_EQUAL(ptr, null_ptr)
58
START_SECTION(~ItraqFourPlexQuantitationMethod())
64
START_SECTION((const String& getName() const ))
66
ItraqFourPlexQuantitationMethod quant_meth;
67
TEST_STRING_EQUAL(quant_meth.getName(), "itraq4plex")
71
START_SECTION((ItraqFourPlexQuantitationMethod(const ItraqFourPlexQuantitationMethod &other)))
73
ItraqFourPlexQuantitationMethod qm;
74
Param p = qm.getParameters();
75
p.setValue("channel_114_description", "new_description");
76
p.setValue("reference_channel", 116);
79
ItraqFourPlexQuantitationMethod qm2(qm);
80
IsobaricQuantitationMethod::IsobaricChannelList channel_list = qm2.getChannelInformation();
81
TEST_STRING_EQUAL(channel_list[0].description, "new_description")
82
TEST_EQUAL(qm2.getReferenceChannel(), 2)
86
START_SECTION((ItraqFourPlexQuantitationMethod& operator=(const ItraqFourPlexQuantitationMethod &rhs)))
88
ItraqFourPlexQuantitationMethod qm;
89
Param p = qm.getParameters();
90
p.setValue("channel_114_description", "new_description");
91
p.setValue("reference_channel", 116);
94
ItraqFourPlexQuantitationMethod qm2;
96
IsobaricQuantitationMethod::IsobaricChannelList channel_list = qm2.getChannelInformation();
97
TEST_STRING_EQUAL(channel_list[0].description, "new_description")
98
TEST_EQUAL(qm2.getReferenceChannel(), 2)
103
START_SECTION((const IsobaricChannelList& getChannelInformation() const ))
105
ItraqFourPlexQuantitationMethod quant_meth;
106
IsobaricQuantitationMethod::IsobaricChannelList channel_list = quant_meth.getChannelInformation();
108
TEST_EQUAL(channel_list.size(), 4)
109
ABORT_IF(channel_list.size() != 4)
111
// descriptions are empty by default
112
TEST_STRING_EQUAL(channel_list[0].description, "")
113
TEST_STRING_EQUAL(channel_list[1].description, "")
114
TEST_STRING_EQUAL(channel_list[2].description, "")
115
TEST_STRING_EQUAL(channel_list[3].description, "")
118
TEST_EQUAL(channel_list[0].name, 114)
119
TEST_EQUAL(channel_list[0].id, 0)
120
TEST_EQUAL(channel_list[0].center, 114.1112)
122
TEST_EQUAL(channel_list[1].name, 115)
123
TEST_EQUAL(channel_list[1].id, 1)
124
TEST_EQUAL(channel_list[1].center, 115.1082)
126
TEST_EQUAL(channel_list[2].name, 116)
127
TEST_EQUAL(channel_list[2].id, 2)
128
TEST_EQUAL(channel_list[2].center, 116.1116)
130
TEST_EQUAL(channel_list[3].name, 117)
131
TEST_EQUAL(channel_list[3].id, 3)
132
TEST_EQUAL(channel_list[3].center, 117.1149)
136
START_SECTION((Size getNumberOfChannels() const ))
138
ItraqFourPlexQuantitationMethod quant_meth;
139
TEST_EQUAL(quant_meth.getNumberOfChannels(), 4)
143
START_SECTION((virtual Matrix<double> getIsotopeCorrectionMatrix() const ))
145
ItraqFourPlexQuantitationMethod quant_meth;
147
// we only check the default matrix here
148
Matrix<double> m = quant_meth.getIsotopeCorrectionMatrix();
149
TEST_EQUAL(m.rows(), 4)
150
TEST_EQUAL(m.cols(), 4)
152
ABORT_IF(m.rows() != 4)
153
ABORT_IF(m.cols() != 4)
157
0.059 0.923 0.03 0.001
158
0.002 0.056 0.924 0.04
161
double real_m[4][4] = {{0.929, 0.02, 0, 0},
162
{0.059, 0.923, 0.03, 0.001},
163
{0.002, 0.056, 0.924, 0.04},
164
{0, 0.001, 0.045, 0.923}};
166
for(Matrix<double>::SizeType i = 0; i < m.rows(); ++i)
168
for(Matrix<double>::SizeType j = 0; j < m.cols(); ++j)
170
TEST_REAL_SIMILAR(m(i,j), real_m[i][j])
176
START_SECTION((virtual Size getReferenceChannel() const ))
178
ItraqFourPlexQuantitationMethod quant_meth;
179
TEST_EQUAL(quant_meth.getReferenceChannel(), 0)
182
p.setValue("reference_channel",115);
183
quant_meth.setParameters(p);
185
TEST_EQUAL(quant_meth.getReferenceChannel(), 1)
189
/////////////////////////////////////////////////////////////
190
/////////////////////////////////////////////////////////////