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

proticdbML output debug

parent f32440b7
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,7 @@ void ProticdbMl::writeSequence(ProteinMatch * p_protein_match) {
}
void ProticdbMl::writeProject() {
qDebug() << "ProticdbMl::writeProject begin";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("project");
_output_stream->writeAttribute("name", "");
_output_stream->writeAttribute("id", "p1");
......@@ -179,9 +179,11 @@ void ProticdbMl::writeProject() {
_output_stream->writeEndDocument();
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writeIdentMethod() {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// Ajout des méthodes
_output_stream->writeStartElement("identMeth");
_output_stream->writeAttribute("name", "");
......@@ -193,11 +195,13 @@ void ProticdbMl::writeIdentMethod() {
_output_stream->writeAttribute("name", "");
_output_stream->writeAttribute("id", "customdb0");
_output_stream->writeEndElement();
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writeSamples() {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("samples");
for (MsRunSp msrun_sp : _sp_project.get()->getMsRunStore().getMsRunList()) {
_output_stream->writeStartElement("sample");
......@@ -218,10 +222,12 @@ void ProticdbMl::writeSamples() {
}
_output_stream->writeEndElement();// samples
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writeMsRuns() {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("msRuns");
for (MsRunSp msrun_sp : _sp_project.get()->getMsRunStore().getMsRunList()) {
......@@ -267,11 +273,13 @@ void ProticdbMl::writeMsRuns() {
}
_output_stream->writeEndElement();// msRuns
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writeIdentificationDataSource(IdentificationDataSource * p_identification_data_source) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("dataProcessing");
_output_stream->writeStartElement("software");
_output_stream->writeStartElement("name");
......@@ -315,9 +323,11 @@ void ProticdbMl::writeIdentificationDataSource(IdentificationDataSource * p_iden
_output_stream->writeEndElement();// processingMethod
_output_stream->writeEndElement();// dataProcessing
*/
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writeIdentificationRun(IdentificationGroup * p_identification) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeAttribute("ident_method_id", "m1");
_output_stream->writeAttribute("customdb_id", "customdb0");
......@@ -357,6 +367,7 @@ void ProticdbMl::writeIdentificationRun(IdentificationGroup * p_identification)
for (IdentificationDataSource * p_identification_data_source : p_identification->getIdentificationDataSourceList()) {
writeIdentificationDataSource(p_identification_data_source);
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// id: PROTICdbO:0000316
// name: X!TandemPipeline
......@@ -407,15 +418,18 @@ void ProticdbMl::writeIdentificationRun(IdentificationGroup * p_identification)
_output_stream->writeEndElement();// dataProcessing
_output_stream->writeEndElement();// description
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writepeptideHits(IdentificationGroup * p_identification) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("peptideHits");
for (std::pair <unsigned int, GroupingGroupSp > group_pair : p_identification->getGroupStore().getGroupMap()) {
writepeptideHitsbyGroup(group_pair.second.get());
}
_output_stream->writeEndElement();// "peptideHits");
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
QString getProticPeptideHitKey(const PeptideEvidence * p_peptide_evidence) {
......@@ -429,16 +443,17 @@ struct ProticPeptideHit {
/** key = getProticPeptideHitKey
* */
QString key;
const PeptideMatch * peptide_match;
PeptideMatch peptide_match;
};
void ProticdbMl::writepeptideHitsbyGroup(GroupingGroup * p_group) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
std::vector <ProticPeptideHit> protic_peptide_hit_list;
for (const ProteinMatch* p_protein_match : p_group->getProteinMatchList()) {
for (const PeptideMatch & peptide_match : p_protein_match->getPeptideMatchList(ValidationState::grouped)) {
ProticPeptideHit protic_peptide_hit = {getProticPeptideHitKey(peptide_match.getPeptideEvidence()), &peptide_match};
ProticPeptideHit protic_peptide_hit = {getProticPeptideHitKey(peptide_match.getPeptideEvidence()), peptide_match};
protic_peptide_hit_list.push_back(protic_peptide_hit);
}
}
......@@ -453,24 +468,39 @@ void ProticdbMl::writepeptideHitsbyGroup(GroupingGroup * p_group) {
writePeptideHit(xml_id, protic_peptide_hit);
_peptidekey_to_id.insert(std::pair<QString, QString>(protic_peptide_hit.key, xml_id));
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void ProticdbMl::writePeptideHit(QString xml_id, ProticPeptideHit & protic_peptide_hit) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
if (protic_peptide_hit.peptide_match.getPeptideEvidence() == nullptr) {
throw pappso::PappsoException(QObject::tr("Error protic_peptide_hit.peptide_match->getPeptideEvidence() == nullptr : \n%1 %2 %3").arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__)
);
}
if (protic_peptide_hit.peptide_match.getPeptideEvidence()->getPeptideXtpSp().get() == nullptr) {
throw pappso::PappsoException(QObject::tr("Error protic_peptide_hit.peptide_match->getPeptideEvidence()->getPeptideXtpSp().get() == nullptr : \n%1 %2 %3").arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__)
);
}
// param par default
_output_stream->writeStartElement("peptideHit");
_output_stream->writeAttribute("calc_mr", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getPeptideXtpSp().get()->getMass()));
_output_stream->writeAttribute("exp_mz", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getExperimentalMz()));
_output_stream->writeAttribute("delta", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getDeltaMass()));
_output_stream->writeAttribute("exp_mr", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getExperimentalMz()- pappso::MHPLUS));
_output_stream->writeAttribute("acq_number", QString ("%1").arg(protic_peptide_hit.peptide_match->getPeptideEvidence()->getScan()));
_output_stream->writeAttribute("ms_run_id", protic_peptide_hit.peptide_match->getPeptideEvidence()->getMsRunP()->getXmlId());
_output_stream->writeAttribute("calc_mr", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->getMass()));
_output_stream->writeAttribute("exp_mz", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getExperimentalMz()));
_output_stream->writeAttribute("delta", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getDeltaMass()));
_output_stream->writeAttribute("exp_mr", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getExperimentalMass()));
_output_stream->writeAttribute("acq_number", QString ("%1").arg(protic_peptide_hit.peptide_match.getPeptideEvidence()->getScan()));
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeAttribute("ms_run_id", protic_peptide_hit.peptide_match.getPeptideEvidence()->getMsRunP()->getXmlId());
_output_stream->writeAttribute("id", xml_id);
_output_stream->writeAttribute("exp_z", QString ("%1").arg(protic_peptide_hit.peptide_match->getPeptideEvidence()->getCharge()));
_output_stream->writeAttribute("exp_z", QString ("%1").arg(protic_peptide_hit.peptide_match.getPeptideEvidence()->getCharge()));
writeCvParam("PROTICdbO:0000339",protic_peptide_hit.peptide_match->getPeptideEvidence()->getGrpPeptideSp().get()->getGroupingId(),
writeCvParam("PROTICdbO:0000339",protic_peptide_hit.peptide_match.getPeptideEvidence()->getGrpPeptideSp().get()->getGroupingId(),
"peptide mass id");
/*
if (xtpExperimentType.equals("phospho")) {
......@@ -479,32 +509,34 @@ void ProticdbMl::writePeptideHit(QString xml_id, ProticPeptideHit & protic_pepti
"phosphopeptide mass id");
}
*/
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// pep.getMsRun().
IdentificationEngine identification_engine = protic_peptide_hit.peptide_match->getPeptideEvidence()->getIdentificationDataSource()->getIdentificationEngine();
IdentificationEngine identification_engine = protic_peptide_hit.peptide_match.getPeptideEvidence()->getIdentificationDataSource()->getIdentificationEngine();
if (identification_engine == IdentificationEngine::XTandem) {
// cvparam specifique xtandem
writeCvParam("PROTICdbO:0000287", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getEvalue()),
writeCvParam("PROTICdbO:0000287", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getEvalue()),
"xtandem peptide evalue");
writeCvParam("PROTICdbO:0000288", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getParam(PeptideEvidenceParam::tandem_hyperscore).toDouble()),
writeCvParam("PROTICdbO:0000288", Utils::getXmlDouble(protic_peptide_hit.peptide_match.getPeptideEvidence()->getParam(PeptideEvidenceParam::tandem_hyperscore).toDouble()),
"xtandem peptide hyperscore");
}
writeCvParam("PROTICdbO:0000289",QString ("%1").arg(protic_peptide_hit.peptide_match->getPeptideEvidence()->getRetentionTime()),
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
writeCvParam("PROTICdbO:0000289",QString ("%1").arg(protic_peptide_hit.peptide_match.getPeptideEvidence()->getRetentionTime()),
"xtandem peptide retention time");
// sequences avec les modifs
_output_stream->writeStartElement("pepSeq");
_output_stream->writeStartElement("peptide");
_output_stream->writeCharacters(protic_peptide_hit.peptide_match->getPeptideEvidence()->getPeptideXtpSp().get()->getSequence());
_output_stream->writeCharacters(protic_peptide_hit.peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->getSequence());
_output_stream->writeEndElement();// peptide
if (!protic_peptide_hit.peptide_match->getPeptideEvidence()->getPeptideXtpSp().get()->getModifString().isEmpty()) {
writePtms(protic_peptide_hit.peptide_match->getPeptideEvidence()->getPeptideXtpSp().get());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
if (!protic_peptide_hit.peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->getModifString().isEmpty()) {
writePtms(protic_peptide_hit.peptide_match.getPeptideEvidence()->getPeptideXtpSp().get());
}
_output_stream->writeEndElement();// pepSeq
_output_stream->writeEndElement();// peptideHit
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
......@@ -532,6 +564,7 @@ void ProticdbMl::writePtms(PeptideXtp * p_peptide) {
}
void ProticdbMl::writeMatchs(IdentificationGroup * p_identification) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_output_stream->writeStartElement("matchs");
for (std::pair <unsigned int, GroupingGroupSp > group_pair : p_identification->getGroupStore().getGroupMap()) {
......@@ -563,6 +596,7 @@ void ProticdbMl::writeMatchs(IdentificationGroup * p_identification) {
writeMatch(protein_match_subgroup_list);
}
_output_stream->writeEndElement();// "matchs");
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
const QString & ProticdbMl::getPeptideXmlId(const PeptideMatch* p_peptide_match) const {
......@@ -570,11 +604,11 @@ const QString & ProticdbMl::getPeptideXmlId(const PeptideMatch* p_peptide_match)
auto it = _peptidekey_to_id.find(peptide_key);
if (it == _peptidekey_to_id.end()) {
throw pappso::PappsoException(QObject::tr("Error peptide key %1 not found for peptide match %2 sample=%3 scan=%4 start=%5").arg(peptide_key)
.arg(p_peptide_match->getPeptideEvidence()->getPeptideXtpSp().get()->toString())
.arg(p_peptide_match->getPeptideEvidence()->getMsRunP()->getXmlId())
.arg(p_peptide_match->getPeptideEvidence()->getScan())
.arg(p_peptide_match->getStart())
);
.arg(p_peptide_match->getPeptideEvidence()->getPeptideXtpSp().get()->toString())
.arg(p_peptide_match->getPeptideEvidence()->getMsRunP()->getXmlId())
.arg(p_peptide_match->getPeptideEvidence()->getScan())
.arg(p_peptide_match->getStart())
);
}
return it->second;
......@@ -583,8 +617,8 @@ const QString & ProticdbMl::getProteinXmlId(const ProteinMatch* p_protein_match)
auto it = _map_accession2xmlid.find(p_protein_match->getProteinXtpSp().get()->getAccession());
if (it == _map_accession2xmlid.end()) {
throw pappso::PappsoException(QObject::tr("Error protein accession %1 not found for protein %2")
.arg(p_protein_match->getProteinXtpSp().get()->getAccession())
.arg(p_protein_match->getProteinXtpSp().get()->getAccession()));
.arg(p_protein_match->getProteinXtpSp().get()->getAccession())
.arg(p_protein_match->getProteinXtpSp().get()->getAccession()));
}
return it->second;
}
......
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