libpappsomspp
Library for mass spectrometry
msrunxicextractorfactory.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/xicextractor/msrunxicextractorfactory.cpp
3 * \date 07/05/2018
4 * \author Olivier Langella
5 * \brief factory to build XIC extractor on an MsRun file
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2018 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 * Contributors:
27 * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
35#include "../vendors/tims/xicextractor/timsdirectxicextractor.h"
36#include "../msrun/private/timsmsrunreaderms2.h"
37
38namespace pappso
39{
40
41
42MsRunXicExtractorFactory MsRunXicExtractorFactory::m_instance =
43 MsRunXicExtractorFactory();
44
45MsRunXicExtractorFactory &
47{
48 return m_instance;
49}
50
51
53{
54}
56{
57}
58
59void
61{
62 m_tmpDirName = dir_name;
63}
64void
67{
68 m_type = type;
69}
70
73 MsRunReaderSPtr &msrun_reader) const
74{
75
76 pappso::TimsMsRunReaderMs2 *tims2_reader =
77 dynamic_cast<pappso::TimsMsRunReaderMs2 *>(msrun_reader.get());
78 if(tims2_reader == nullptr)
79 {
80 // NO TIMS
83 {
84 std::shared_ptr<MsRunXicExtractor> msrun_xic_extractor_sp =
85 std::make_shared<MsRunXicExtractor>(
86 MsRunXicExtractor(msrun_reader));
87 return (msrun_xic_extractor_sp);
88 }
90 {
91
92 std::shared_ptr<MsRunXicExtractorDisk> msrun_xic_extractor_sp =
93 std::make_shared<MsRunXicExtractorDisk>(
94 MsRunXicExtractorDisk(msrun_reader, QDir(m_tmpDirName)));
95
96 msrun_xic_extractor_sp.get()->prepareExtractor();
97 return (msrun_xic_extractor_sp);
98 }
100 {
101
102 std::shared_ptr<MsRunXicExtractorDiskBuffer> msrun_xic_extractor_sp =
103 std::make_shared<MsRunXicExtractorDiskBuffer>(
104 MsRunXicExtractorDiskBuffer(msrun_reader, QDir(m_tmpDirName)));
105 msrun_xic_extractor_sp.get()->prepareExtractor();
106 return (msrun_xic_extractor_sp);
107 }
108 }
109 else
110 {
111 // TIMS
112 std::shared_ptr<TimsDirectXicExtractor> msrun_xic_extractor_sp =
113 std::make_shared<TimsDirectXicExtractor>(msrun_reader);
114 return (msrun_xic_extractor_sp);
115 }
116 return nullptr;
117}
118
119
120} // namespace pappso
MsRunXicExtractorFactoryType m_type
void setTmpDir(const QString &dir_name)
set the temporary working directory
MsRunXicExtractorInterfaceSp buildMsRunXicExtractorSp(MsRunReaderSPtr &msrun_reader) const
build a simple XIC extractor that directly uses Proeowizard library to read and extract XICs building...
static MsRunXicExtractorFactory & getInstance()
singleton to get the only instance of the factory
void setMsRunXicExtractorFactoryType(pappso::MsRunXicExtractorFactoryType type)
sets the xic extractor type
static MsRunXicExtractorFactory m_instance
MsRunReader based XIC extractor featuring disk cache.
proteowizard based XIC extractor featuring disk cache + write buffer
factory to build XIC extractor on an MsRun file
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition: msrunreader.h:184
std::shared_ptr< MsRunXicExtractorInterface > MsRunXicExtractorInterfaceSp