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

highlight peptide is OK

parent 79202a27
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED )
SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so")
......
......@@ -27,6 +27,10 @@
#include <set>
QColor ProteinMatch::_color_peptide_background = QColor("yellow");
QColor ProteinMatch::_color_highlighted_peptide_background = QColor("#ff7878");
ProteinMatch::ProteinMatch()
{
......@@ -41,6 +45,14 @@ ProteinMatch::~ProteinMatch()
}
}
bool ProteinMatch::contains(PeptideMatch * peptide_match) const {
if (peptide_match == nullptr) return false;
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match == peptide_match) return true;
}
return false;
}
void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ;
_proxy_valid = false;
......@@ -273,12 +285,23 @@ pappso::pappso_double ProteinMatch::getPAI(const pappso::MsRunIdSp & sp_msrun_id
}
const QString ProteinMatch::getHtmlSequence() const
const QString ProteinMatch::getHtmlSequence(PeptideMatch * peptide_match_to_locate) const
{
size_t prot_size = _protein_sp.get()->size();
//qDebug() << "ProteinMatch::getCoverage begin prot_size=" << prot_size << " " << _protein_sp.get()-//>getSequence();
if (prot_size == 0) return 0;
bool cover_bool[prot_size] = {false};
bool highlight_bool[prot_size] = {false};
if (this->contains(peptide_match_to_locate)) {
size_t size = peptide_match_to_locate->getPeptideXtpSp().get()->size();
size_t offset = peptide_match_to_locate->getStart();
if (offset >= 0) {
for (size_t i=0; (i < size) && (offset < prot_size) ; i++,offset++) {
highlight_bool[offset] = true;
}
}
}
for (auto & p_peptide_match : _peptide_match_list) {
if (p_peptide_match->isValidAndChecked()) {
size_t size = p_peptide_match->getPeptideXtpSp().get()->size();
......@@ -293,11 +316,29 @@ const QString ProteinMatch::getHtmlSequence() const
QString sequence = getProteinXtpSp().get()->getSequence();
QString sequence_html;
for (unsigned int i=0; i < prot_size; i++) {
if(cover_bool[i]) {
sequence_html.append(QString("<span style=\"background-color:yellow;\">%1").arg(sequence[i]));
if(highlight_bool[i]) {
sequence_html.append(QString("<span style=\"background-color:%2;\">%1").arg(sequence[i]).arg(_color_highlighted_peptide_background.name()));
i++;
for (; i < prot_size; i++) {
if(highlight_bool[i]) {
sequence_html.append(sequence[i]);
}
else {
sequence_html.append(QString("</span>"));
i--;
break;
}
}
sequence_html.append(QString("</span>"));
}
else if(cover_bool[i]) {
sequence_html.append(QString("<span style=\"background-color:%2;\">%1").arg(sequence[i]).arg(_color_peptide_background.name()));
i++;
for (; i < prot_size; i++) {
if (highlight_bool[i]) {
i--;
break;
}
if(cover_bool[i]) {
sequence_html.append(sequence[i]);
}
......
......@@ -21,6 +21,7 @@
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include <QColor>
#include <vector>
#include <pappsomspp/types.h>
#include "proteinxtp.h"
......@@ -48,7 +49,7 @@ public:
/** @brief compute protein Evalue overall samples
* */
pappso::pappso_double getEvalue() const;
/** @brief compute protein Evalue within samples
* */
pappso::pappso_double getEvalue(const pappso::MsRunIdSp & sp_msrun_id) const;
......@@ -58,9 +59,10 @@ public:
* */
pappso::pappso_double getCoverage() const;
/** @brief get coverage sequence (html representation)
**/
const QString getHtmlSequence() const;
/** @brief get coverage sequence (html representation)
* @param peptide_match_to_locate pointer to optional peptide match to locate on protein sequence
**/
const QString getHtmlSequence(PeptideMatch * peptide_match_to_locate = nullptr) const;
/** @brief compute Protein Abundance Index (PAI)
* overall sample PAI computation (Rappsilber et al. 2002)
......@@ -102,6 +104,9 @@ public:
* */
void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters);
/** @brief tells if this protein match contains this peptides
*/
bool contains(PeptideMatch * peptide_match) const;
protected :
void setGroupingExperiment(GroupingExperiment * p_grp_experiment);
......@@ -113,6 +118,10 @@ private :
unsigned int countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const;
private:
static QColor _color_peptide_background;
static QColor _color_highlighted_peptide_background;
pappso::GrpProteinSp _sp_grp_protein;
GroupingGroupSp _sp_group;
......
......@@ -193,6 +193,8 @@ void ProjectWindow::doViewPeptideDetail(PeptideMatch * peptide_match) {
_p_current_peptide_detail_window->setPeptideMatch(peptide_match);
_p_current_peptide_detail_window->show();
emit peptideMatchSelected(peptide_match);
qDebug() << "ProjectWindow::doViewPeptideDetail end";
}
......
......@@ -57,6 +57,7 @@ public slots:
// void setShape(Shape shape);
signals:
void identificationGroupGrouped(IdentificationGroup * p_identification_group);
void peptideMatchSelected(PeptideMatch * peptide_match);
//void peptideChanged(pappso::PeptideSp peptide);
protected :
......
......@@ -48,6 +48,7 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent):
#else
// Qt4 code
connect (_p_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect (_p_project_window, SIGNAL(peptideMatchSelected(PeptideMatch*)), this,SLOT(doPeptideMatchSelected(PeptideMatch*)));
//connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar()));
#endif
......@@ -61,6 +62,13 @@ void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identif
updateDisplay();
}
void ProteinWindow::doPeptideMatchSelected(PeptideMatch * peptide_match) {
if (_p_protein_match != nullptr) {
ui->sequenceTextEdit->setText(_p_protein_match->getHtmlSequence(peptide_match));
}
}
void ProteinWindow::updateDisplay() {
try {
ui->validCheckBox->setCheckState(Qt::Unchecked);
......
......@@ -45,6 +45,7 @@ public:
public slots:
void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group);
void doPeptideMatchSelected(PeptideMatch * peptide_match);
protected :
void updateDisplay();
......
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