Loading...
Searching...
No Matches
msrunxicextractorfactory.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/xicextractor/msrunxicextractorfactory.cpp
* \date 07/05/2018
* \author Olivier Langella
* \brief factory to build XIC extractor on an MsRun file
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ 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.
*
* PAPPSOms++ 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 PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
*implementation
******************************************************************************/
#include "msrunxicextractorfactory.h"
#include "private/msrunxicextractor.h"
#include "private/msrunxicextractordisk.h"
#include "private/msrunxicextractordiskbuffer.h"
#include "../vendors/tims/xicextractor/timsdirectxicextractor.h"
#include "../msrun/private/timsmsrunreaderms2.h"
namespace pappso
{
MsRunXicExtractorFactory MsRunXicExtractorFactory::m_instance =
MsRunXicExtractorFactory();
MsRunXicExtractorFactory &
MsRunXicExtractorFactory::getInstance()
{
return m_instance;
}
MsRunXicExtractorFactory::MsRunXicExtractorFactory()
{
}
MsRunXicExtractorFactory::~MsRunXicExtractorFactory()
{
}
void
MsRunXicExtractorFactory::setTmpDir(const QString &dir_name)
{
m_tmpDirName = dir_name;
}
void
MsRunXicExtractorFactory::setMsRunXicExtractorFactoryType(
pappso::MsRunXicExtractorFactoryType type)
{
m_type = type;
}
MsRunXicExtractorInterfaceSp
MsRunXicExtractorFactory::buildMsRunXicExtractorSp(
MsRunReaderSPtr &msrun_reader) const
{
pappso::TimsMsRunReaderMs2 *tims2_reader =
dynamic_cast<pappso::TimsMsRunReaderMs2 *>(msrun_reader.get());
if(tims2_reader == nullptr)
{
// NO TIMS
if((m_type == MsRunXicExtractorFactoryType::nose) ||
(m_type == MsRunXicExtractorFactoryType::direct))
{
std::shared_ptr<MsRunXicExtractor> msrun_xic_extractor_sp =
std::make_shared<MsRunXicExtractor>(
MsRunXicExtractor(msrun_reader));
return (msrun_xic_extractor_sp);
}
else if(m_type == MsRunXicExtractorFactoryType::disk)
{
std::shared_ptr<MsRunXicExtractorDisk> msrun_xic_extractor_sp =
std::make_shared<MsRunXicExtractorDisk>(
MsRunXicExtractorDisk(msrun_reader, QDir(m_tmpDirName)));
msrun_xic_extractor_sp.get()->prepareExtractor();
return (msrun_xic_extractor_sp);
}
else if(m_type == MsRunXicExtractorFactoryType::diskbuffer)
{
std::shared_ptr<MsRunXicExtractorDiskBuffer> msrun_xic_extractor_sp =
std::make_shared<MsRunXicExtractorDiskBuffer>(
MsRunXicExtractorDiskBuffer(msrun_reader, QDir(m_tmpDirName)));
msrun_xic_extractor_sp.get()->prepareExtractor();
return (msrun_xic_extractor_sp);
}
}
else
{
// TIMS
std::shared_ptr<TimsDirectXicExtractor> msrun_xic_extractor_sp =
std::make_shared<TimsDirectXicExtractor>(msrun_reader);
return (msrun_xic_extractor_sp);
}
return nullptr;
}
} // namespace pappso
pappso::MsRunXicExtractorDiskBuffer
Definition msrunxicextractordiskbuffer.h:44
pappso::MsRunXicExtractorDisk
Definition msrunxicextractordisk.h:45
pappso::MsRunXicExtractorFactory::m_type
MsRunXicExtractorFactoryType m_type
Definition msrunxicextractorfactory.h:99
pappso::MsRunXicExtractorFactory::setTmpDir
void setTmpDir(const QString &dir_name)
set the temporary working directory
Definition msrunxicextractorfactory.cpp:60
pappso::MsRunXicExtractorFactory::MsRunXicExtractorFactory
MsRunXicExtractorFactory()
Definition msrunxicextractorfactory.cpp:52
pappso::MsRunXicExtractorFactory::~MsRunXicExtractorFactory
virtual ~MsRunXicExtractorFactory()
Definition msrunxicextractorfactory.cpp:55
pappso::MsRunXicExtractorFactory::buildMsRunXicExtractorSp
MsRunXicExtractorInterfaceSp buildMsRunXicExtractorSp(MsRunReaderSPtr &msrun_reader) const
build a simple XIC extractor that directly uses Proeowizard library to read and extract XICs building...
Definition msrunxicextractorfactory.cpp:72
pappso::MsRunXicExtractorFactory::getInstance
static MsRunXicExtractorFactory & getInstance()
singleton to get the only instance of the factory
Definition msrunxicextractorfactory.cpp:46
pappso::MsRunXicExtractorFactory::m_tmpDirName
QString m_tmpDirName
Definition msrunxicextractorfactory.h:98
pappso::MsRunXicExtractorFactory::setMsRunXicExtractorFactoryType
void setMsRunXicExtractorFactoryType(pappso::MsRunXicExtractorFactoryType type)
sets the xic extractor type
Definition msrunxicextractorfactory.cpp:65
pappso::MsRunXicExtractorFactory::m_instance
static MsRunXicExtractorFactory m_instance
Definition msrunxicextractorfactory.h:97
pappso::MsRunXicExtractor
Definition msrunxicextractor.h:42
pappso::TimsMsRunReaderMs2
Definition timsmsrunreaderms2.h:39
msrunxicextractor.h
msrunxicextractordisk.h
MsRunReader based XIC extractor featuring disk cache.
msrunxicextractordiskbuffer.h
proteowizard based XIC extractor featuring disk cache + write buffer
msrunxicextractorfactory.h
factory to build XIC extractor on an MsRun file
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MsRunReaderSPtr
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition msrunreader.h:56
pappso::MsRunXicExtractorFactoryType
MsRunXicExtractorFactoryType
Definition msrunxicextractorfactory.h:46
pappso::MsRunXicExtractorFactoryType::diskbuffer
@ diskbuffer
pappso::MsRunXicExtractorFactoryType::nose
@ nose
default factory
pappso::MsRunXicExtractorFactoryType::disk
@ disk
pappso::MsRunXicExtractorFactoryType::direct
@ direct
pappso::MsRunXicExtractorInterfaceSp
std::shared_ptr< MsRunXicExtractorInterface > MsRunXicExtractorInterfaceSp
Definition msrunxicextractorinterface.h:46