From 1d4e8f2ee93444993801f26af5f85c2d9b9206ec Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Thu, 8 Jun 2017 17:20:52 +0200 Subject: [PATCH] check unique dbxref --- src/core/proteinxtp.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/proteinxtp.cpp b/src/core/proteinxtp.cpp index ef3bba3f..c5551184 100644 --- a/src/core/proteinxtp.cpp +++ b/src/core/proteinxtp.cpp @@ -124,6 +124,7 @@ unsigned int ProteinXtp::countTrypticPeptidesForPAI() const { void ProteinXtp::parseAccession2dbxref() { + qDebug() << "ProteinXtp::parseAccession2dbxref begin" ; QStringList access_list = getAccession().split("\\|"); // if (access.length == 1) QRegExp atg("^[Aa][Tt][MmCc1-5][Gg]\\d{5}\\.?\\d?$"); @@ -140,11 +141,11 @@ void ProteinXtp::parseAccession2dbxref() { if (ncbi_gi.indexIn(accession, 0) != -1) { _dbxref_list.push_back(std::make_pair(ExternalDatabase::NCBI_gi, accession)); } - + if (swiss_prot.indexIn(accession, 0) != -1) { _dbxref_list.push_back(std::make_pair(ExternalDatabase::SwissProt, accession)); } - + if (trembl.indexIn(accession, 0) != -1) { _dbxref_list.push_back(std::make_pair(ExternalDatabase::TrEMBL, accession)); } @@ -152,6 +153,16 @@ void ProteinXtp::parseAccession2dbxref() { _dbxref_list.push_back(std::make_pair(ExternalDatabase::ref, accession)); } } + + if (_dbxref_list.size() > 1) { + _dbxref_list.sort(); + _dbxref_list.unique([] (const std::pair<ExternalDatabase, QString> & first, const std::pair<ExternalDatabase, QString> & second) + { + return ( first.first == second.first ) && (first.second == second.second); + }); + } + + qDebug() << "ProteinXtp::parseAccession2dbxref end" ; } -- GitLab