libpappsomspp
Library for mass spectrometry
pappso::WrapTandemInput Class Reference

#include <wraptandeminput.h>

Inheritance diagram for pappso::WrapTandemInput:
pappso::XmlStreamReaderInterface

Public Member Functions

 WrapTandemInput (const QString &destinationMzXmlFile, const QString &destinationTandemInputFile, const QString &destinationTandemOutputFile)
 
virtual ~WrapTandemInput ()
 
const QString & getOriginalMsDataFileName () const
 
const QString & getOriginalTandemOutputFileName () const
 
const QString & getOriginalTandemPresetFileName () const
 
- Public Member Functions inherited from pappso::XmlStreamReaderInterface
 XmlStreamReaderInterface ()
 
virtual ~XmlStreamReaderInterface ()
 
virtual bool readFile (const QString &fileName)
 
bool read (QIODevice *device)
 
bool read (const QString &xml_content)
 
QString errorString () const
 

Protected Member Functions

virtual void readStream () override
 
- Protected Member Functions inherited from pappso::XmlStreamReaderInterface
void cloneStartElement (QXmlStreamWriter &output) const
 
void cloneElement (QXmlStreamWriter &output)
 
void cloneNode (QXmlStreamWriter &output)
 

Private Attributes

QString m_destinationMzXmlFileName
 
QString m_originMzDataFileName
 
QString m_destinationTandemInputFileName
 
QString m_originTandemPresetFileName
 
QString m_originTandemOutpuFileName
 
QString m_destinationTandemOutputFileName
 
QFile m_destinationTandemInputFile
 
QXmlStreamWriter m_writerXmlTandemInput
 

Additional Inherited Members

- Protected Attributes inherited from pappso::XmlStreamReaderInterface
QXmlStreamReader m_qxmlStreamReader
 

Detailed Description

Todo:
write docs

Definition at line 42 of file wraptandeminput.h.

Constructor & Destructor Documentation

◆ WrapTandemInput()

pappso::WrapTandemInput::WrapTandemInput ( const QString &  destinationMzXmlFile,
const QString &  destinationTandemInputFile,
const QString &  destinationTandemOutputFile 
)

Default constructor

Definition at line 36 of file wraptandeminput.cpp.

39  : m_destinationTandemInputFile(destinationTandemInputFile)
40 {
41  m_destinationMzXmlFileName = destinationMzXmlFile;
42  m_destinationTandemOutputFileName = destinationTandemOutputFile;
44  QFileInfo(destinationTandemInputFile).absoluteFilePath();
45 
46  if(destinationTandemInputFile.isEmpty())
47  {
49  QObject::tr("ERROR: X!Tandem input file path is empty"));
50  }
51 
52  if(!m_destinationTandemInputFile.open(QIODevice::WriteOnly))
53  {
55  QObject::tr("ERROR: unable to open %1 tandem output file for write")
56  .arg(destinationTandemInputFile));
57  }
58 
60  m_writerXmlTandemInput.setAutoFormatting(true);
61  m_writerXmlTandemInput.writeStartDocument("1.0");
62 }
QXmlStreamWriter m_writerXmlTandemInput
QString m_destinationTandemInputFileName
QString m_destinationTandemOutputFileName

References m_destinationMzXmlFileName, m_destinationTandemInputFile, m_destinationTandemInputFileName, m_destinationTandemOutputFileName, and m_writerXmlTandemInput.

◆ ~WrapTandemInput()

pappso::WrapTandemInput::~WrapTandemInput ( )
virtual

Destructor

Definition at line 64 of file wraptandeminput.cpp.

65 {
67 }

References m_destinationTandemInputFile.

Member Function Documentation

◆ getOriginalMsDataFileName()

const QString & pappso::WrapTandemInput::getOriginalMsDataFileName ( ) const

Definition at line 143 of file wraptandeminput.cpp.

144 {
145  return m_originMzDataFileName;
146 }

References m_originMzDataFileName.

Referenced by pappso::TandemWrapperRun::wrapTandemInputFile().

◆ getOriginalTandemOutputFileName()

const QString & pappso::WrapTandemInput::getOriginalTandemOutputFileName ( ) const

Definition at line 149 of file wraptandeminput.cpp.

150 {
152 }

References m_originTandemOutpuFileName.

Referenced by pappso::TandemWrapperRun::wrapTandemInputFile().

◆ getOriginalTandemPresetFileName()

const QString & pappso::WrapTandemInput::getOriginalTandemPresetFileName ( ) const

Definition at line 155 of file wraptandeminput.cpp.

156 {
158 }

References m_originTandemPresetFileName.

Referenced by pappso::TandemWrapperRun::wrapTandemInputFile().

◆ readStream()

void pappso::WrapTandemInput::readStream ( )
overrideprotectedvirtual

Implements pappso::XmlStreamReaderInterface.

Definition at line 71 of file wraptandeminput.cpp.

72 {
73  qDebug();
74  if(m_qxmlStreamReader.readNextStartElement())
75  {
76  if(m_qxmlStreamReader.name().toString() == "bioml")
77  {
79  qDebug();
80  while(m_qxmlStreamReader.readNextStartElement())
81  {
82  // qDebug() << m_qxmlStreamReader.name();
83  // read_note();
85 
86  QString type =
87  m_qxmlStreamReader.attributes().value("type").toString();
88  QString label =
89  m_qxmlStreamReader.attributes().value("label").toString();
90 
91  if((type == "input") && (label == "spectrum, path"))
92  {
93  //<note type="input" label="spectrum, path">
94 
95  m_originMzDataFileName = m_qxmlStreamReader.readElementText();
96  m_writerXmlTandemInput.writeCharacters(
98  // m_qxmlStreamReader.skipCurrentElement();
99  }
100  else if((type == "input") && (label == "output, path"))
101  {
102  //<note type="input" label="output, path">
104  m_qxmlStreamReader.readElementText();
105  m_writerXmlTandemInput.writeCharacters(
107  // m_qxmlStreamReader.skipCurrentElement();
108  }
109  // list path, default parameters
110  else if((type == "input") &&
111  (label == "list path, default parameters"))
112  {
113  //<note type="input" label="list path, default
114  // parameters">/gorgone/pappso/tmp/xtpcpp.AjyZGg/Lumos_trypsin_rev_camC_oxM_10ppm_HCDOT_12102017CH.xml</note>
115 
117  m_qxmlStreamReader.readElementText();
118  m_writerXmlTandemInput.writeCharacters(
120  }
121  else
122  {
123  m_writerXmlTandemInput.writeCharacters(
124  m_qxmlStreamReader.readElementText());
125  }
126  m_writerXmlTandemInput.writeEndElement();
127  }
128  }
129  else
130  {
131  m_qxmlStreamReader.raiseError(
132  QObject::tr("Not an X!Tandem input file"));
133  m_qxmlStreamReader.skipCurrentElement();
134  }
135  }
136  m_writerXmlTandemInput.writeEndDocument();
138  qDebug();
139 }
void cloneStartElement(QXmlStreamWriter &output) const

References pappso::XmlStreamReaderInterface::cloneStartElement(), m_destinationMzXmlFileName, m_destinationTandemInputFile, m_destinationTandemOutputFileName, m_originMzDataFileName, m_originTandemOutpuFileName, m_originTandemPresetFileName, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, and m_writerXmlTandemInput.

Member Data Documentation

◆ m_destinationMzXmlFileName

QString pappso::WrapTandemInput::m_destinationMzXmlFileName
private

Definition at line 68 of file wraptandeminput.h.

Referenced by WrapTandemInput(), and readStream().

◆ m_destinationTandemInputFile

QFile pappso::WrapTandemInput::m_destinationTandemInputFile
private

Definition at line 74 of file wraptandeminput.h.

Referenced by WrapTandemInput(), ~WrapTandemInput(), and readStream().

◆ m_destinationTandemInputFileName

QString pappso::WrapTandemInput::m_destinationTandemInputFileName
private

Definition at line 70 of file wraptandeminput.h.

Referenced by WrapTandemInput().

◆ m_destinationTandemOutputFileName

QString pappso::WrapTandemInput::m_destinationTandemOutputFileName
private

Definition at line 73 of file wraptandeminput.h.

Referenced by WrapTandemInput(), and readStream().

◆ m_originMzDataFileName

QString pappso::WrapTandemInput::m_originMzDataFileName
private

Definition at line 69 of file wraptandeminput.h.

Referenced by getOriginalMsDataFileName(), and readStream().

◆ m_originTandemOutpuFileName

QString pappso::WrapTandemInput::m_originTandemOutpuFileName
private

Definition at line 72 of file wraptandeminput.h.

Referenced by getOriginalTandemOutputFileName(), and readStream().

◆ m_originTandemPresetFileName

QString pappso::WrapTandemInput::m_originTandemPresetFileName
private

Definition at line 71 of file wraptandeminput.h.

Referenced by getOriginalTandemPresetFileName(), and readStream().

◆ m_writerXmlTandemInput

QXmlStreamWriter pappso::WrapTandemInput::m_writerXmlTandemInput
private

Definition at line 75 of file wraptandeminput.h.

Referenced by WrapTandemInput(), and readStream().


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