libpappsomspp
Library for mass spectrometry
timsdirectxicextractor.cpp
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/vendors/tims/xicextractor/timsdirectxicextractor.cpp
3  * \date 21/09/2019
4  * \author Olivier Langella
5  * \brief minimum functions to extract XICs from Tims Data
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of the PAPPSOms++ library.
12  *
13  * PAPPSOms++ is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms++ is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25  *
26  ******************************************************************************/
27 
28 #include "timsdirectxicextractor.h"
29 
30 using namespace pappso;
31 
33  : pappso::TimsXicExtractorInterface(mp_tims_data)
34 {
35 }
36 
38 {
39 }
40 
41 
42 void
44  std::vector<TimsXicStructure> &timsXicList, double rtRange) const
45 {
46  if(timsXicList.size() == 0)
47  return;
48  std::sort(timsXicList.begin(),
49  timsXicList.end(),
50  [](const TimsXicStructure &a, const TimsXicStructure &b) {
51  return a.rtTarget < b.rtTarget;
52  });
53 
54  std::vector<std::size_t> tims_frameid_list =
55  mp_timsData->getTimsMS1FrameIdRange(timsXicList[0].rtTarget - rtRange,
56  timsXicList.back().rtTarget + rtRange);
57 
58  std::vector<TimsXicStructure>::iterator itXicListbegin = timsXicList.begin();
59  std::vector<TimsXicStructure>::iterator itXicListend = timsXicList.begin();
60 
61  for(std::size_t frame_id : tims_frameid_list)
62  {
63  TimsFrameCstSPtr frame_sptr = mp_timsData->getTimsFrameCstSPtr(frame_id);
64  double rt = frame_sptr.get()->getTime();
65  while((itXicListbegin != timsXicList.end()) &&
66  ((itXicListbegin->rtTarget - rtRange) < rt))
67  {
68  itXicListbegin++;
69  }
70  while((itXicListend != timsXicList.end()) &&
71  (rt < (itXicListend->rtTarget + rtRange)))
72  {
73  itXicListend++;
74  }
75  frame_sptr.get()->extractTimsXicListInRtRange(
76  itXicListbegin, itXicListend, m_xicExtractMethod);
77  }
78 }
timsdirectxicextractor.h
minimum functions to extract XICs from Tims Data
pappso::TimsData::getTimsMS1FrameIdRange
std::vector< std::size_t > getTimsMS1FrameIdRange(double rt_begin, double rt_end) const
Definition: timsdata.cpp:403
pappso::TimsXicExtractorInterface
Definition: timsxicextractorinterface.h:60
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::PeptideIonNter::a
@ a
pappso::DataKind::rt
@ rt
Retention time.
pappso::TimsDirectXicExtractor::extractTimsXicList
virtual void extractTimsXicList(std::vector< TimsXicStructure > &timsXicList, double rtRange) const override
extract XICs for given coordinates XICs are extracted given their coordinates : retention time target...
Definition: timsdirectxicextractor.cpp:43
pappso::TimsData
Definition: timsdata.h:88
pappso::TimsXicExtractorInterface::mp_timsData
const TimsData * mp_timsData
Definition: timsxicextractorinterface.h:102
pappso::TimsXicStructure
structure needed to extract XIC from Tims data
Definition: timsdata.h:66
pappso::TimsData::getTimsFrameCstSPtr
TimsFrameCstSPtr getTimsFrameCstSPtr(std::size_t timsId) const
get a Tims frame with his database ID
Definition: timsdata.cpp:437
pappso::PeptideIonNter::b
@ b
pappso::TimsDirectXicExtractor::TimsDirectXicExtractor
TimsDirectXicExtractor(const TimsData *mp_tims_data)
Definition: timsdirectxicextractor.cpp:32
pappso::TimsXicExtractorInterface::m_xicExtractMethod
XicExtractMethod m_xicExtractMethod
Definition: timsxicextractorinterface.h:103
pappso::TimsDirectXicExtractor::~TimsDirectXicExtractor
virtual ~TimsDirectXicExtractor()
Definition: timsdirectxicextractor.cpp:37
pappso::TimsFrameCstSPtr
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
Definition: timsframe.h:60