Commit fdb5f500 authored by Edlira Nano's avatar Edlira Nano
Browse files

debug Ludo

git-svn-id: https://subversion.renater.fr/masschroq/trunk@2098 e4b6dbb4-9209-464b-83f7-6257456c460c
parent 1694ccba
...@@ -74,34 +74,32 @@ AlignmentMs2::setSharedPeptides(const msRun * p_msrun_ref, ...@@ -74,34 +74,32 @@ AlignmentMs2::setSharedPeptides(const msRun * p_msrun_ref,
// _ms2_tendency_halfwindow or the _ms2_smoothing_halfwindow // _ms2_tendency_halfwindow or the _ms2_smoothing_halfwindow
// in which case alignment is impossible // in which case alignment is impossible
bool bool
AlignmentMs2::isAlignmentPossible(QString p_msrunId) { AlignmentMs2::isAlignmentPossible(const QString p_msrunId,
const unsigned int map_size) {
unsigned int shared_pep_list_size = _shared_peptide_list.size();
unsigned int tendency_window_size = 1 + 2 * _ms2_tendency_halfwindow; unsigned int tendency_window_size = 1 + 2 * _ms2_tendency_halfwindow;
unsigned int smoothing_window_size = 1 + 2 * _ms2_smoothing_halfwindow; unsigned int smoothing_window_size = 1 + 2 * _ms2_smoothing_halfwindow;
cout << "Aligning MS run '" << p_msrunId.toStdString() cout << "Aligning MS run '" << p_msrunId.toStdString()
<< "' : shared peptides " << shared_pep_list_size << endl; << "' : shared peptides " << map_size << endl;
if (tendency_window_size > shared_pep_list_size) { if (tendency_window_size > map_size) {
cout << "WARNING : MS2 alignment of MS run '" cout << "WARNING : MS2 alignment of MS run '"
<< p_msrunId.toStdString() << p_msrunId.toStdString()
<< "' not possible : \nthe shared peptides number : " << "' not possible : \nthe shared peptides number : "
<< shared_pep_list_size << map_size
<< " is smaller than the ms2 tendency window : " << " is smaller than the ms2 tendency window : "
<< tendency_window_size << endl; << tendency_window_size << endl;
_shared_peptide_list.clear();
return false; return false;
} }
if (smoothing_window_size > shared_pep_list_size ) { if (smoothing_window_size > map_size ) {
cout << "WARNING : MS2 alignment of MS run '" cout << "WARNING : MS2 alignment of MS run '"
<< p_msrunId.toStdString() << p_msrunId.toStdString()
<< "' not possible : \nthe shared peptides number : " << "' not possible : \nthe shared peptides number : "
<< shared_pep_list_size << map_size
<< " is smaller than the ms2 smoothing window : " << " is smaller than the ms2 smoothing window : "
<< smoothing_window_size << endl; << smoothing_window_size << endl;
_shared_peptide_list.clear();
return false; return false;
} }
return true; return true;
...@@ -233,7 +231,7 @@ AlignmentMs2::getOldRtSetForMsrun(const msRun * p_msrun) const { ...@@ -233,7 +231,7 @@ AlignmentMs2::getOldRtSetForMsrun(const msRun * p_msrun) const {
return oldRtSet; return oldRtSet;
} }
/// given a ms-level 1 rt (oldRt), by linear interpolation on the given /// given an ms-level 1 rt (oldRt), by linear interpolation on the given
/// deltaRt points, calculate the best corresponding deltaRt /// deltaRt points, calculate the best corresponding deltaRt
const mcq_double const mcq_double
AlignmentMs2::getDeltaRtForOldRt(mcq_double oldRt, AlignmentMs2::getDeltaRtForOldRt(mcq_double oldRt,
...@@ -479,28 +477,39 @@ AlignmentMs2::privAlignTwoMsRuns(msRun * p_msrun_ref, msRun * p_msrun) { ...@@ -479,28 +477,39 @@ AlignmentMs2::privAlignTwoMsRuns(msRun * p_msrun_ref, msRun * p_msrun) {
// set list of peptides common to both msruns // set list of peptides common to both msruns
setSharedPeptides(p_msrun_ref, p_msrun); setSharedPeptides(p_msrun_ref, p_msrun);
qDebug() << "Ludo debug : shared peptides = " << _shared_peptide_list.size();
// for each shared peptide construct the map :
// bestRt_Ms2(p_msrun) -> deltaRt (= bestRt_Ms2(p_msrun) - bestRt_Ms2(p_msrun_ref))
map<mcq_double, mcq_double> * map_bestRt_deltaRt =
get_map_bestRt_deltaRt(p_msrun_ref, p_msrun);
// test if there are not less shared peptides than the // test if there are not less shared peptides than the
// _ms2_tendency_halfwindow or the _ms2_smoothing_halfwindow // _ms2_tendency_halfwindow or the _ms2_smoothing_halfwindow
// in which case alignment is impossible // in which case alignment is impossible
if ( ! isAlignmentPossible(p_msrun->getXmlId()) ) {
if ( ! isAlignmentPossible(p_msrun->getXmlId(),
map_bestRt_deltaRt->size()) ) {
_shared_peptide_list.clear();
return; return;
} }
// for each shared peptide construct the map :
// bestRt_Ms2(p_msrun) -> deltaRt (= bestRt_Ms2(p_msrun) - bestRt_Ms2(p_msrun_ref))
map<mcq_double, mcq_double> * map_bestRt_deltaRt =
get_map_bestRt_deltaRt(p_msrun_ref, p_msrun);
// the map is already ordered in ascending bestRt order // the map is already ordered in ascending bestRt order
// (otherwise we should have ordered it) // (otherwise we should have ordered it)
// get the corrected set of deltaRt-s by applying a moving median // get the corrected set of deltaRt-s by applying a moving median
// by steps of +-_ms2_tendency_halfwindow on them // by steps of +-_ms2_tendency_halfwindow on them
qDebug() << "Ludo debug : map_bestRt_deltaRt before median on ms2 = " << map_bestRt_deltaRt->size();
map<mcq_double, mcq_double> * corrected_map_bestRt_deltaRt = map<mcq_double, mcq_double> * corrected_map_bestRt_deltaRt =
correct_deltaRt(map_bestRt_deltaRt, _ms2_tendency_halfwindow); correct_deltaRt(map_bestRt_deltaRt, _ms2_tendency_halfwindow);
qDebug() << "Ludo debug : map_bestRT_deltaRt before mean on ms2 = " << corrected_map_bestRt_deltaRt->size();
// smooth the deltaRt-s by applying a mean by steps of // smooth the deltaRt-s by applying a mean by steps of
// +-_ms2_smoothing_halfwindow on them // +-_ms2_smoothing_halfwindow on them
map<mcq_double, mcq_double> * corrected_mean_map_bestRt_deltaRt = map<mcq_double, mcq_double> * corrected_mean_map_bestRt_deltaRt =
......
...@@ -84,7 +84,8 @@ class AlignmentMs2 : public AlignmentBase { ...@@ -84,7 +84,8 @@ class AlignmentMs2 : public AlignmentBase {
void setSharedPeptides(const msRun * p_msrun_ref, const msRun * p_msrun); void setSharedPeptides(const msRun * p_msrun_ref, const msRun * p_msrun);
bool isAlignmentPossible(QString p_msrunId); bool isAlignmentPossible(const QString p_msrunId,
const unsigned int map_size);
map<mcq_double, mcq_double> * get_map_bestRt_deltaRt(const msRun * p_msrun_ref, map<mcq_double, mcq_double> * get_map_bestRt_deltaRt(const msRun * p_msrun_ref,
const msRun * p_msrun) const; const msRun * p_msrun) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment