ProteoWizard
Functions | Variables
ReferencesTest.cpp File Reference
#include "References.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/utility/minimxml/XMLWriter.hpp"

Go to the source code of this file.

Functions

void testTransition ()
 
void testTraData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

◆ testTransition()

void testTransition ( )

Definition at line 38 of file ReferencesTest.cpp.

39{
40 if (os_) *os_ << "testTransition()\n";
41
42 Transition transition;
43 transition.peptidePtr = PeptidePtr(new Peptide("pep1"));
44 transition.peptidePtr->proteinPtrs.push_back(ProteinPtr(new Protein("prot1")));
45 transition.compoundPtr = CompoundPtr(new Compound("cmp1"));
46
47 TraData td;
48 td.peptidePtrs.push_back(PeptidePtr(new Peptide("pep1")));
49 td.peptidePtrs.back()->set(MS_theoretical_mass, 123);
50 td.peptidePtrs.back()->proteinPtrs.push_back(ProteinPtr(new Protein("prot1")));
51 td.peptidePtrs.back()->proteinPtrs.back()->sequence = "ABCD";
52
53 td.compoundPtrs.push_back(CompoundPtr(new Compound("cmp1")));
54 td.compoundPtrs.back()->retentionTimes.push_back(RetentionTime());
55 td.compoundPtrs.back()->retentionTimes.back().set(MS_peak_intensity, 123);
56
57 References::resolve(transition, td);
58
59 unit_assert(transition.peptidePtr->cvParam(MS_theoretical_mass).value == "123");
60 unit_assert(transition.peptidePtr->proteinPtrs.back().get());
61 unit_assert(transition.peptidePtr->proteinPtrs.back()->sequence == "ABCD");
62 unit_assert(!transition.compoundPtr->retentionTimes.empty());
63 unit_assert(transition.compoundPtr->retentionTimes.back().cvParam(MS_peak_intensity).value == "123");
64}
represents a peptide or polypeptide (a sequence of amino acids)
Definition Peptide.hpp:62
MS_theoretical_mass
theoretical mass: The theoretical mass of the molecule (e.g. the peptide sequence and its modificatio...
Definition cv.hpp:3810
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum.
Definition cv.hpp:402
boost::shared_ptr< Protein > ProteinPtr
PWIZ_API_DECL void resolve(RetentionTime &retentionTime, const TraData &td)
boost::shared_ptr< Compound > CompoundPtr
Definition TraData.hpp:254
boost::shared_ptr< Peptide > PeptidePtr
Definition TraData.hpp:236
Chemical compound other than a peptide for which one or more transitions.
Definition TraData.hpp:241
std::vector< CompoundPtr > compoundPtrs
Definition TraData.hpp:376
std::vector< PeptidePtr > peptidePtrs
List of compounds (including peptides) for which one or more transitions are intended to identify.
Definition TraData.hpp:375
PeptidePtr peptidePtr
Reference to a peptide which this transition is intended to identify.
Definition TraData.hpp:279
CompoundPtr compoundPtr
Reference to a compound for this transition.
Definition TraData.hpp:282
ostream * os_
#define unit_assert(x)
Definition unit.hpp:85

References pwiz::tradata::Transition::compoundPtr, pwiz::tradata::TraData::compoundPtrs, MS_peak_intensity, MS_theoretical_mass, os_, pwiz::tradata::Transition::peptidePtr, pwiz::tradata::TraData::peptidePtrs, pwiz::tradata::References::resolve(), and unit_assert.

Referenced by test().

◆ testTraData()

void testTraData ( )

Definition at line 67 of file ReferencesTest.cpp.

68{
69 TraData td;
70 td.proteinPtrs.push_back(ProteinPtr(new Protein("prot1")));
71 td.proteinPtrs.back()->sequence = "ABCD";
72
73 td.peptidePtrs.push_back(PeptidePtr(new Peptide("pep1")));
74 td.peptidePtrs.back()->set(MS_theoretical_mass, 123);
75 td.peptidePtrs.back()->proteinPtrs.push_back(ProteinPtr(new Protein("prot1")));
76
77 td.compoundPtrs.push_back(CompoundPtr(new Compound("cmp1")));
78 td.compoundPtrs.back()->retentionTimes.push_back(RetentionTime());
79 td.compoundPtrs.back()->retentionTimes.back().set(MS_peak_intensity, 123);
80
81 td.transitions.push_back(Transition());
82 Transition& transition = td.transitions.back();
83 transition.peptidePtr = PeptidePtr(new Peptide("pep1"));
84 transition.peptidePtr->proteinPtrs.push_back(ProteinPtr(new Protein("prot1")));
85 transition.compoundPtr = CompoundPtr(new Compound("cmp1"));
86
88
89 unit_assert(transition.peptidePtr->cvParam(MS_theoretical_mass).value == "123");
90 unit_assert(transition.peptidePtr->proteinPtrs.back().get());
91 unit_assert(transition.peptidePtr->proteinPtrs.back()->sequence == "ABCD");
92 unit_assert(!transition.compoundPtr->retentionTimes.empty());
93 unit_assert(transition.compoundPtr->retentionTimes.back().cvParam(MS_peak_intensity).value == "123");
94}
std::vector< ProteinPtr > proteinPtrs
List of proteins for which one or more transitions are intended to identify.
Definition TraData.hpp:372
std::vector< Transition > transitions
List of transitions.
Definition TraData.hpp:379

References pwiz::tradata::Transition::compoundPtr, pwiz::tradata::TraData::compoundPtrs, MS_peak_intensity, MS_theoretical_mass, pwiz::tradata::Transition::peptidePtr, pwiz::tradata::TraData::peptidePtrs, pwiz::tradata::TraData::proteinPtrs, pwiz::tradata::References::resolve(), pwiz::tradata::TraData::transitions, and unit_assert.

Referenced by test().

◆ test()

void test ( )

Definition at line 97 of file ReferencesTest.cpp.

98{
100 testTraData();
101}
void testTraData()
void testTransition()

References testTraData(), and testTransition().

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 104 of file ReferencesTest.cpp.

105{
106 TEST_PROLOG_EX(argc, argv, "_TraData")
107
108 try
109 {
110 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
111 test();
112 }
113 catch (exception& e)
114 {
115 TEST_FAILED(e.what())
116 }
117 catch (...)
118 {
119 TEST_FAILED("Caught unknown exception.")
120 }
121
123}
void test()
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition unit.hpp:157
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG_EX.

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 34 of file ReferencesTest.cpp.

Referenced by main(), and testTransition().