diff --git a/src/core/identification_sources/identificationpwizfile.cpp b/src/core/identification_sources/identificationpwizfile.cpp index ca1dfdb3f783a67b4118c5dcd0073c30f2ea5f65..c7302963a2cad2a1259003509567e5bc53a2f255 100644 --- a/src/core/identification_sources/identificationpwizfile.cpp +++ b/src/core/identification_sources/identificationpwizfile.cpp @@ -36,7 +36,7 @@ IdentificationPwizFile::IdentificationPwizFile(const QFileInfo & ident_file) : IdentificationDataSource(ident_file.absoluteFilePath()), _ident_file(ident_file) { //_engine = IdentificationEngine::XTandem; - _engine = IdentificationEngine::peptider; + _engine = IdentificationEngine::peptider; } IdentificationPwizFile::IdentificationPwizFile(const IdentificationPwizFile& other) : IdentificationDataSource(other),_ident_file (other._ident_file) @@ -66,6 +66,8 @@ void IdentificationPwizFile::parseTo(Project* p_project) { IdentificationPwizReader pwiz_reader(_ident_file); MsRunSp msrun_sp = p_project->getMsRunStore().getInstance(pwiz_reader.getMsrunName()); + + _engine = pwiz_reader.getIdentificationEngine(); setMsRunSp(msrun_sp); std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList(); IdentificationGroup * identification_group_p = nullptr; diff --git a/src/core/peptidematch.cpp b/src/core/peptidematch.cpp index 3004435f2807ed111d526696eddd6a266a18c45a..ab3a9377b13ec4e4d985d7a167aa937e1f3a85a3 100644 --- a/src/core/peptidematch.cpp +++ b/src/core/peptidematch.cpp @@ -46,6 +46,7 @@ PeptideMatch::PeptideMatch(const PeptideMatch & other): PeptideMatch(other._msru _params = other._params; _checked = other._checked; _proxy_valid = other._proxy_valid; + } void PeptideMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h index 29b290a3949db2b6c8d4a991a6c3a576f1d6a54f..0c5ccf6a04c9f51acc75d919e83e46d16ff1e824 100644 --- a/src/core/peptidematch.h +++ b/src/core/peptidematch.h @@ -124,7 +124,7 @@ private : pappso::GrpPeptideSp _sp_grp_peptide; PeptideXtpSp _peptide_sp; pappso::pappso_double _rt; - pappso::pappso_double _evalue; + pappso::pappso_double _evalue=0; pappso::pappso_double _exp_mass; unsigned int _start=0; unsigned int _charge; diff --git a/src/input/identificationpwizreader.cpp b/src/input/identificationpwizreader.cpp index 3bc43897b9e6951da69b38a8e1793b8a0db73d6a..484df0d3f48ebde4af7eb03c7e3d98912b9c7eec 100644 --- a/src/input/identificationpwizreader.cpp +++ b/src/input/identificationpwizreader.cpp @@ -37,6 +37,7 @@ #include <pappsomspp/pappsoexception.h> #include <pappsomspp/exception/exceptionoutofrange.h> +#include <pwiz/data/common/ParamTypes.hpp> #include <pwiz/data/identdata/IdentData.hpp> #include <pwiz/data/identdata/IdentDataFile.hpp> #include "../core/peptidematch.h" @@ -87,6 +88,43 @@ const QString IdentificationPwizReader::getMsrunName() const { return QString::fromStdString(pwiz_msrun->name); } + +IdentificationEngine IdentificationPwizReader::getIdentificationEngine() const { + + /* + <AnalysisSoftwareList xmlns="http://psidev.info/psi/pi/mzIdentML/1.1"> + <AnalysisSoftware version="X!Tandem Vengeance (2015.12.15.2)" name="X!Tandem" id="as1"> + <SoftwareName> + <cvParam accession="MS:1001476" cvRef="PSI-MS" name="X!Tandem"/> + </SoftwareName> + </AnalysisSoftware> + </AnalysisSoftwareList> + */ + IdentificationEngine identification_engine = IdentificationEngine::peptider; + for (pwiz::identdata::AnalysisSoftwarePtr software_ptr :_pwiz_ident_data_file->analysisSoftwareList) { + // qDebug() << "IdentificationPwizReader::getIdentificationEngine " << QString::fromStdString(software_ptr.get()->cvParam(param).name); + if (software_ptr.get()->softwareName.hasCVParam(pwiz::cv::MS_X_Tandem)) + { + identification_engine = IdentificationEngine::XTandem; + } + if (software_ptr.get()->softwareName.hasCVParam(pwiz::cv::MS_Mascot_DAT_format)) + { + identification_engine = IdentificationEngine::mascot; + } + } + return identification_engine; +} + +QVariant getQVariantDoubleParam(pwiz::data::ParamContainer * item, pwiz::cv::CVID param) { + if (item->hasCVParam(param)) + { + return QVariant (QString::fromStdString(item->cvParam(param).value).toDouble()); + } + else { + return QVariant(); + } +} + void IdentificationPwizReader::read( IdentificationDataSource * p_identification_data_source, Project * p_project, IdentificationGroup * p_identification_group) { qDebug() << "IdentificationPwizReader::read begin"; @@ -114,7 +152,7 @@ void IdentificationPwizReader::read( ProteinMatch * protein_match_p = _p_identification_group->getProteinMatchInstance(protein_sp.get()->getAccession()); protein_match_p->setProteinXtpSp(protein_sp); - protein_match_p->setChecked(true); + protein_match_p->setChecked(true); map_id2protein.insert(std::pair<QString, ProteinMatch *>(QString::fromStdString( sequence_pwiz->id), protein_match_p)); @@ -146,14 +184,9 @@ void IdentificationPwizReader::read( } //<cvParam accession="MS:1001115" cvRef="PSI-MS" value="4925" name="scan number(s)"/> - double rt=0; - - if (spectrum_ptr.get()->hasCVParam(pwiz::cv::MS_retention_time)) + QVariant rt = getQVariantDoubleParam(spectrum_ptr.get(), pwiz::cv::MS_retention_time); + if (rt.isNull()) { - rt = - std::stod(spectrum_ptr.get()->cvParam(pwiz::cv::MS_retention_time).value); - } - else { //throw pappso::PappsoException(QObject::tr("Scan number not found")); } @@ -167,20 +200,22 @@ void IdentificationPwizReader::read( // </SpectrumIdentificationItem> for ( pwiz::identdata::SpectrumIdentificationItemPtr spid_item : spectrum_ptr.get()->spectrumIdentificationItem) { PeptideMatch * p_peptide_match = new PeptideMatch(_sp_msrun.get(), scan); - p_peptide_match->setRetentionTime(rt); + p_peptide_match->setRetentionTime(rt.toDouble()); p_peptide_match->setCharge(spid_item->chargeState); pappso::pappso_double exp_mass = spid_item->experimentalMassToCharge * ((double) spid_item->chargeState) - (((double) spid_item->chargeState) * pappso::MHPLUS); p_peptide_match->setExperimentalMass(exp_mass); p_peptide_match->setIdentificationDataSource( p_identification_data_source); p_peptide_match->setChecked(true); - if (spectrum_ptr.get()->hasCVParam(pwiz::cv::MS_X_Tandem_expect)) + QVariant evalue = getQVariantDoubleParam(spid_item.get(), pwiz::cv::MS_X_Tandem_expect); + if (!evalue.isNull()) { - p_peptide_match->setEvalue(std::stod(spectrum_ptr.get()->cvParam(pwiz::cv::MS_X_Tandem_expect).value)); + p_peptide_match->setEvalue(evalue.toDouble()); } - if (spectrum_ptr.get()->hasCVParam(pwiz::cv::MS_X_Tandem_hyperscore)) + QVariant hyperscore = getQVariantDoubleParam(spid_item.get(), pwiz::cv::MS_X_Tandem_hyperscore); + if (!hyperscore.isNull()) { - p_peptide_match->setParam(PeptideMatchParam::tandem_hyperscore, QVariant(std::stod(spectrum_ptr.get()->cvParam(pwiz::cv::MS_X_Tandem_hyperscore).value))); + p_peptide_match->setParam(PeptideMatchParam::tandem_hyperscore, hyperscore); } for ( pwiz::identdata::PeptideEvidencePtr peptide_evidence_sp : spid_item.get()->peptideEvidencePtr) { diff --git a/src/input/identificationpwizreader.h b/src/input/identificationpwizreader.h index a4999a71f9b572a1f38981a85b60d420d7230469..6a069c868e4273d9d925bceec48fccf7e5a95a23 100644 --- a/src/input/identificationpwizreader.h +++ b/src/input/identificationpwizreader.h @@ -35,6 +35,7 @@ #include "../core/identification_sources/identificationdatasource.h" #include "../core/project.h" #include "../core/identificationgroup.h" +#include "../utils/types.h" namespace pwiz { @@ -49,6 +50,7 @@ public: IdentificationPwizReader(const QFileInfo & filename); virtual ~IdentificationPwizReader(); const QString getMsrunName() const; + IdentificationEngine getIdentificationEngine() const; void read( IdentificationDataSource * p_identification_data_source, Project * p_project, IdentificationGroup * p_identification_group); diff --git a/src/utils/types.h b/src/utils/types.h index 2226518680c97846ad43edf1d50bbc52bea7576f..b18293cd2c5ca123726ec252ae4b6ff429b79761 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -46,6 +46,7 @@ enum class ExternalDatabase: std::int8_t { enum class IdentificationEngine { unknown, ///< X!Tandem XTandem, ///< X!Tandem + mascot, ///< Mascot peptider ///< peptider };