Skip to content
Snippets Groups Projects
Commit 56881e24 authored by Olivier Langella's avatar Olivier Langella
Browse files

better exception handling for pwiz

parent 6bf5b67a
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ void LoadResultsDialog::chooseFiles() {
QString default_location = settings.value("path/identificationfiles", "").toString();
QStringList filenames = QFileDialog::getOpenFileNames(this,tr("identification files"),default_location,
tr("X!Tandem files (*.xml);;mzIdentML files (*.mzid);;all files (*)") );
tr("X!Tandem files (*.xml);;mzIdentML files (*.mzid);;Mascot dat files (*.dat);;all files (*)") );
if (filenames.size() > 0) {
settings.setValue("path/identificationfiles", QFileInfo(filenames[0]).absolutePath());
......
......@@ -59,8 +59,15 @@ pwiz::identdata::IdentDataFile * getPwizIdentDataFile(const QString & filename)
setlocale(LC_ALL,"C");
//lc = localeconv ();
//qDebug() << " env=" << localeconv () << " lc->decimal_point " << lc->decimal_point;
pwiz::identdata::IdentDataFile * dataFile = new pwiz::identdata::IdentDataFile(filename.toStdString());
pwiz::identdata::IdentDataFile * dataFile;
try {
dataFile = new pwiz::identdata::IdentDataFile(filename.toStdString());
}
catch (std::exception& error)
{
qDebug() << "getPwizIdentDataFile std error ";
throw pappso::PappsoException(QObject::tr("Error reading file (%1) using proteowizard library : %2").arg(filename).arg(error.what()));
}
setlocale(LC_ALL,env.c_str());
return dataFile;
......@@ -171,7 +178,7 @@ void IdentificationPwizReader::read(
for (pwiz::identdata::ModificationPtr mod_ptr :peptide_pwiz->modification) {
unsigned int location = mod_ptr.get()->location;
pappso::pappso_double mass_delta = mod_ptr.get()->monoisotopicMassDelta;
peptide.addAaModification(Utils::guessAaModificationPbyMonoisotopicMassDelta(mass_delta), location-1);
//std::vector<CVParam> cvParams;
for (const pwiz::data::CVParam & param: mod_ptr.get()->cvParams) {
......
......@@ -58,8 +58,11 @@ IdentificationDataSourceSp IdentificationDataSourceStore::getInstance(const QStr
if (ext.toLower() == "xml") {
//X!Tandem result file
p_identfile = std::make_shared<IdentificationXtandemFile>(location_file);
}
else {
} else
if (ext.toLower() == "dat") {
//dat file
p_identfile = std::make_shared<IdentificationPwizFile>(location_file);
}else {
p_identfile = std::make_shared<IdentificationPwizFile>(location_file);
}
if (p_identfile == nullptr) {
......
......@@ -57,8 +57,15 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) {
setlocale(LC_ALL,"C");
//lc = localeconv ();
//qDebug() << " env=" << localeconv () << " lc->decimal_point " << lc->decimal_point;
pwiz::msdata::MSDataFile * dataFile = new pwiz::msdata::MSDataFile(filename.toStdString());
pwiz::msdata::MSDataFile * dataFile;
try {
dataFile = new pwiz::msdata::MSDataFile(filename.toStdString());
}
catch (std::exception& error)
{
qDebug() << "getPwizMSDataFile std error ";
throw pappso::PappsoException(QObject::tr("Error reading file (%1) using proteowizard library : %2").arg(filename).arg(error.what()));
}
setlocale(LC_ALL,env.c_str());
return dataFile;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment