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

readig mzIdentML

parent 1c51046c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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);
......
......@@ -46,6 +46,7 @@ enum class ExternalDatabase: std::int8_t {
enum class IdentificationEngine {
unknown, ///< X!Tandem
XTandem, ///< X!Tandem
mascot, ///< Mascot
peptider ///< peptider
};
......
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