32 #include "boost/range/adaptor/transformed.hpp"
33 #include "boost/range/algorithm/max_element.hpp"
34 #include "boost/range/algorithm/min_element.hpp"
38 using namespace pwiz::identdata;
39 using namespace pwiz::identdata::examples;
40 using namespace pwiz::util;
41 namespace proteome = pwiz::proteome;
48 int operator()(
const EnzymePtr&
x)
const {
return x->terminalSpecificity;}
54 int operator()(
const EnzymePtr&
x)
const {
return x->missedCleavages;}
68 as->customizations.clear();
69 as->contactRolePtr.reset();
79 ez->terminalSpecificity = (proteome::Digestion::Specificity) minSpecificity;
80 ez->missedCleavages = maxMissedCleavages;
97 location =
BFS_STRING(bfs::path(location).replace_extension(
"").filename());
101 location2 =
BFS_STRING(bfs::path(location2).replace_extension(
"").filename());
106 dbSequence->seq.clear();
107 dbSequence->length = 0;
108 dbSequence->id =
"DBSeq_" + dbSequence->accession;
113 BOOST_FOREACH(ModificationPtr& mod, peptide->modification)
114 mod->monoisotopicMassDelta = mod->avgMassDelta = max(mod->monoisotopicMassDelta, mod->avgMassDelta);
120 BOOST_FOREACH(SpectrumIdentificationItemPtr& sii, sir->spectrumIdentificationItem)
123 sii->fragmentation.clear();
124 sii->massTablePtr.reset();
126 for (
size_t i=0; i < sii->peptideEvidencePtr.size(); ++i)
147 unit_assert(bal::contains(str,
"search_engine=\"Mascot\""));
150 unit_assert(bal::contains(str,
"name=\"ionscore\""));
151 unit_assert(bal::contains(str,
"name=\"homologyscore\""));
152 unit_assert(bal::contains(str,
"name=\"identityscore\""));
153 unit_assert(bal::contains(str,
"name=\"expect\""));
154 unit_assert(bal::contains(str,
"name=\"an extra score\""));
157 unit_assert(bal::contains(str,
"spectrumNativeID=\"controllerType=0 controllerNumber=1 scan=420\""));
162 if (
os_) *
os_ <<
"begin testSerialize" << endl;
166 serializer.
write(oss, mzid,
"tiny.pepXML");
168 if (
os_) *
os_ <<
"oss:\n" << oss.str() << endl;
172 shared_ptr<istringstream> iss(
new istringstream(oss.str()));
174 serializer.
read(iss, mzid2);
179 if (
os_ && diff) *
os_ << diff << endl;
193 EnzymePtr noEnzyme(
new Enzyme);
194 noEnzyme->id =
"ENZ_1";
195 noEnzyme->cTermGain =
"OH";
196 noEnzyme->nTermGain =
"H";
197 noEnzyme->missedCleavages = 2;
198 noEnzyme->minDistance = 1;
200 noEnzyme->siteRegexp =
"(?<=[KR])";
208 EnzymePtr aspN(
new Enzyme);
210 aspN->cTermGain =
"OH";
211 aspN->nTermGain =
"H";
212 aspN->missedCleavages = 2;
213 aspN->minDistance = 1;
214 aspN->terminalSpecificity = proteome::Digestion::FullySpecific;
215 aspN->siteRegexp =
"(?=[BD])";
220 aspN->missedCleavages = 4;
221 aspN->minDistance = 2;
223 aspN->siteRegexp =
"(?=[BND])";
224 aspN->enzymeName.clear();
225 aspN->enzymeName.userParams.push_back(
UserParam(
"custom"));
271 ez.
name =
"trypsin/p";
305 bool allCleavageAgentsHandled =
true;
316 cerr << e.what() << endl;
317 allCleavageAgentsHandled =
false;
374 int main(
int argc,
char** argv)
380 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
AnalysisProtocolCollection analysisProtocolCollection
int operator()(const EnzymePtr &x) const
void testStripChargeFromConventionalSpectrumId()
std::vector< PeptideEvidencePtr > peptideEvidence
Implementation of PeptideEvidenceType from the mzIdentML schema.
AnalysisCollection analysisCollection
void stripUnmappedMetadata(IdentData &mzid)
Implementation of EnzymeType from the mzIdentML schema.
PWIZ_API_DECL proteome::Peptide peptide(const Peptide &peptide)
creates a proteome::Peptide from an identdata::Peptide
void read(boost::shared_ptr< std::istream > is, IdentData &mzid, const pwiz::util::IterationListenerRegistry *=0) const
read in MZIDData object from a pepXML istream
Calculate diffs of objects in a ProteoWizard data model hierarchy.
std::vector< SpectrumIdentificationListPtr > spectrumIdentificationList
void testPepXMLSpecificity()
std::vector< SpectrumIdentificationProtocolPtr > spectrumIdentificationProtocol
PWIZ_API_DECL void initializeBasicSpectrumIdentification(IdentData &mzid)
PWIZ_API_DECL PepXMLSpecificity pepXMLSpecificity(const Enzyme &ez)
converts an identdata::Enzyme into a pepXML cut/no_cut/sense tuple
void write(std::ostream &os, const IdentData &mzid, const std::string &filepath, const pwiz::util::IterationListenerRegistry *=0) const
write MZIDData object to ostream as pepXML
MZIDData <-> pepXML stream serialization.
void clear()
clears the collections
DataCollection dataCollection
std::vector< EnzymePtr > enzymes
void diff(const string &filename1, const string &filename2)
Serializer_pepXML configuration.
Implementation of ProviderType from the mzIdentML schema.
std::vector< PeptidePtr > peptides
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
void testSerializeReally(IdentData &mzid, const Serializer_pepXML::Config &config)
void testTranslation(const string &str)
SemiSpecific
neither termini must match digestion motif(s)
std::vector< MassTablePtr > massTable
std::vector< UserParam > userParams
a collection of uncontrolled user terms
#define unit_assert_operator_equal(expected, actual)
ProteinDetection proteinDetection
AnalysisSampleCollection analysisSampleCollection
Implementation of the MzIdentMLType from the mzIdentML schema.
boost::shared_ptr< Peptide > PeptidePtr
ParamContainer enzymeName
std::vector< SamplePtr > samples
static const std::set< CVID > & getCleavageAgents()
returns the set of predefined cleavage agents defined in the PSI-MS CV
int operator()(const EnzymePtr &x) const
std::vector< SpectrumIdentificationPtr > spectrumIdentification
PWIZ_API_DECL void resolve(ContactRole &cr, IdentData &mzid)
std::vector< FilterPtr > databaseFilters
std::vector< BibliographicReferencePtr > bibliographicReference
Implementation of SpectrumIdentificationProtocolType from the mzIdentML schema.
std::vector< ContactPtr > auditCollection
std::vector< DBSequencePtr > dbSequences
SequenceCollection sequenceCollection
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
#define TEST_PROLOG(argc, argv)
PWIZ_API_DECL CVID cleavageAgent(const Enzyme &ez)
returns a cleavage agent CVID for an identdata::Enzyme
KernelTraitsBase< Kernel >::space_type::abscissa_type x
std::vector< AnalysisSoftwarePtr > analysisSoftwareList
DatabaseTranslationPtr databaseTranslation
ProteinDetectionListPtr proteinDetectionListPtr
static const std::string & getCleavageAgentRegex(CVID agentCvid)
returns the official PSI Perl regular expression defining the places in a polypeptide or protein that...
AnalysisData analysisData
PWIZ_API_DECL std::string stripChargeFromConventionalSpectrumId(const std::string &id)
strips charge state from known conventions of the pepXML spectrum attribute; used to find a unique id...
represents a tag-value pair, where the tag comes from the controlled vocabulary
int main(int argc, char **argv)
Implementation of ProteinDetectionType from the mzIdentML schema.