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

problem with fastafile

parent 03fb73dd
No related branches found
No related tags found
No related merge requests found
Showing
with 243 additions and 43 deletions
......@@ -72,6 +72,7 @@ SET(CPP_FILES
output/masschroqml.cpp
output/ods/odsexport.cpp
output/ods/simplesheet.cpp
utils/fastafilestore.cpp
utils/identificationdatasourcestore.cpp
utils/groupstore.cpp
utils/msrunstore.cpp
......@@ -109,7 +110,7 @@ SET(XTPCPP_SRCS
)
SET (GUI_UIS
./gui/choose_modification_dialog/choose_modification_dialog.uicpp
./gui/choose_modification_dialog/choose_modification_dialog.ui
./gui/edit_label_methods/edit_label_methods.ui
./gui/edit_modifications/edit_modifications.ui
./gui/export_spreadsheet_dialog/export_spreadsheet_dialog.ui
......
......@@ -26,6 +26,8 @@
#include <QFileInfo>
#include "../../utils/readspectrum.h"
FastaFileStore IdentificationDataSource::_fasta_file_store;
IdentificationDataSource::IdentificationDataSource(const QString resource_name)
{
_resource_name = resource_name;
......@@ -82,5 +84,9 @@ pappso::SpectrumSp IdentificationDataSource::getSpectrumSp(unsigned int scan_num
}
void IdentificationDataSource::addFastaFile (FastaFile file) {
_fastafile_list.push_back(file);
_fastafile_list.push_back(IdentificationDataSource::_fasta_file_store.getInstance(file));
}
const std::vector<FastaFileSp> & IdentificationDataSource::getFastaFileList() const {
qDebug()<< "IdentificationDataSource::getFastaFileList begin" << _fastafile_list.size();
return _fastafile_list;
}
......@@ -27,7 +27,7 @@
#include <pappsomspp/spectrum/spectrum.h>
#include <memory>
#include "../msrun.h"
#include "../../files/fastafile.h"
#include "../../utils/fastafilestore.h"
class Project;
......@@ -74,16 +74,19 @@ public:
/** \brief add Fastafile used by the identification engine
*/
void addFastaFile (FastaFile file);
const std::vector<FastaFileSp> & getFastaFileList() const;
protected :
QString _resource_name;
IdentificationEngine _engine = IdentificationEngine::unknown;
private :
//static std::map<QString, pappso::MsRunIdSp> _map_msrunidsp;
static FastaFileStore _fasta_file_store;
QString _version;
MsRunSp _ms_run_sp = nullptr;
std::map<IdentificationEngineParam, QString> _params;
std::vector<FastaFile> _fastafile_list;
std::vector<FastaFileSp> _fastafile_list;
};
#endif // IDENTIFICATIONDATASOURCE_H
......@@ -83,6 +83,7 @@ private :
PeptideStore _peptide_store;
IdentificationDataSourceStore _identification_data_source_store;
MsRunStore _msrun_store;
};
#endif // PROJECT_H
......@@ -26,11 +26,6 @@
FastaFile::FastaFile(const QString & fasta_source) : _fasta_source(fasta_source)
{
}
FastaFile::FastaFile(const QUrl & fasta_source) : _fasta_source(fasta_source)
{
}
FastaFile::FastaFile(const QFileInfo & fasta_source): _fasta_source(fasta_source.absoluteFilePath())
{
......@@ -43,3 +38,16 @@ FastaFile::~FastaFile()
{
}
bool FastaFile::operator<( const FastaFile& other ) const
{
return (_fasta_source.absoluteFilePath() < other._fasta_source.absoluteFilePath());
}
bool FastaFile::operator==( const FastaFile& other ) const
{
return (_fasta_source == other._fasta_source);
}
const QString FastaFile::getFilename() const {
return _fasta_source.fileName();
}
......@@ -24,19 +24,26 @@
#ifndef FASTAFILE_H
#define FASTAFILE_H
#include <QUrl>
#include <QFileInfo>
#include <memory>
class FastaFile;
typedef std::shared_ptr<FastaFile> FastaFileSp;
class FastaFile
{
public:
FastaFile(const QString & fasta_source);
FastaFile(const QUrl & fasta_source);
FastaFile(const QFileInfo & fasta_source);
FastaFile(const FastaFile & other);
~FastaFile();
bool operator<( const FastaFile& other ) const;
bool operator==( const FastaFile& other ) const;
const QString getFilename() const;
private :
const QUrl _fasta_source;
const QFileInfo _fasta_source;
};
......
......@@ -44,7 +44,7 @@ ChooseModificationDialog::ChooseModificationDialog(QWidget * parent):
_p_modification_str_li = new QStandardItemModel();
ui->modification_listview->setModel(_p_modification_str_li);
//param.setFilterCrossSamplePeptideNumber(settings.value("automatic_filter/cross_sample", "true").toBool());
#if QT_VERSION >= 0x050000
// Qt5 code
/*
......@@ -68,27 +68,27 @@ ChooseModificationDialog::~ChooseModificationDialog()
}
void ChooseModificationDialog::setMassRange(const pappso::MassRange & massrange) {
qDebug() << "ChooseModificationDialog::setMassRange " << massrange.toString();
_selected_modification = nullptr;
qDebug() << "ChooseModificationDialog::setMassRange " << massrange.toString();
_selected_modification = nullptr;
_p_modification_str_li->removeRows(0,_p_modification_str_li->rowCount());
pappso::FilterOboPsiModSink term_list;
pappso::OboPsiModHandlerInterface * last_men_standing = &term_list;
pappso::FilterOboPsiModTermDiffMono * p_filter_mass = nullptr;
//FilterOboPsiModTermLabel * p_filter_label = nullptr;
//FilterOboPsiModTermName * p_filter_name = nullptr;
p_filter_mass = new pappso::FilterOboPsiModTermDiffMono(*last_men_standing, massrange);
pappso::OboPsiMod psimodb(*p_filter_mass);
for (pappso::OboPsiModTerm term : term_list.getOboPsiModTermList() ) {
QStandardItem *item;
item = new QStandardItem(QString("[%1] %2").arg(term._accession).arg(term._name));
item->setEditable(false);
_p_modification_str_li->appendRow(item);
item->setData(QVariant(QString("%1").arg(term._accession)),Qt::UserRole);
}
pappso::FilterOboPsiModSink term_list;
pappso::OboPsiModHandlerInterface * last_men_standing = &term_list;
pappso::FilterOboPsiModTermDiffMono * p_filter_mass = nullptr;
//FilterOboPsiModTermLabel * p_filter_label = nullptr;
//FilterOboPsiModTermName * p_filter_name = nullptr;
p_filter_mass = new pappso::FilterOboPsiModTermDiffMono(*last_men_standing, massrange);
pappso::OboPsiMod psimodb(*p_filter_mass);
for (pappso::OboPsiModTerm term : term_list.getOboPsiModTermList() ) {
QStandardItem *item;
item = new QStandardItem(QString("[%1] %2").arg(term._accession).arg(term._name));
item->setEditable(false);
_p_modification_str_li->appendRow(item);
item->setData(QVariant(QString("%1").arg(term._accession)),Qt::UserRole);
}
}
......@@ -108,6 +108,6 @@ void ChooseModificationDialog::ItemClicked (QModelIndex index )
_selected_modification = modification;
}
pappso::AaModificationP ChooseModificationDialog::getSelectedModification()const {
return _selected_modification;
}
pappso::AaModificationP ChooseModificationDialog::getSelectedModification()const {
return _selected_modification;
}
......@@ -20,8 +20,11 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string/>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="identifications">
<attribute name="title">
......@@ -64,6 +67,9 @@
</layout>
</widget>
<widget class="QWidget" name="fdr">
<property name="toolTip">
<string/>
</property>
<attribute name="title">
<string>FDR</string>
</attribute>
......@@ -72,6 +78,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>FDR</string>
</property>
......@@ -85,6 +94,9 @@
</item>
<item row="0" column="1">
<widget class="QLabel" name="peptide_fdr_label">
<property name="toolTip">
<string>FDR is computed using peptides tagged as &quot;decoy&quot; on all valid peptides (check filter parameters)</string>
</property>
<property name="text">
<string>0 %</string>
</property>
......@@ -99,6 +111,9 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="protein_fdr_label">
<property name="toolTip">
<string>FDR is computed using proteins tagged as &quot;decoy&quot; on all valid proteins (check filter parameters)</string>
</property>
<property name="text">
<string>0 %</string>
</property>
......@@ -114,7 +129,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListWidget" name="decoy_database_list_widget"/>
<widget class="QListView" name="decoy_database_listview"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
......@@ -188,6 +203,9 @@
</layout>
</widget>
<widget class="QWidget" name="mass_precision">
<property name="toolTip">
<string/>
</property>
<attribute name="title">
<string>Mass precision</string>
</attribute>
......@@ -250,6 +268,9 @@
</item>
<item row="3" column="1">
<widget class="QLabel" name="mass_precision_sd_label">
<property name="toolTip">
<string>Mass deviation is computed on all valid and checked proteins but not decoy</string>
</property>
<property name="text">
<string>0</string>
</property>
......
......@@ -43,6 +43,9 @@ ProjectWindow::ProjectWindow(MainWindow *parent):
main_window = parent;
ui->setupUi(this);
_p_fasta_str_li = new QStandardItemModel();
ui->decoy_database_listview->setModel(_p_fasta_str_li);
_p_automatic_filter_widget = new AutomaticFilterWidget(this);
ui->filter_parameter_layout->addWidget(_p_automatic_filter_widget);
......@@ -206,7 +209,7 @@ void ProjectWindow::refresh() {
computeFdr(ValidationState::valid);
computeMassPrecision(ValidationState::validAndChecked);
qDebug() << "ProjectWindow::refresh end ";
}
void ProjectWindow::doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters) {
qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged begin ";
......@@ -341,7 +344,20 @@ void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_grou
}
void ProjectWindow::setProjectSp(ProjectSp project_sp) {
_fastafile_list = _project_sp.get()->getIdentificationDataSourceStore().getFastaFileList();
/*
for (FastaFileSp fasta_file : _fastafile_list ) {
QStandardItem *item;
item = new QStandardItem(QString("%1").arg(fasta_file.get()->getFilename()));
item->setEditable(false);
_p_fasta_str_li->appendRow(item);
item->setData(QVariant(QString("%1").arg(fasta_file.get()->getFilename())),Qt::UserRole);
}
*/
for (auto && p_window :_peptide_list_window_collection) {
delete p_window;
}
......@@ -402,9 +418,8 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) {
ui->decoy_protein_regexp_line_edit->setText(_project_sp.get()->getProteinStore().getRegexpDecoy().pattern());
ui->contaminant_protein_regexp_line_edit->setText(_project_sp.get()->getProteinStore().getRegexpContaminant().pattern());
computeFdr(ValidationState::grouped);
computeMassPrecision(ValidationState::validAndChecked);
refresh();
this->setEnabled(true);
}
......
......@@ -25,6 +25,7 @@
#define PROJECTWINDOW_H
#include <QMainWindow>
#include <set>
#include "../../core/project.h"
#include "../edit_label_methods/editlabelmethods.h"
#include "../edit_modifications/editmodifications.h"
......@@ -102,6 +103,9 @@ private:
EditLabelMethods * _p_edit_label_methods = nullptr;
ProjectSp _project_sp;
QStandardItemModel * _p_fasta_str_li;
std::set<FastaFileSp> _fastafile_list;
};
......
/**
* \file utils/fastafiletore.cpp
* \date 22/4/2017
* \author Olivier Langella
* \brief store unique version of fastafile
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "fastafilestore.h"
FastaFileStore::FastaFileStore()
{
}
FastaFileStore::~FastaFileStore()
{
}
FastaFileSp FastaFileStore::getInstance(const FastaFile & location) {
std::map< FastaFile, FastaFileSp >::iterator it = _map_fastafile.find(location);
if (it != _map_fastafile.end()) {
return it->second;
}
else {
FastaFileSp p_xtfile = std::make_shared<FastaFile>(location);
_map_fastafile.insert(std::pair< FastaFile, FastaFileSp >(location, p_xtfile));
return p_xtfile;
}
}
std::vector<FastaFileSp> FastaFileStore::getFastaFileList() const {
std::vector<FastaFileSp> msrun_list;
for (auto & msrun_pair :_map_fastafile) {
msrun_list.push_back(msrun_pair.second);
}
return msrun_list;
}
/**
* \file utils/fastafiletore.h
* \date 22/4/2017
* \author Olivier Langella
* \brief store unique version of fastafile
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef FASTAFILESTORE_H
#define FASTAFILESTORE_H
#include <map>
#include <vector>
#include "../files/fastafile.h"
class FastaFileStore
{
public:
FastaFileStore();
~FastaFileStore();
FastaFileSp getInstance(const FastaFile & fastafile);
std::vector<FastaFileSp> getFastaFileList() const;
private:
std::map<FastaFile, FastaFileSp> _map_fastafile;
};
#endif // FASTAFILESTORE_H
......@@ -43,7 +43,8 @@ IdentificationDataSourceStore::~IdentificationDataSourceStore()
}
IdentificationDataSourceSp IdentificationDataSourceStore::getInstance(const QString & location) {
qDebug() << "IdentificationDataSourceStore::getInstance begin " << location;
qDebug() << " " << _map_identification_data_sources.size();
std::map< QString, IdentificationDataSourceSp >::iterator it = _map_identification_data_sources.find(location);
if (it != _map_identification_data_sources.end()) {
return it->second;
......@@ -62,3 +63,17 @@ IdentificationDataSourceSp IdentificationDataSourceStore::getInstance(const QStr
}
throw pappso::PappsoException(QObject::tr("Identification resource %1 not recognized").arg(location));
}
std::set<FastaFileSp> IdentificationDataSourceStore::getFastaFileList() const {
qDebug()<< "IdentificationDataSourceStore::getFastaFileList begin ";
std::set<FastaFileSp> list_fasta_set;
/*
for (auto pair_ident:_map_identification_data_sources) {
qDebug()<< "IdentificationDataSourceStore::getFastaFileList 1";
std::vector<FastaFileSp> idfastalist = pair_ident.second.get()->getFastaFileList();
list_fasta_set.insert(idfastalist.begin(), idfastalist.end());
}
*/
qDebug()<< "IdentificationDataSourceStore::getFastaFileList end";
return list_fasta_set;
}
......@@ -32,7 +32,9 @@
#define IDENTIFICATIONDATASOURCESTORE_H
#include <map>
#include <set>
#include "../core/identification_sources/identificationdatasource.h"
#include "../files/fastafile.h"
class IdentificationDataSourceStore
{
......@@ -40,6 +42,8 @@ public:
IdentificationDataSourceStore();
~IdentificationDataSourceStore();
IdentificationDataSourceSp getInstance(const QString & location);
std::set<FastaFileSp> getFastaFileList() const;
private :
std::map<QString, IdentificationDataSourceSp> _map_identification_data_sources;
};
......
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