1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
|
// --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
//
// This software is released under a three-clause BSD license:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Erhan Kenar $
// $Authors: $
// --------------------------------------------------------------------------
#include <OpenMS/CONCEPT/ClassTest.h>
#include <OpenMS/KERNEL/StandardTypes.h>
///////////////////////////
#include <OpenMS/KERNEL/ConsensusMap.h>
#include <OpenMS/KERNEL/FeatureMap.h>
///////////////////////////
using namespace OpenMS;
using namespace std;
START_TEST(ConsensusMap, "$Id: ConsensusMap_test.C 11407 2013-06-24 08:29:20Z hroest $")
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
ConsensusMap* ptr = 0;
ConsensusMap* nullPointer = 0;
START_SECTION((ConsensusMap()))
ptr = new ConsensusMap();
TEST_NOT_EQUAL(ptr, nullPointer)
TEST_EQUAL(ptr->isMetaEmpty(),true)
TEST_REAL_SIMILAR(ptr->getMinInt(), numeric_limits<DoubleReal>::max())
TEST_REAL_SIMILAR(ptr->getMaxInt(), -numeric_limits<DoubleReal>::max())
END_SECTION
START_SECTION((~ConsensusMap()))
delete ptr;
END_SECTION
START_SECTION((const std::vector<ProteinIdentification>& getProteinIdentifications() const))
FeatureMap<> tmp;
TEST_EQUAL(tmp.getProteinIdentifications().size(),0)
END_SECTION
START_SECTION((std::vector<ProteinIdentification>& getProteinIdentifications()))
FeatureMap<> tmp;
tmp.getProteinIdentifications().resize(1);
TEST_EQUAL(tmp.getProteinIdentifications().size(),1)
END_SECTION
START_SECTION((void setProteinIdentifications(const std::vector<ProteinIdentification>& protein_identifications)))
FeatureMap<> tmp;
tmp.setProteinIdentifications(std::vector<ProteinIdentification>(2));
TEST_EQUAL(tmp.getProteinIdentifications().size(),2)
END_SECTION
START_SECTION((const std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications() const))
FeatureMap<> tmp;
TEST_EQUAL(tmp.getUnassignedPeptideIdentifications().size(),0)
END_SECTION
START_SECTION((std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications()))
FeatureMap<> tmp;
tmp.getUnassignedPeptideIdentifications().resize(1);
TEST_EQUAL(tmp.getUnassignedPeptideIdentifications().size(),1)
END_SECTION
START_SECTION((void setUnassignedPeptideIdentifications(const std::vector<PeptideIdentification>& unassigned_peptide_identifications)))
FeatureMap<> tmp;
tmp.setUnassignedPeptideIdentifications(std::vector<PeptideIdentification>(2));
TEST_EQUAL(tmp.getUnassignedPeptideIdentifications().size(),2)
END_SECTION
START_SECTION((const std::vector<DataProcessing>& getDataProcessing() const))
ConsensusMap tmp;
TEST_EQUAL(tmp.getDataProcessing().size(),0);
END_SECTION
START_SECTION((std::vector<DataProcessing>& getDataProcessing()))
ConsensusMap tmp;
tmp.getDataProcessing().resize(1);
TEST_EQUAL(tmp.getDataProcessing().size(),1);
END_SECTION
START_SECTION((void setDataProcessing(const std::vector< DataProcessing > &processing_method)))
ConsensusMap tmp;
std::vector<DataProcessing> dummy;
dummy.resize(1);
tmp.setDataProcessing(dummy);
TEST_EQUAL(tmp.getDataProcessing().size(),1);
END_SECTION
Feature feature1;
feature1.getPosition()[0] = 2.0;
feature1.getPosition()[1] = 3.0;
feature1.setIntensity(1.0f);
Feature feature2;
feature2.getPosition()[0] = 0.0;
feature2.getPosition()[1] = 2.5;
feature2.setIntensity(0.5f);
Feature feature3;
feature3.getPosition()[0] = 10.5;
feature3.getPosition()[1] = 0.0;
feature3.setIntensity(0.01f);
Feature feature4;
feature4.getPosition()[0] = 5.25;
feature4.getPosition()[1] = 1.5;
feature4.setIntensity(0.5f);
START_SECTION((void updateRanges()))
ConsensusMap map;
feature1.setUniqueId(1);
ConsensusFeature f;
f.setIntensity(1.0f);
f.setRT(2.0);
f.setMZ(3.0);
f.insert(1,feature1);
map.push_back(f);
map.updateRanges();
TEST_REAL_SIMILAR(map.getMaxInt(),1.0)
TEST_REAL_SIMILAR(map.getMinInt(),1.0)
TEST_REAL_SIMILAR(map.getMax()[0],2.0)
TEST_REAL_SIMILAR(map.getMax()[1],3.0)
TEST_REAL_SIMILAR(map.getMin()[0],2.0)
TEST_REAL_SIMILAR(map.getMin()[1],3.0)
//second time to check the initialization
map.updateRanges();
TEST_REAL_SIMILAR(map.getMaxInt(),1.0)
TEST_REAL_SIMILAR(map.getMinInt(),1.0)
TEST_REAL_SIMILAR(map.getMax()[0],2.0)
TEST_REAL_SIMILAR(map.getMax()[1],3.0)
TEST_REAL_SIMILAR(map.getMin()[0],2.0)
TEST_REAL_SIMILAR(map.getMin()[1],3.0)
//two points
feature2.setUniqueId(2);
f.insert(1,feature2);
map.push_back(f);
map.updateRanges();
TEST_REAL_SIMILAR(map.getMaxInt(),1.0)
TEST_REAL_SIMILAR(map.getMinInt(),0.5)
TEST_REAL_SIMILAR(map.getMax()[0],2.0)
TEST_REAL_SIMILAR(map.getMax()[1],3.0)
TEST_REAL_SIMILAR(map.getMin()[0],0.0)
TEST_REAL_SIMILAR(map.getMin()[1],2.5)
//four points
feature3.setUniqueId(3);
f.insert(1,feature3);
feature4.setUniqueId(4);
f.insert(1,feature4);
map.push_back(f);
map.updateRanges();
TEST_REAL_SIMILAR(map.getMaxInt(),1.0)
TEST_REAL_SIMILAR(map.getMinInt(),0.01)
TEST_REAL_SIMILAR(map.getMax()[0],10.5)
TEST_REAL_SIMILAR(map.getMax()[1],3.0)
TEST_REAL_SIMILAR(map.getMin()[0],0.0)
TEST_REAL_SIMILAR(map.getMin()[1],0.0)
END_SECTION
START_SECTION((ConsensusMap& operator+=(const ConsensusMap &rhs)))
{
ConsensusMap m1, m2, m3;
// adding empty maps has no effect:
m1+=m2;
TEST_EQUAL(m1, m3);
// with content:
ConsensusFeature f1;
f1.setMZ(100.12);
m1.push_back(f1);
m3 = m1;
m1+=m2;
TEST_EQUAL(m1, m3);
// test basic classes
m1.setIdentifier ("123");
m1.getDataProcessing().resize(1);
m1.getProteinIdentifications().resize(1);
m1.getUnassignedPeptideIdentifications().resize(1);
m1.ensureUniqueId();
m1.getFileDescriptions()[0].filename = "m1";
m2.setIdentifier ("321");
m2.getDataProcessing().resize(2);
m2.getProteinIdentifications().resize(2);
m2.getUnassignedPeptideIdentifications().resize(2);
m2.push_back(ConsensusFeature());
m2.push_back(ConsensusFeature());
m2.getFileDescriptions()[1].filename = "m2";
m1+=m2;
TEST_EQUAL(m1.getIdentifier(), "");
TEST_EQUAL(UniqueIdInterface::isValid(m1.getUniqueId()), false);
TEST_EQUAL(m1.getDataProcessing().size(), 3);
TEST_EQUAL(m1.getProteinIdentifications().size(),3);
TEST_EQUAL(m1.getUnassignedPeptideIdentifications().size(),3);
TEST_EQUAL(m1.size(),3);
TEST_EQUAL(m1.getFileDescriptions().size(), 2);
}
END_SECTION
START_SECTION((ConsensusMap& operator = (const ConsensusMap& source)))
ConsensusMap map1;
map1.setMetaValue("meta",String("value"));
map1.setIdentifier("lsid");
map1.getFileDescriptions()[0].filename = "blub";
map1.getFileDescriptions()[0].size = 47;
map1.getFileDescriptions()[0].label = "label";
map1.getFileDescriptions()[0].setMetaValue("meta",String("meta"));
map1.getDataProcessing().resize(1);
map1.setExperimentType("itraq");
map1.getProteinIdentifications().resize(1);
map1.getUnassignedPeptideIdentifications().resize(1);
//assignment
ConsensusMap map2;
map2 = map1;
TEST_EQUAL(map2.getIdentifier(),"lsid")
TEST_EQUAL(map2.getMetaValue("meta").toString(),"value")
TEST_EQUAL(map2.getFileDescriptions()[0].filename == "blub", true)
TEST_EQUAL(map2.getFileDescriptions()[0].label == "label", true)
TEST_EQUAL(map2.getFileDescriptions()[0].size == 47, true)
TEST_EQUAL(map2.getFileDescriptions()[0].getMetaValue("meta") == "meta", true)
TEST_EQUAL(map2.getExperimentType(), "itraq")
TEST_EQUAL(map2.getDataProcessing().size(),1)
TEST_EQUAL(map2.getProteinIdentifications().size(),1);
TEST_EQUAL(map2.getUnassignedPeptideIdentifications().size(),1);
//assignment of empty object
map2 = ConsensusMap();
TEST_EQUAL(map2.getIdentifier(),"")
TEST_EQUAL(map2.getFileDescriptions().size(),0)
TEST_EQUAL(map2.getExperimentType(),"")
TEST_EQUAL(map2.getDataProcessing().size(),0)
TEST_EQUAL(map2.getProteinIdentifications().size(),0);
TEST_EQUAL(map2.getUnassignedPeptideIdentifications().size(),0);
END_SECTION
START_SECTION((ConsensusMap(const ConsensusMap& source)))
ConsensusMap map1;
map1.setMetaValue("meta",String("value"));
map1.setIdentifier("lsid");
map1.getFileDescriptions()[0].filename = "blub";
map1.getFileDescriptions()[0].size = 47;
map1.getFileDescriptions()[0].label = "label";
map1.getFileDescriptions()[0].setMetaValue("meta",String("meta"));
map1.getDataProcessing().resize(1);
map1.setExperimentType("itraq");
map1.getProteinIdentifications().resize(1);
map1.getUnassignedPeptideIdentifications().resize(1);
ConsensusMap map2(map1);
TEST_EQUAL(map2.getIdentifier(),"lsid")
TEST_EQUAL(map2.getMetaValue("meta").toString(),"value")
TEST_EQUAL(map2.getFileDescriptions()[0].filename == "blub", true)
TEST_EQUAL(map2.getFileDescriptions()[0].label == "label", true)
TEST_EQUAL(map2.getFileDescriptions()[0].size == 47, true)
TEST_EQUAL(map2.getFileDescriptions()[0].getMetaValue("meta") == "meta", true)
TEST_EQUAL(map2.getExperimentType(),"itraq")
TEST_EQUAL(map2.getDataProcessing().size(),1)
TEST_EQUAL(map2.getProteinIdentifications().size(),1);
TEST_EQUAL(map2.getUnassignedPeptideIdentifications().size(),1);
END_SECTION
START_SECTION((ConsensusMap(Base::size_type n)))
ConsensusMap cons_map(5);
TEST_EQUAL(cons_map.size(),5)
END_SECTION
START_SECTION((template < typename FeatureT > static void convert(UInt64 const input_map_index, FeatureMap< FeatureT > const &input_map, ConsensusMap &output_map, Size n=-1)))
FeatureMap<> fm;
Feature f;
for ( UInt i = 0; i < 3; ++i )
{
f.setRT(i*77.7);
f.setMZ(i+100.35);
f.setUniqueId(i*33+17);
fm.push_back(f);
}
ConsensusMap cm;
ConsensusMap::convert(33,fm,cm);
TEST_EQUAL(cm.size(),3);
TEST_EQUAL(cm.getFileDescriptions()[33].size,3);
for ( UInt i = 0; i < 3; ++i )
{
TEST_EQUAL(cm[i].size(),1);
TEST_EQUAL(cm[i].begin()->getMapIndex(),33);
TEST_EQUAL(cm[i].begin()->getUniqueId(),i*33+17);
TEST_REAL_SIMILAR(cm[i].begin()->getRT(),i*77.7);
TEST_REAL_SIMILAR(cm[i].begin()->getMZ(),i+100.35);
}
cm.clear();
ConsensusMap::convert(33,fm,cm,2);
TEST_EQUAL(cm.size(),2);
TEST_EQUAL(cm.getFileDescriptions()[33].size,3);
END_SECTION
/////
MSExperiment<Peak1D> mse;
MSSpectrum<Peak1D> mss;
Peak1D p;
for ( UInt m = 0; m < 3; ++m )
{
mss.clear(true);
for ( UInt i = 0; i < 4; ++i )
{
p.setMZ( 10* m + i + 100.35);
p.setIntensity( 900 + 7*m + 5*i );
mss.push_back(p);
}
mse.addSpectrum(mss);
mse.getSpectra().back().setRT(m*5);
}
START_SECTION((static void convert(UInt64 const input_map_index, MSExperiment<> & input_map, ConsensusMap& output_map, Size n = -1)))
{
ConsensusMap cm;
ConsensusMap::convert(33,mse,cm,8);
TEST_EQUAL(cm.size(),8);
for ( UInt i = 0; i < cm.size(); ++i)
{
STATUS("\n" << i << ": " << cm[i] );
}
TEST_EQUAL(cm.back().getIntensity(),912);
}
END_SECTION
/////
ConsensusMap cm;
ConsensusMap::convert(33,mse,cm,8);
START_SECTION((template < typename FeatureT > static void convert(ConsensusMap const &input_map, const bool keep_uids, FeatureMap< FeatureT > &output_map)))
{
FeatureMap<> out_fm;
ConsensusMap::convert(cm, true, out_fm);
TEST_EQUAL(cm.getUniqueId(), out_fm.getUniqueId());
TEST_EQUAL(cm.getProteinIdentifications().size(), out_fm.getProteinIdentifications().size());
TEST_EQUAL(cm.getUnassignedPeptideIdentifications().size(), out_fm.getUnassignedPeptideIdentifications().size());
TEST_EQUAL(cm.size(), out_fm.size());
for (Size i = 0; i < cm.size(); ++i)
{
TEST_EQUAL(cm[i], out_fm[i]);
}
out_fm.clear();
ConsensusMap::convert(cm, false, out_fm);
TEST_NOT_EQUAL(cm.getUniqueId(), out_fm.getUniqueId());
for (Size i = 0; i < cm.size(); ++i)
{
TEST_REAL_SIMILAR(cm[i].getRT(), out_fm[i].getRT());
TEST_REAL_SIMILAR(cm[i].getMZ(), out_fm[i].getMZ());
TEST_REAL_SIMILAR(cm[i].getIntensity(), out_fm[i].getIntensity());
TEST_NOT_EQUAL(cm[i].getUniqueId(), out_fm[i].getUniqueId());
}
}
END_SECTION
ConsensusMap::FileDescription* fd_ptr = 0;
ConsensusMap::FileDescription* fd_nullPointer = 0;
START_SECTION(([ConsensusMap::FileDescription] FileDescription()))
fd_ptr = new ConsensusMap::FileDescription();
TEST_NOT_EQUAL(fd_ptr, fd_nullPointer)
END_SECTION
START_SECTION((const FileDescriptions& getFileDescriptions() const))
ConsensusMap cons_map;
TEST_EQUAL(cons_map.getFileDescriptions().size(),0)
END_SECTION
START_SECTION((FileDescriptions& getFileDescriptions()))
ConsensusMap cons_map;
cons_map.getFileDescriptions()[0].filename = "blub";
TEST_EQUAL(cons_map.getFileDescriptions()[0].filename == "blub", true)
END_SECTION
START_SECTION((const String& getExperimentType() const))
ConsensusMap cons_map;
TEST_EQUAL(cons_map.getExperimentType() == "", true)
END_SECTION
START_SECTION((void setExperimentType(const String& experiment_type)))
ConsensusMap cons_map;
cons_map.setExperimentType("itraq");
TEST_EQUAL(cons_map.getExperimentType(),"itraq")
END_SECTION
START_SECTION((void swap(ConsensusMap& from)))
ConsensusMap map1, map2;
ConsensusFeature f;
f.insert(1,Feature());
map1.push_back(f);
map1.getFileDescriptions()[1].filename = "bla";
map1.getFileDescriptions()[1].size = 5;
map1.setIdentifier("LSID");
map1.setExperimentType("itraq");
map1.getDataProcessing().resize(1);
map1.getProteinIdentifications().resize(1);
map1.getUnassignedPeptideIdentifications().resize(1);
map1.swap(map2);
TEST_EQUAL(map1.size(),0)
TEST_EQUAL(map1.getFileDescriptions().size(),0)
TEST_EQUAL(map1.getIdentifier(),"")
TEST_EQUAL(map1.getDataProcessing().size(),0)
TEST_EQUAL(map1.getProteinIdentifications().size(),0);
TEST_EQUAL(map1.getUnassignedPeptideIdentifications().size(),0);
TEST_EQUAL(map2.size(),1)
TEST_EQUAL(map2.getFileDescriptions().size(),1)
TEST_EQUAL(map2.getIdentifier(),"LSID")
TEST_EQUAL(map2.getExperimentType(),"itraq")
TEST_EQUAL(map2.getDataProcessing().size(),1)
TEST_EQUAL(map2.getProteinIdentifications().size(),1);
TEST_EQUAL(map2.getUnassignedPeptideIdentifications().size(),1);
END_SECTION
START_SECTION((bool operator == (const ConsensusMap& rhs) const))
ConsensusMap empty,edit;
TEST_EQUAL(empty==edit, true);
edit.setIdentifier("lsid");;
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.push_back(ConsensusFeature(feature1));
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.getDataProcessing().resize(1);
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.setMetaValue("bla", 4.1);
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.getFileDescriptions()[0].filename = "bla";
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.setExperimentType("bla");
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.getProteinIdentifications().resize(10);
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.getUnassignedPeptideIdentifications().resize(10);
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.setExperimentType("bla");
TEST_EQUAL(empty==edit, false);
edit = empty;
edit.push_back(ConsensusFeature(feature1));
edit.push_back(ConsensusFeature(feature2));
edit.updateRanges();
edit.clear(false);
TEST_EQUAL(empty==edit, false);
END_SECTION
START_SECTION((bool operator != (const ConsensusMap& rhs) const))
ConsensusMap empty,edit;
TEST_EQUAL(empty!=edit, false);
edit.setIdentifier("lsid");;
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.push_back(ConsensusFeature(feature1));
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.getDataProcessing().resize(1);
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.setMetaValue("bla", 4.1);
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.getFileDescriptions()[0].filename = "bla";
TEST_EQUAL(empty!=edit, true)
edit = empty;
edit.setExperimentType("bla");
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.getProteinIdentifications().resize(10);
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.getUnassignedPeptideIdentifications().resize(10);
TEST_EQUAL(empty!=edit, true);
edit = empty;
edit.push_back(ConsensusFeature(feature1));
edit.push_back(ConsensusFeature(feature2));
edit.updateRanges();
edit.clear(false);
TEST_EQUAL(empty!=edit, true);
END_SECTION
START_SECTION((void sortByIntensity(bool reverse=false)))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortByRT()))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortByMZ()))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortByPosition()))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortByQuality(bool reverse=false)))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortBySize()))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void sortByMaps()))
{
NOT_TESTABLE; // tested within TOPP TextExporter
}
END_SECTION
START_SECTION((void clear(bool clear_meta_data = true)))
{
ConsensusMap map1;
ConsensusFeature f;
f.insert(1,Feature());
map1.push_back(f);
map1.getFileDescriptions()[1].filename = "bla";
map1.getFileDescriptions()[1].size = 5;
map1.setIdentifier("LSID");
map1.setExperimentType("itraq");
map1.getDataProcessing().resize(1);
map1.getProteinIdentifications().resize(1);
map1.getUnassignedPeptideIdentifications().resize(1);
map1.clear(false);
TEST_EQUAL(map1.size(),0)
TEST_EQUAL(map1==ConsensusMap(),false)
map1.clear(true);
TEST_EQUAL(map1==ConsensusMap(),true)
}
END_SECTION
START_SECTION((template < typename Type > Size applyMemberFunction(Size(Type::*member_function)())))
{
ConsensusMap cm;
cm.push_back(ConsensusFeature());
cm.push_back(ConsensusFeature());
cm.push_back(ConsensusFeature());
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),4);
cm.setUniqueId();
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),3);
cm.applyMemberFunction(&UniqueIdInterface::setUniqueId);
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasValidUniqueId),4);
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),0);
cm.begin()->clearUniqueId();
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasValidUniqueId),3);
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),1);
}
END_SECTION
START_SECTION((template < typename Type > Size applyMemberFunction(Size(Type::*member_function)() const ) const ))
{
ConsensusMap cm;
ConsensusMap const & cmc(cm);
cm.push_back(ConsensusFeature());
cm.push_back(ConsensusFeature());
cm.push_back(ConsensusFeature());
TEST_EQUAL(cmc.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),4);
cm.setUniqueId();
TEST_EQUAL(cmc.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),3);
cm.applyMemberFunction(&UniqueIdInterface::setUniqueId);
TEST_EQUAL(cmc.applyMemberFunction(&UniqueIdInterface::hasValidUniqueId),4);
TEST_EQUAL(cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),0);
cm.begin()->clearUniqueId();
TEST_EQUAL(cmc.applyMemberFunction(&UniqueIdInterface::hasValidUniqueId),3);
TEST_EQUAL(cmc.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId),1);
}
END_SECTION
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|