Loading...
Searching...
No Matches
pappso::MzIdentMlWriter Class Reference

`#include <mzidentmlwriter.h>`

Inheritance diagram for pappso::MzIdentMlWriter:

## Public Member Functions

| MzIdentMlWriter ()
virtual | ~MzIdentMlWriter ()
void | writeDBSequence (const QString &id, const QString &db_ref_id, const pappso::Protein &protein, bool is_reverse)
void | writeDBSequence (const QString &id, const QString &db_ref_id, const QString &accession, const QString &description, const QString &sequence, bool is_reverse)
void | writeStartMzIdentMlDocument (const QString &id, const QString &version)
void | writeCvList ()
void | writeCvParam (pappso::AaModificationP modification)
void | writeCvParam (const pappso::OboPsiModTerm &term, const QString &value)
void | writeCvParam (const QString &cv_ref, const QString &accession, const QString &name, const QString &value)
void | writeCvParamUo (const QString &cv_ref, const QString &accession, const QString &name, const QString &value, const QString &unit_cv_ref, const QString &unit_accession, const QString &unit_name)
void | writeCvParamUo (const QString &cv_ref, const QString &accession, const QString &name, const QString &value, Enums::PrecisionUnit precision_unit)
void | writeUserParam (const QString &name, const QString &value)
void | writeUserParam (const QString &name, double value)
void | writeUserParam (pappso::DeepProtMatchType matchType)
void | writeUserParam (pappso::DeepProtPeptideCandidateStatus status)

## Static Public Member Functions

static const QString | toXmlMass (double mass)
static const QString | toXmlMassDelta (double mass)
static const QString | toXmlDouble (double value)

## Detailed Description

Todo
  write docs

Definition at line 46 of file mzidentmlwriter.h.

## Constructor & Destructor Documentation

## MzIdentMlWriter()

pappso::MzIdentMlWriter::MzIdentMlWriter | ( |  | ) |

Default constructor

Definition at line 33 of file mzidentmlwriter.cpp.

{
}

## ~MzIdentMlWriter()

pappso::MzIdentMlWriter::~MzIdentMlWriter | ( |  | ) |

virtual

Destructor

Definition at line 37 of file mzidentmlwriter.cpp.

{
}

## Member Function Documentation

## toXmlDouble()

const QString pappso::MzIdentMlWriter::toXmlDouble | ( | double | value | ) |

static

Definition at line 341 of file mzidentmlwriter.cpp.

{
return QString::number(value, 'g', 10);
}

## toXmlMass()

const QString pappso::MzIdentMlWriter::toXmlMass | ( | double | mass | ) |

static

Definition at line 323 of file mzidentmlwriter.cpp.

{
return QString::number(mass, 'f', 10);
}

## toXmlMassDelta()

const QString pappso::MzIdentMlWriter::toXmlMassDelta | ( | double | mass | ) |

static

Definition at line 329 of file mzidentmlwriter.cpp.

{
return QString::number(mass, 'g', 10);
}

## writeCvList()

void pappso::MzIdentMlWriter::writeCvList | ( |  | ) |

Definition at line 72 of file mzidentmlwriter.cpp.

{
writeStartElement("cvList");
// m_ofOut << "<cvList xmlns=\"http://psidev.info/psi/pi/mzIdentML/1.1\">\n";
writeStartElement("cv");
writeAttribute("id", "PSI-MS");
writeAttribute("uri",
"http://psidev.cvs.sourceforge.net/viewvc/*checkout*/psidev/psi/psi-ms/"
"mzML/controlledVocabulary/psi-ms.obo");
writeAttribute("version", "3.30.0");
writeAttribute("fullName", "PSI-MS");
writeEndElement();
// m_ofOut << " <cv id=\"PSI-MS\" "
// "uri=\"http://psidev.cvs.sourceforge.net/viewvc/*checkout*/psidev/"
// "psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo\" "
// "version=\"3.30.0\" fullName=\"PSI-MS\"/>\n";
writeStartElement("cv");
writeAttribute("id", "PSI-MOD");
writeAttribute("uri", "http://psidev.cvs.sourceforge.net/psidev/psi/mod/data/PSI-MOD.obo");
writeAttribute("fullName", "Proteomics Standards Initiative Protein Modifications Vocabularies");
writeAttribute("version", "1.2");
writeEndElement();
// m_ofOut
// << " <cv id=\"UNIMOD\" uri=\"http://www.unimod.org/obo/unimod.obo\" "
// "fullName=\"UNIMOD\"/>\n";
writeStartElement("cv");
writeAttribute("id", "UO");
writeAttribute("uri",
"http://obo.cvs.sourceforge.net/*checkout*/"
"obo/obo/ontology/phenotype/unit.obo");
writeAttribute("fullName", "UNIT-ONTOLOGY");
writeEndElement();
// m_ofOut << " <cv id=\"UO\" "
// "uri=\"http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/"
// "phenotype/unit.obo\" fullName=\"UNIT-ONTOLOGY\"/>\n";
writeEndElement();
// m_ofOut << "</cvList>\n";
}

## writeCvParam() [1/3]

void pappso::MzIdentMlWriter::writeCvParam | ( | const pappso::OboPsiModTerm & | term,
|  | const QString & | value )

Definition at line 194 of file mzidentmlwriter.cpp.

{
if(term.getAccession().startsWith("MOD:"))
{
writeCvParam("PSI-MOD", term.getAccession(), term.m_name, value);
}
else
{
if(term.getAccession().startsWith("MS:"))
{
writeCvParam("PSI-MS", term.getAccession(), term.m_name, value);
}
else
{
if(term.getAccession().startsWith("UNIMOD:"))
{
writeCvParam("UNIMOD", term.getAccession(), term.m_name, value);
}
else
{
throw pappso::PappsoException(
QObject::tr("The OBO term %1 %2 is not an OBO PSI-MOD or UNIMOD term in %3")
.arg(term.getAccession())
.arg(term.m_name)
.arg(__FUNCTION__));
}
}
}
}
pappso::MzIdentMlWriter::writeCvParam
void writeCvParam(pappso::AaModificationP modification)
Definition mzidentmlwriter.cpp:226
pappso::OboPsiModTerm::getAccession
const QString & getAccession() const
Definition obopsimodterm.cpp:261
pappso::OboPsiModTerm::m_name
QString m_name
Definition obopsimodterm.h:58

References pappso::OboPsiModTerm::getAccession(), pappso::OboPsiModTerm::m_name, and writeCvParam().

## writeCvParam() [2/3]

void pappso::MzIdentMlWriter::writeCvParam | ( | const QString & | cv_ref,
|  | const QString & | accession,
|  | const QString & | name,
|  | const QString & | value )

Definition at line 177 of file mzidentmlwriter.cpp.

{
//<cvParam accession="MS:1001083" cvRef="PSI-MS" name="ms-ms search"/>
writeStartElement("cvParam");
writeAttribute("accession", accession);
writeAttribute("cvRef", cv_ref);
writeAttribute("name", name);
if(!value.isEmpty())
writeAttribute("value", value);
writeEndElement();
}

## writeCvParam() [3/3]

void pappso::MzIdentMlWriter::writeCvParam | ( | pappso::AaModificationP | pmod | ) |

cvParam accession="MS:1000894" cvRef="PSI-MS" name="retention time" value="5468.0193" unitAccession="UO:0000010" unitName="second" unitCvRef="UO"/>

Definition at line 226 of file mzidentmlwriter.cpp.

References pappso::AaModification::getAccession(), pappso::AaModification::getName(), and writeCvParam().

Referenced by writeCvParam(), writeCvParam(), and writeDBSequence().

## writeCvParamUo() [1/2]

void pappso::MzIdentMlWriter::writeCvParamUo | ( | const QString & | cv_ref,
|  | const QString & | accession,
|  | const QString & | name,
|  | const QString & | value,
|  | const QString & | unit_cv_ref,
|  | const QString & | unit_accession,
|  | const QString & | unit_name )

Definition at line 255 of file mzidentmlwriter.cpp.

{
//<cvParam accession="MS:1001083" cvRef="PSI-MS" name="ms-ms search"/>
writeStartElement("cvParam");
writeAttribute("accession", accession);
writeAttribute("cvRef", cv_ref);
writeAttribute("name", name);
if(!value.isEmpty())
writeAttribute("value", value);
writeAttribute("unitAccession", unit_accession);
writeAttribute("unitName", unit_name);
writeAttribute("unitCvRef", unit_cv_ref);
writeEndElement();
}

Referenced by writeCvParamUo().

## writeCvParamUo() [2/2]

void pappso::MzIdentMlWriter::writeCvParamUo | ( | const QString & | cv_ref,
|  | const QString & | accession,
|  | const QString & | name,
|  | const QString & | value,
|  | Enums::PrecisionUnit | precision_unit )

Definition at line 277 of file mzidentmlwriter.cpp.

{
switch(precision_unit)
{
case Enums::PrecisionUnit::dalton:
writeCvParamUo(cv_ref, accession, name, value, "UO", "UO:0000221", "dalton");
break;
case Enums::PrecisionUnit::ppm:
writeCvParamUo(cv_ref, accession, name, value, "UO", "UO:0000169", "parts per million");
break;
default:
throw pappso::PappsoException(QObject::tr("precision unit %1 not implemented in %2")
.arg((int)precision_unit)
.arg(__FUNCTION__));
break;
}
}
pappso::MzIdentMlWriter::writeCvParamUo
void writeCvParamUo(const QString &cv_ref, const QString &accession, const QString &name, const QString &value, const QString &unit_cv_ref, const QString &unit_accession, const QString &unit_name)
Definition mzidentmlwriter.cpp:255
pappso::Enums::PrecisionUnit::ppm
@ ppm
Definition types.h:99
pappso::Enums::PrecisionUnit::dalton
@ dalton
Definition types.h:98

References pappso::Enums::dalton, pappso::Enums::ppm, and writeCvParamUo().

## writeDBSequence() [1/2]

void pappso::MzIdentMlWriter::writeDBSequence | ( | const QString & | id,
|  | const QString & | db_ref_id,
|  | const pappso::Protein & | protein,
|  | bool | is_reverse )

Definition at line 116 of file mzidentmlwriter.cpp.

{
writeDBSequence(id,
db_ref_id,
protein.getAccession(),
protein.getDescription(),
protein.getSequence(),
is_reverse);
}
pappso::MzIdentMlWriter::writeDBSequence
void writeDBSequence(const QString &id, const QString &db_ref_id, const pappso::Protein &protein, bool is_reverse)
Definition mzidentmlwriter.cpp:116
pappso::Protein::getAccession
const QString & getAccession() const
Definition protein.cpp:127
pappso::Protein::getDescription
const QString & getDescription() const
Definition protein.cpp:137
pappso::Protein::getSequence
const QString & getSequence() const
Definition protein.cpp:122

References pappso::Protein::getAccession(), pappso::Protein::getDescription(), pappso::Protein::getSequence(), and writeDBSequence().

Referenced by writeDBSequence().

## writeDBSequence() [2/2]

void pappso::MzIdentMlWriter::writeDBSequence | ( | const QString & | id,
|  | const QString & | db_ref_id,
|  | const QString & | accession,
|  | const QString & | description,
|  | const QString & | sequence,
|  | bool | is_reverse )

Definition at line 131 of file mzidentmlwriter.cpp.

{
writeStartElement("DBSequence");
writeAttribute("id", id);
writeAttribute("searchDatabase_ref", db_ref_id);
writeAttribute("accession", accession);
writeAttribute("length", QString::number(sequence.size()));
// m_ofOut << "<DBSequence accession=\"" << strLabel.c_str()
// << "\" searchDatabase_ref=\"SearchDB_"
// << _vs[a].m_vseqBest[b].m_siPath << "\" length=\""
// << (unsigned long)_vs[a].m_vseqBest[b].m_strSeq.size()
// << "\" id=\"DBSeq" << tUid << "\">\n";
writeStartElement("Seq");
writeCharacters(sequence);
writeEndElement();
if(!description.isEmpty())
{
writeCvParam("PSI-MS", "MS:1001088", "protein description", description);
}
// m_ofOut << "<cvParam accession=\"MS:1001088\" cvRef=\"PSI-MS\"
// "
// "value=\""
// << strDesc.c_str()
// << "\" name=\"protein description\"/>\n";
if(is_reverse)
{
// PSI-MS MS:1001195 decoy DB type reverse
writeCvParam("PSI-MS", "MS:1001195", "decoy DB type reverse", "");
}
writeEndElement();
// m_ofOut << "</DBSequence>\n";
}

References writeCvParam().

## writeStartMzIdentMlDocument()

void pappso::MzIdentMlWriter::writeStartMzIdentMlDocument | ( | const QString & | id,
|  | const QString & | version )

Definition at line 42 of file mzidentmlwriter.cpp.

{
setAutoFormatting(true);
writeStartDocument("1.0");
// <MzIdentML id="X! Tandem" version="1.1.0"
// xmlns="http://psidev.info/psi/pi/mzIdentML/1.1"
// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
// xsi:schemaLocation="http://psidev.info/psi/pi/mzIdentML/1.1
// http://www.psidev.info/files/mzIdentML1.1.0.xsd"
// creationDate="2016:10:06:09:43:19" >
writeDefaultNamespace("http://psidev.info/psi/pi/mzIdentML/1.2");
writeStartElement("MzIdentML");
writeAttribute("id", id);
writeAttribute("version", version);
writeAttribute("creationDate", QDateTime::currentDateTime().toString(Qt::ISODate));
writeNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
// mp_xmlWriter->writeNamespace("http://www.w3.org/2001/XMLSchema-instance","xsi");
// xsi:schemaLocation="http://psidev.info/psi/pi/mzIdentML/1.1
// http://www.psidev.info/files/mzIdentML1.1.0.xsd"
// xmlns:PSI-MS="http://psidev.info/psi/pi/mzIdentML/1.0"
writeAttribute("http://www.w3.org/2001/XMLSchema-instance",
"schemaLocation",
"http://psidev.info/psi/pi/mzIdentML/1.2 "
"https://raw.githubusercontent.com/HUPO-PSI/mzIdentML/master/schema/"
"mzIdentML1.2.0-candidate.xsd");
}

## writeUserParam() [1/4]

void pappso::MzIdentMlWriter::writeUserParam | ( | const QString & | name,
|  | const QString & | value )

Definition at line 301 of file mzidentmlwriter.cpp.

{
writeStartElement("userParam");
writeAttribute("name", name);
writeAttribute("value", value);
writeEndElement();
}

Referenced by writeUserParam(), writeUserParam(), and writeUserParam().

## writeUserParam() [2/4]

void pappso::MzIdentMlWriter::writeUserParam | ( | const QString & | name,
|  | double | value )

Definition at line 335 of file mzidentmlwriter.cpp.

{
writeUserParam(name, QString::number(value, 'g', 10));
}
pappso::MzIdentMlWriter::writeUserParam
void writeUserParam(const QString &name, const QString &value)
Definition mzidentmlwriter.cpp:301

References writeUserParam().

## writeUserParam() [3/4]

void pappso::MzIdentMlWriter::writeUserParam | ( | pappso::DeepProtMatchType | matchType | ) |

Definition at line 311 of file mzidentmlwriter.cpp.

{
writeUserParam("DeepProt:match_type", pappso::DeepProtEnumStr::toString(matchType));
}
pappso::DeepProtEnumStr::toString
static const QString toString(DeepProtMatchType match_type)
Definition deepprotenum.cpp:112

References pappso::DeepProtEnumStr::toString(), and writeUserParam().

## writeUserParam() [4/4]

void pappso::MzIdentMlWriter::writeUserParam | ( | pappso::DeepProtPeptideCandidateStatus | status | ) |

Definition at line 317 of file mzidentmlwriter.cpp.

{
writeUserParam("DeepProt:status", pappso::DeepProtEnumStr::toString(status));
}

References pappso::DeepProtEnumStr::toString(), and writeUserParam().

The documentation for this class was generated from the following files:

- pappsomspp/core/processing/xml/mzidentmlwriter.h
- pappsomspp/core/processing/xml/mzidentmlwriter.cpp