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

`#include <tandemwrapperrun.h>`

Inheritance diagram for pappso::TandemWrapperRun:

## Signals

void | tandemProgressMessage (QString message)

## Public Member Functions

| TandemWrapperRun (const QString &tandem_binary, const QString &tmp_dir)
| prepare a tandem run
void | run (UiMonitorInterface &monitor, const QString &tandem_input_file)
| run a tandem job
void | readTandemPresetFile (const QString &tandem_preset_file)
QString | getMs2FilterSuiteString () const
| gets the list of filters used on MS2 spectrum
| ~TandemWrapperRun ()

## Private Slots

void | readyReadStandardOutput ()
void | readyReadStandardError ()

## Private Member Functions

void | setTandemBinaryPath (const QString &tandem_binary_path)
const QString | checkXtandemVersion (const QString &tandem_bin_path)
void | wrapTandemInputFile (const QString &tandem_input_file)
bool | convertOrginalMsData2mzXmlData (const QString &origin, const QString &target)
void | runTandem (const QString &tandem_input_file)
| run a tandem job
void | writeFinalTandemOutput (const QString &tmp_tandem_output, const QString &final_tandem_output, const QString &original_msdata_file_name)
| tandem output modification tandem output is modified to contain the Bruker's file as input and centroidization parameters

## Private Attributes

UiMonitorInterface * | mp_monitor
QString | m_tandemBinary
QString | m_tandemVersion
QString | m_tmpDir
int | m_maxTandemRunTimeMs
QProcess * | m_xtProcess = nullptr
std::shared_ptr< FilterSuiteString > | msp_ms2FilterSuiteString = nullptr
QTemporaryDir * | mpa_temporaryDirectory = nullptr
bool | m_convertMzDataUsingSpectrumIndex = false
pappso::MsDataFormat | m_mzFormat = pappso::MsDataFormat::unknown
qint64 | m_conversionTime = 0

## Detailed Description

Definition at line 61 of file tandemwrapperrun.h.

## Constructor & Destructor Documentation

## TandemWrapperRun()

pappso::TandemWrapperRun::TandemWrapperRun | ( | const QString & | tandem_binary,
|  | const QString & | tmp_dir
| ) |  |

prepare a tandem run

Parameters

  tandem_binary | file path to tandem.exe if not set, a default value is given in QSettings
  tmp_dir | temporary directory, where to write mzXML file conversion if not set, a default value is given in QSettings

Definition at line 49 of file tandemwrapperrun.cpp.

{
setTandemBinaryPath(tandem_binary);
if(!tmp_dir.isEmpty())
{
mpa_temporaryDirectory = new QTemporaryDir(tmp_dir + "/xtpwrp");
}
else
{
mpa_temporaryDirectory = new QTemporaryDir(QDir::tempPath() + "/xtpwrp");
}
mpa_temporaryDirectory->setAutoRemove(true);
if(!mpa_temporaryDirectory->isValid())
{
throw pappso::PappsoException(
QObject::tr("ERROR: unable to create temporary directory %1\n Please "
"check file system permissions")
.arg(mpa_temporaryDirectory->path()));
}
}
pappso::PappsoException
Definition pappsoexception.h:42
pappso::TandemWrapperRun::mpa_temporaryDirectory
QTemporaryDir * mpa_temporaryDirectory
Definition tandemwrapperrun.h:144
pappso::TandemWrapperRun::setTandemBinaryPath
void setTandemBinaryPath(const QString &tandem_binary_path)
Definition tandemwrapperrun.cpp:87

References mpa_temporaryDirectory, and setTandemBinaryPath().

## ~TandemWrapperRun()

pappso::TandemWrapperRun::~TandemWrapperRun | ( |  | ) |

Destructor

Definition at line 73 of file tandemwrapperrun.cpp.

{
if(mpa_temporaryDirectory != nullptr)
{
delete mpa_temporaryDirectory;
}
if(m_xtProcess != nullptr)
{
m_xtProcess->deleteLater();
}
}
pappso::TandemWrapperRun::m_xtProcess
QProcess * m_xtProcess
Definition tandemwrapperrun.h:140

References m_xtProcess, and mpa_temporaryDirectory.

## Member Function Documentation

## checkXtandemVersion()

const QString pappso::TandemWrapperRun::checkXtandemVersion | ( | const QString & | tandem_bin_path | ) |

private

Definition at line 107 of file tandemwrapperrun.cpp.

{
qDebug();
// check tandem path
QFileInfo tandem_exe(tandem_bin_path);
if(!tandem_exe.exists())
{
// dir.path() returns the unique directory path
throw pappso::PappsoException(
QObject::tr(
"X!Tandem software not found at %1.\nPlease check the X!Tandem "
"installation on your computer and set tandem.exe path.")
.arg(tandem_exe.absoluteFilePath()));
}
if(!tandem_exe.isReadable())
{
// dir.path() returns the unique directory path
throw pappso::PappsoException(
QObject::tr("Please check permissions on X!Tandem software found at %1 "
"(file not readable).")
.arg(tandem_exe.absoluteFilePath()));
}
if(!tandem_exe.isExecutable())
{
// dir.path() returns the unique directory path
throw pappso::PappsoException(
QObject::tr("Please check permissions on X!Tandem software found at %1 "
"(file not executable).")
.arg(tandem_exe.absoluteFilePath()));
}
QString version_return;
QStringList arguments;
arguments << "-v";
QProcess *xt_process = new QProcess();
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
xt_process->start(tandem_bin_path, arguments);
if(!xt_process->waitForStarted())
{
throw pappso::PappsoException(
QObject::tr("X!Tandem %1 process failed to start")
.arg(m_tandemVersion));
}
while(xt_process->waitForReadyRead(1000))
{
}
/*
if (!xt_process->waitForFinished(_max_xt_time_ms)) {
throw pappso::PappsoException(QObject::tr("can't wait for X!Tandem process
to finish : timeout at %1").arg(_max_xt_time_ms));
}
*/
QByteArray result = xt_process->readAll();
qDebug() << result.constData();
// X! TANDEM Jackhammer TPP (2013.06.15.1 - LabKey, Insilicos, ISB)
QRegularExpression parse_version(
"(.*) TANDEM ([A-Z,a-z, ]+) \\(([^ ,^\\)]*)(.*)");
qDebug() << parse_version;
// Pattern patt = Pattern.compile("X! TANDEM [A-Z]+ \\‍((.*)\\‍)",
// Pattern.CASE_INSENSITIVE);
QRegularExpressionMatch match_parse_version =
parse_version.match(result.constData());
if(match_parse_version.hasMatch())
{
version_return = QString("X!Tandem %1 %2")
.arg(match_parse_version.captured(2))
.arg(match_parse_version.captured(3)); //.join(" ");
}
else
{
throw pappso::PappsoException(
QObject::tr("This executable %1 may not be a valid X!Tandem software. "
"Please check your X!Tandem installation.")
.arg(tandem_bin_path));
}
QProcess::ExitStatus Status = xt_process->exitStatus();
delete xt_process;
if(Status != 0)
{
// != QProcess::NormalExit
throw pappso::PappsoException(
QObject::tr("error executing X!Tandem Status != 0 : %1 %2\n%3")
.arg(tandem_bin_path)
.arg(arguments.join(" ").arg(result.data())));
}
qDebug();
return version_return;
}
pappso::TandemWrapperRun::m_tandemVersion
QString m_tandemVersion
Definition tandemwrapperrun.h:136

References m_tandemVersion.

Referenced by setTandemBinaryPath().

## convertOrginalMsData2mzXmlData()

bool pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData | ( | const QString & | origin,
|  | const QString & | target
| ) |  |

private

Definition at line 439 of file tandemwrapperrun.cpp.

{
qDebug();
pappso::MsFileAccessor origin_access(origin, "runa1");
origin_access.setPreferredFileReaderType(pappso::MsDataFormat::brukerTims,
pappso::FileReaderType::tims_ms2);
origin_access.getMsRunIds();
m_mzFormat = origin_access.getFileFormat();
if(m_mzFormat == pappso::MsDataFormat::unknown)
{
throw pappso::PappsoException(
QObject::tr("%1 file format not known").arg(origin));
}
if(origin_access.getFileFormat() == pappso::MsDataFormat::brukerTims)
{
m_convertMzDataUsingSpectrumIndex = true;
}
if((origin_access.getFileFormat() == pappso::MsDataFormat::mzML) ||
(origin_access.getFileFormat() == pappso::MsDataFormat::brukerTims))
{
mp_monitor->setStatus(
QObject::tr("Converting %1 to mzXML %2").arg(origin).arg(target));
pappso::MsRunReaderSPtr p_reader;
p_reader =
origin_access.msRunReaderSPtr(origin_access.getMsRunIds().front());
pappso::TimsMsRunReaderMs2 *tims2_reader =
dynamic_cast<pappso::TimsMsRunReaderMs2 *>(p_reader.get());
if(tims2_reader != nullptr)
{
qDebug();
tims2_reader->setMs2BuiltinCentroid(true);
if(msp_ms2FilterSuiteString != nullptr)
{
tims2_reader->setMs2FilterCstSPtr(msp_ms2FilterSuiteString);
}
qDebug();
}
pappso::MzxmlOutput *p_mzxml_output;
QFile output_file(target);
// qDebug() << " TsvDirectoryWriter::writeSheet " <<
// QFileInfo(*_p_ofile).absoluteFilePath();
if(output_file.open(QIODevice::WriteOnly))
{
QElapsedTimer timer;
m_conversionTime = 0;
timer.start();
p_mzxml_output = new pappso::MzxmlOutput(
*mp_monitor, QTextStream(&output_file).device());
p_mzxml_output->maskMs1(true);
p_mzxml_output->setReadAhead(true);
p_mzxml_output->write(p_reader.get());
p_mzxml_output->close();
delete p_mzxml_output;
m_conversionTime = timer.elapsed();
mp_monitor->setStatus(QObject::tr("Conversion finished in %1 seconds")
.arg(m_conversionTime / 1000));
}
else
{
throw pappso::PappsoException(
QObject::tr("unable to write into %1 mzXML output file")
.arg(target));
}
qDebug();
return true;
}
else
{ // other mz data formats
return false;
}
return true;
}
pappso::MsFileAccessor
Definition msfileaccessor.h:28
pappso::MzxmlOutput
Definition mzxmloutput.h:44
pappso::MzxmlOutput::setReadAhead
void setReadAhead(bool read_ahead)
Definition mzxmloutput.cpp:93
pappso::MzxmlOutput::write
void write(MsRunReader *p_msrunreader)
Definition mzxmloutput.cpp:98
pappso::MzxmlOutput::close
void close()
Definition mzxmloutput.cpp:241
pappso::MzxmlOutput::maskMs1
void maskMs1(bool mask_ms1)
Definition mzxmloutput.cpp:421
pappso::TandemWrapperRun::m_conversionTime
qint64 m_conversionTime
Definition tandemwrapperrun.h:150
pappso::TandemWrapperRun::m_convertMzDataUsingSpectrumIndex
bool m_convertMzDataUsingSpectrumIndex
Definition tandemwrapperrun.h:146
pappso::TandemWrapperRun::mp_monitor
UiMonitorInterface * mp_monitor
Definition tandemwrapperrun.h:134
pappso::TandemWrapperRun::m_mzFormat
pappso::MsDataFormat m_mzFormat
Definition tandemwrapperrun.h:148
pappso::TandemWrapperRun::msp_ms2FilterSuiteString
std::shared_ptr< FilterSuiteString > msp_ms2FilterSuiteString
Definition tandemwrapperrun.h:142
pappso::TimsMsRunReaderMs2
Definition timsmsrunreaderms2.h:39
pappso::TimsMsRunReaderMs2::setMs2FilterCstSPtr
void setMs2FilterCstSPtr(pappso::FilterInterfaceCstSPtr filter)
Definition timsmsrunreaderms2.cpp:93
pappso::TimsMsRunReaderMs2::setMs2BuiltinCentroid
void setMs2BuiltinCentroid(bool centroid)
enable or disable simple centroid filter on raw tims data for MS2
Definition timsmsrunreaderms2.cpp:77
pappso::UiMonitorInterface::setStatus
virtual void setStatus(const QString &status)=0
current status of the process
pappso::MsRunReaderSPtr
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition msrunreader.h:56
pappso::MsDataFormat::brukerTims
@ brukerTims
pappso::MsDataFormat::mzML
@ mzML
mzML
pappso::MsDataFormat::unknown
@ unknown
unknown format
pappso::FileReaderType::tims_ms2
@ tims_ms2

References pappso::brukerTims, pappso::MzxmlOutput::close(), pappso::MsFileAccessor::getFileFormat(), pappso::MsFileAccessor::getMsRunIds(), m_conversionTime, m_convertMzDataUsingSpectrumIndex, m_mzFormat, pappso::MzxmlOutput::maskMs1(), mp_monitor, msp_ms2FilterSuiteString, pappso::MsFileAccessor::msRunReaderSPtr(), pappso::mzML, pappso::TimsMsRunReaderMs2::setMs2BuiltinCentroid(), pappso::TimsMsRunReaderMs2::setMs2FilterCstSPtr(), pappso::MsFileAccessor::setPreferredFileReaderType(), pappso::MzxmlOutput::setReadAhead(), pappso::UiMonitorInterface::setStatus(), pappso::tims_ms2, pappso::unknown, and pappso::MzxmlOutput::write().

Referenced by wrapTandemInputFile().

## getMs2FilterSuiteString()

QString pappso::TandemWrapperRun::getMs2FilterSuiteString | ( |  | ) | const

gets the list of filters used on MS2 spectrum

Returns
  string describing filters and associated parameters

Definition at line 605 of file tandemwrapperrun.cpp.

{
if(msp_ms2FilterSuiteString == nullptr)
return "";
return msp_ms2FilterSuiteString.get()->toString();
}

References msp_ms2FilterSuiteString.

Referenced by writeFinalTandemOutput().

## readTandemPresetFile()

void pappso::TandemWrapperRun::readTandemPresetFile | ( | const QString & | tandem_preset_file | ) |

Definition at line 285 of file tandemwrapperrun.cpp.

{
// get number of threads and centroid parameters from tandem preset
XtandemPresetReader preset_handler;
if(preset_handler.readFile(tandem_preset_file))
{
int ideal_number_of_thread = QThread::idealThreadCount();
int cpu_number = preset_handler.getNumberOfThreads();
qDebug() << " cpu_number=" << cpu_number;
// QThreadPool::globalInstance()->setMaxThreadCount(1);
if(cpu_number > ideal_number_of_thread)
{
cpu_number = ideal_number_of_thread;
}
else
{
if(cpu_number > 0)
{
QThreadPool::globalInstance()->setMaxThreadCount(cpu_number);
qDebug() << " maxThreadCount="
<< QThreadPool::globalInstance()->maxThreadCount();
}
}
QString ms2_filters_str = preset_handler.getMs2FiltersOptions();
if(!ms2_filters_str.isEmpty())
{
msp_ms2FilterSuiteString =
std::make_shared<pappso::FilterSuiteString>(ms2_filters_str);
}
else
{
msp_ms2FilterSuiteString =
std::make_shared<pappso::FilterSuiteString>(
"chargeDeconvolution|0.02dalton mzExclusion|0.01dalton");
}
}
else
{
throw pappso::PappsoException(
QObject::tr("Error reading %1 X!Tandem preset file :\n %2")
.arg(tandem_preset_file)
.arg(preset_handler.errorString()));
}
}

References pappso::XmlStreamReaderInterface::errorString(), pappso::XtandemPresetReader::getMs2FiltersOptions(), pappso::XtandemPresetReader::getNumberOfThreads(), msp_ms2FilterSuiteString, and pappso::XmlStreamReaderInterface::readFile().

Referenced by wrapTandemInputFile().

## readyReadStandardError

void pappso::TandemWrapperRun::readyReadStandardError | ( |  | ) |

private slot

Definition at line 229 of file tandemwrapperrun.cpp.

{
mp_monitor->appendText(m_xtProcess->readAllStandardError());
if(mp_monitor->shouldIstop())
{
m_xtProcess->kill();
delete m_xtProcess;
m_xtProcess = nullptr;
throw pappso::ExceptionInterrupted(
QObject::tr("X!Tandem stopped by the user"));
}
}
pappso::ExceptionInterrupted
Definition exceptioninterrupted.h:36
pappso::UiMonitorInterface::appendText
virtual void appendText(const QString &text)=0
append a text to a long report
pappso::UiMonitorInterface::shouldIstop
virtual bool shouldIstop()=0
should the procces be stopped ? If true, then cancel process Use this function at strategic point of ...

References pappso::UiMonitorInterface::appendText(), m_xtProcess, mp_monitor, and pappso::UiMonitorInterface::shouldIstop().

Referenced by runTandem().

## readyReadStandardOutput

void pappso::TandemWrapperRun::readyReadStandardOutput | ( |  | ) |

private slot

Definition at line 208 of file tandemwrapperrun.cpp.

{
QString message(m_xtProcess->readAllStandardOutput());
mp_monitor->appendText(message);
if(message.toLower().contains("error"))
{
throw pappso::XtandemError(message);
}
if(mp_monitor->shouldIstop())
{
m_xtProcess->kill();
delete m_xtProcess;
m_xtProcess = nullptr;
throw pappso::ExceptionInterrupted(
QObject::tr("X!Tandem stopped by the user"));
}
}
pappso::XtandemError
Definition tandemwrapperrun.h:48

References pappso::UiMonitorInterface::appendText(), m_xtProcess, mp_monitor, and pappso::UiMonitorInterface::shouldIstop().

Referenced by runTandem().

## run()

void pappso::TandemWrapperRun::run | ( | UiMonitorInterface & | monitor,
|  | const QString & | tandem_input_file
| ) |  |

run a tandem job

The tandem input file should contain an additional input parameter called "spectrum, timstof MS2 filters". The value of this parameters must contain a string describing the FilterSuiteString to apply on TimsTOF MS2. A default value of "chargeDeconvolution|0.02dalton" is recommended for this additional tandem input parameter

Parameters

  monitor | user interface monitor
  tandem_input_file | tandem xml input file

Definition at line 527 of file tandemwrapperrun.cpp.

{
mp_monitor = &monitor;
wrapTandemInputFile(tandem_input_file);
mp_monitor = nullptr;
}
pappso::TandemWrapperRun::wrapTandemInputFile
void wrapTandemInputFile(const QString &tandem_input_file)
Definition tandemwrapperrun.cpp:338

References mp_monitor, and wrapTandemInputFile().

## runTandem()

void pappso::TandemWrapperRun::runTandem | ( | const QString & | tandem_input_file | ) |

private

run a tandem job

Parameters

  tandem_input_file | tandem xml input file

Definition at line 536 of file tandemwrapperrun.cpp.

{
if(mp_monitor->shouldIstop())
{
throw pappso::ExceptionInterrupted(
QObject::tr("X!Tandem stopped by the user processing on file %1")
.arg(tandem_input_file));
}
m_xtProcess = new QProcess();
QStringList arguments;
qDebug() << m_tandemBinary << " " << m_xtProcess->arguments();
arguments << tandem_input_file;
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
m_xtProcess->start(m_tandemBinary, arguments);
qDebug() << m_tandemBinary << " " << m_xtProcess->arguments();
connect(m_xtProcess,
&QProcess::readyReadStandardOutput,
this,
&TandemWrapperRun::readyReadStandardOutput);
connect(m_xtProcess,
&QProcess::readyReadStandardError,
this,
&TandemWrapperRun::readyReadStandardError);
qDebug() << m_tandemBinary << " " << m_xtProcess->arguments();
mp_monitor->setStatus(QObject::tr("Running X!Tandem"));
if(!m_xtProcess->waitForStarted())
{
throw pappso::PappsoException(
QObject::tr("X!Tandem process failed to start"));
}
qDebug() << m_tandemBinary << " " << m_xtProcess->arguments();
while(m_xtProcess->waitForFinished(m_maxTandemRunTimeMs) == false)
{
//_p_monitor->appendText(xt_process->readAll().data());
// data.append(xt_process->readAll());
if(mp_monitor->shouldIstop())
{
m_xtProcess->kill();
delete m_xtProcess;
m_xtProcess = nullptr;
throw pappso::ExceptionInterrupted(
QObject::tr("X!Tandem stopped by the user processing on file %1")
.arg(tandem_input_file));
}
}
QProcess::ExitStatus Status = m_xtProcess->exitStatus();
delete m_xtProcess;
if(Status != QProcess::ExitStatus::NormalExit)
{
// != QProcess::NormalExit
throw pappso::PappsoException(
QObject::tr("error executing X!Tandem Status != 0 : %1")
.arg(m_tandemBinary));
}
m_xtProcess = nullptr;
}
pappso::TandemWrapperRun::m_maxTandemRunTimeMs
int m_maxTandemRunTimeMs
Definition tandemwrapperrun.h:138
pappso::TandemWrapperRun::m_tandemBinary
QString m_tandemBinary
Definition tandemwrapperrun.h:135
pappso::TandemWrapperRun::readyReadStandardError
void readyReadStandardError()
Definition tandemwrapperrun.cpp:229
pappso::TandemWrapperRun::readyReadStandardOutput
void readyReadStandardOutput()
Definition tandemwrapperrun.cpp:208

References m_maxTandemRunTimeMs, m_tandemBinary, m_xtProcess, mp_monitor, readyReadStandardError(), readyReadStandardOutput(), pappso::UiMonitorInterface::setStatus(), and pappso::UiMonitorInterface::shouldIstop().

Referenced by wrapTandemInputFile().

## setTandemBinaryPath()

void pappso::TandemWrapperRun::setTandemBinaryPath | ( | const QString & | tandem_binary_path | ) |

private

Definition at line 87 of file tandemwrapperrun.cpp.

{
m_tandemBinary = tandem_binary_path;
QSettings settings;
if(m_tandemBinary.isEmpty())
{
m_tandemBinary =
settings.value("path/tandem_binary", "/usr/bin/tandem").toString();
}
// check for tandem executable
m_tandemVersion = checkXtandemVersion(m_tandemBinary);
qDebug() << m_tandemVersion;
settings.setValue("path/tandem_binary", m_tandemBinary);
}
pappso::TandemWrapperRun::checkXtandemVersion
const QString checkXtandemVersion(const QString &tandem_bin_path)
Definition tandemwrapperrun.cpp:107

References checkXtandemVersion(), m_tandemBinary, and m_tandemVersion.

Referenced by TandemWrapperRun().

## tandemProgressMessage

void pappso::TandemWrapperRun::tandemProgressMessage | ( | QString | message | ) |

signal

## wrapTandemInputFile()

void pappso::TandemWrapperRun::wrapTandemInputFile | ( | const QString & | tandem_input_file | ) |

private

Definition at line 338 of file tandemwrapperrun.cpp.

{
// read original tandem input file
// store original ms data file name
// create new mzXML data file in temporary directory
// create new tandem input file based on new mzXML file
QString mzxml_data_file_name =
mpa_temporaryDirectory->filePath("msdata.mzxml");
QString wrapped_tandem_input =
mpa_temporaryDirectory->filePath("input_tandem.xml");
QString wrapped_tandem_output =
mpa_temporaryDirectory->filePath("output_tandem.xml");
WrapTandemInput wrap_tandem_input(
mzxml_data_file_name, wrapped_tandem_input, wrapped_tandem_output);
if(wrap_tandem_input.readFile(tandem_input_file))
{
}
else
{
throw pappso::PappsoException(
QObject::tr("Error reading %1 X!Tandem input file :\n %2")
.arg(tandem_input_file)
.arg(wrap_tandem_input.errorString()));
}
if(m_tandemBinary.endsWith("tandemng") ||
m_tandemBinary.endsWith("tandemng.exe") ||
m_tandemBinary.endsWith("tandemng2015") ||
m_tandemBinary.endsWith("tandemng2015.exe") ||
m_tandemBinary.endsWith("tandemng2015p") ||
m_tandemBinary.endsWith("tandemng2015p.exe"))
{
// no wrapper
// launch tandem on original file
runTandem(tandem_input_file);
}
else
{
/*
*
XtandemInputSaxHandler wrap_input(
mzxml_data_file_name, wrapped_tandem_input, wrapped_tandem_output);
QFile qfile(tandem_input_file);
if(!qfile.exists())
{
throw pappso::PappsoException(
QObject::tr("Tandem input file %1 does not exists")
.arg(QFileInfo(tandem_input_file).absoluteFilePath()));
}
QXmlInputSource xmlInputSource(&qfile);
QXmlSimpleReader simplereader;
simplereader.setContentHandler(&wrap_input);
simplereader.setErrorHandler(&wrap_input);
if(simplereader.parse(xmlInputSource))
{
}
else
{
throw pappso::PappsoException(
QObject::tr("Error reading %1 X!Tandem input file :\n %2")
.arg(tandem_input_file)
.arg(wrap_input.errorString()));
}
*/
// get number of threads and centroid parameters from tandem preset
readTandemPresetFile(wrap_tandem_input.getOriginalTandemPresetFileName());
// convert to mzXML
QString original_msdata_file_name =
wrap_tandem_input.getOriginalMsDataFileName();
if(convertOrginalMsData2mzXmlData(original_msdata_file_name,
mzxml_data_file_name))
{
// launch tandem
runTandem(wrapped_tandem_input);
// rewrite tandem result file
writeFinalTandemOutput(
wrapped_tandem_output,
wrap_tandem_input.getOriginalTandemOutputFileName(),
original_msdata_file_name);
}
else
{
// launch tandem on original file
runTandem(tandem_input_file);
}
}
}
pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData
bool convertOrginalMsData2mzXmlData(const QString &origin, const QString &target)
Definition tandemwrapperrun.cpp:439
pappso::TandemWrapperRun::readTandemPresetFile
void readTandemPresetFile(const QString &tandem_preset_file)
Definition tandemwrapperrun.cpp:285
pappso::TandemWrapperRun::writeFinalTandemOutput
void writeFinalTandemOutput(const QString &tmp_tandem_output, const QString &final_tandem_output, const QString &original_msdata_file_name)
tandem output modification tandem output is modified to contain the Bruker's file as input and centro...
Definition tandemwrapperrun.cpp:243
pappso::TandemWrapperRun::runTandem
void runTandem(const QString &tandem_input_file)
run a tandem job
Definition tandemwrapperrun.cpp:536

References convertOrginalMsData2mzXmlData(), pappso::XmlStreamReaderInterface::errorString(), pappso::WrapTandemInput::getOriginalMsDataFileName(), pappso::WrapTandemInput::getOriginalTandemOutputFileName(), pappso::WrapTandemInput::getOriginalTandemPresetFileName(), m_tandemBinary, mpa_temporaryDirectory, pappso::XmlStreamReaderInterface::readFile(), readTandemPresetFile(), runTandem(), and writeFinalTandemOutput().

Referenced by run().

## writeFinalTandemOutput()

void pappso::TandemWrapperRun::writeFinalTandemOutput | ( | const QString & | tmp_tandem_output,
|  | const QString & | final_tandem_output,
|  | const QString & | original_msdata_file_name
| ) |  |

private

tandem output modification tandem output is modified to contain the Bruker's file as input and centroidization parameters

Parameters

  tmp_tandem_output | raw tandem output filename
  final_tandem_output | final destination file for modified tandem output

Definition at line 243 of file tandemwrapperrun.cpp.

{
mp_monitor->setStatus(QObject::tr("Rewriting X!Tandem XML result file"));
WrapTandemResults wrap_output(final_tandem_output, original_msdata_file_name);
wrap_output.setInputParameters("spectrum, timstof MS2 filters",
getMs2FilterSuiteString());
wrap_output.setInputParameters("spectrum, mzFormat",
QString("%1").arg((int)m_mzFormat));
if(m_convertMzDataUsingSpectrumIndex)
{
wrap_output.setInputParameters("output, spectrum index", "true");
}
else
{
}
if(m_conversionTime != 0)
{
wrap_output.setInputParameters(
"timing, tandemwrapper conversion time (sec)",
QString("%1").arg(m_conversionTime / 1000));
}
if(wrap_output.readFile(tmp_tandem_output))
{
}
else
{
throw pappso::PappsoException(
QObject::tr("Error reading %1 X!Tandem output file :\n %2")
.arg(tmp_tandem_output)
.arg(wrap_output.errorString()));
}
}
pappso::TandemWrapperRun::getMs2FilterSuiteString
QString getMs2FilterSuiteString() const
gets the list of filters used on MS2 spectrum
Definition tandemwrapperrun.cpp:605

References pappso::XmlStreamReaderInterface::errorString(), getMs2FilterSuiteString(), m_conversionTime, m_convertMzDataUsingSpectrumIndex, m_mzFormat, mp_monitor, pappso::XmlStreamReaderInterface::readFile(), pappso::WrapTandemResults::setInputParameters(), and pappso::UiMonitorInterface::setStatus().

Referenced by wrapTandemInputFile().

## Member Data Documentation

## m_conversionTime

qint64 pappso::TandemWrapperRun::m_conversionTime = 0

private

Definition at line 150 of file tandemwrapperrun.h.

Referenced by convertOrginalMsData2mzXmlData(), and writeFinalTandemOutput().

## m_convertMzDataUsingSpectrumIndex

bool pappso::TandemWrapperRun::m_convertMzDataUsingSpectrumIndex = false

private

Definition at line 146 of file tandemwrapperrun.h.

Referenced by convertOrginalMsData2mzXmlData(), and writeFinalTandemOutput().

## m_maxTandemRunTimeMs

int pappso::TandemWrapperRun::m_maxTandemRunTimeMs

private

Initial value:
=
1000

Definition at line 138 of file tandemwrapperrun.h.

Referenced by runTandem().

## m_mzFormat

pappso::MsDataFormat pappso::TandemWrapperRun::m_mzFormat = pappso::MsDataFormat::unknown

private

Definition at line 148 of file tandemwrapperrun.h.

Referenced by convertOrginalMsData2mzXmlData(), and writeFinalTandemOutput().

## m_tandemBinary

QString pappso::TandemWrapperRun::m_tandemBinary

private

Definition at line 135 of file tandemwrapperrun.h.

Referenced by runTandem(), setTandemBinaryPath(), and wrapTandemInputFile().

## m_tandemVersion

QString pappso::TandemWrapperRun::m_tandemVersion

private

Definition at line 136 of file tandemwrapperrun.h.

Referenced by checkXtandemVersion(), and setTandemBinaryPath().

## m_tmpDir

QString pappso::TandemWrapperRun::m_tmpDir

private

Definition at line 137 of file tandemwrapperrun.h.

## m_xtProcess

QProcess* pappso::TandemWrapperRun::m_xtProcess = nullptr

private

Definition at line 140 of file tandemwrapperrun.h.

Referenced by ~TandemWrapperRun(), readyReadStandardError(), readyReadStandardOutput(), and runTandem().

## mp_monitor

UiMonitorInterface* pappso::TandemWrapperRun::mp_monitor

private

Definition at line 134 of file tandemwrapperrun.h.

Referenced by convertOrginalMsData2mzXmlData(), readyReadStandardError(), readyReadStandardOutput(), run(), runTandem(), and writeFinalTandemOutput().

## mpa_temporaryDirectory

QTemporaryDir* pappso::TandemWrapperRun::mpa_temporaryDirectory = nullptr

private

Definition at line 144 of file tandemwrapperrun.h.

Referenced by TandemWrapperRun(), ~TandemWrapperRun(), and wrapTandemInputFile().

## msp_ms2FilterSuiteString

std::shared_ptr<FilterSuiteString> pappso::TandemWrapperRun::msp_ms2FilterSuiteString = nullptr

private

Definition at line 142 of file tandemwrapperrun.h.

Referenced by convertOrginalMsData2mzXmlData(), getMs2FilterSuiteString(), and readTandemPresetFile().

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

- pappsomspp/processing/tandemwrapper/tandemwrapperrun.h
- pappsomspp/processing/tandemwrapper/tandemwrapperrun.cpp