libpappsomspp
Library for mass spectrometry
pappso::MsRunId Class Reference

MS run identity MsRunId identifies an MS run with a unique ID (XmlId) and contains eventually informations on its location (local disk path or URL) More...

#include <msrunid.h>

Public Member Functions

 MsRunId ()
 
 MsRunId (const QString &file_name)
 
 MsRunId (const QString &file_name, const QString &run_id)
 
 MsRunId (const MsRunId &other)
 
virtual ~MsRunId ()
 
bool operator== (const MsRunId &other) const
 
MsRunIdoperator= (const MsRunId &other)
 
void setFileName (const QString &file_name)
 
const QString & getFileName () const
 
void setRunId (const QString &run_id)
 
const QString & getRunId () const
 
void setXmlId (const QString &xml_id)
 set an XML unique identifier for this MsRunId More...
 
const QString & getXmlId () const
 
void setSampleName (const QString &name)
 set a sample name for this MsRunId More...
 
const QString & getSampleName () const
 
void setMzFormat (MzFormat format)
 
MzFormat getMzFormat () const
 
QString toString () const
 
bool isValid () const
 

Private Attributes

QString m_fileName = "NOT_SET"
 
QString m_runId
 
QString m_xmlId
 
QString m_sampleName
 
MzFormat m_mzFormat = MzFormat::mzXML
 

Detailed Description

MS run identity MsRunId identifies an MS run with a unique ID (XmlId) and contains eventually informations on its location (local disk path or URL)

Definition at line 53 of file msrunid.h.

Constructor & Destructor Documentation

◆ MsRunId() [1/4]

pappso::MsRunId::MsRunId ( )

Definition at line 39 of file msrunid.cpp.

40{
41}

◆ MsRunId() [2/4]

pappso::MsRunId::MsRunId ( const QString &  file_name)

Definition at line 44 of file msrunid.cpp.

44 : m_fileName(file_name)
45{
46 // by default, the sample name is given by the file name
47 QFileInfo fileinfo(m_fileName);
48 if(fileinfo.fileName() == "analysis.tdf")
49 {
50 m_fileName = fileinfo.absoluteDir().absolutePath();
51 }
52 m_sampleName = QFileInfo(m_fileName).baseName();
53}
QString m_sampleName
Definition: msrunid.h:93
QString m_fileName
Definition: msrunid.h:90

References m_fileName, and m_sampleName.

◆ MsRunId() [3/4]

pappso::MsRunId::MsRunId ( const QString &  file_name,
const QString &  run_id 
)

Definition at line 56 of file msrunid.cpp.

57 : MsRunId(file_name)
58{
59 m_runId = run_id;
60}
QString m_runId
Definition: msrunid.h:91

References m_runId.

◆ MsRunId() [4/4]

pappso::MsRunId::MsRunId ( const MsRunId other)

Definition at line 63 of file msrunid.cpp.

64 : m_fileName(other.m_fileName),
65 m_runId(other.m_runId),
66 m_xmlId(other.m_xmlId),
67 m_sampleName(other.m_sampleName),
68 m_mzFormat(other.m_mzFormat)
69{
70}
MzFormat m_mzFormat
Definition: msrunid.h:94
QString m_xmlId
Definition: msrunid.h:92

◆ ~MsRunId()

pappso::MsRunId::~MsRunId ( )
virtual

Definition at line 73 of file msrunid.cpp.

74{
75}

Member Function Documentation

◆ getFileName()

const QString & pappso::MsRunId::getFileName ( ) const

Definition at line 151 of file msrunid.cpp.

152{
153 return m_fileName;
154}

References m_fileName.

◆ getMzFormat()

MzFormat pappso::MsRunId::getMzFormat ( ) const

Definition at line 165 of file msrunid.cpp.

166{
167 return m_mzFormat;
168}

References m_mzFormat.

◆ getRunId()

const QString & pappso::MsRunId::getRunId ( ) const

Definition at line 130 of file msrunid.cpp.

131{
132 return m_runId;
133}

References m_runId.

Referenced by pappso::XyMsFileReader::getMsRunIds().

◆ getSampleName()

const QString & pappso::MsRunId::getSampleName ( ) const

Definition at line 86 of file msrunid.cpp.

87{
88 return m_sampleName;
89}

References m_sampleName.

◆ getXmlId()

const QString & pappso::MsRunId::getXmlId ( ) const

Definition at line 144 of file msrunid.cpp.

145{
146 return m_xmlId;
147}

References m_xmlId.

Referenced by pappso::IonMobilityGrid::storeObservedIdentityBetween(), and pappso::IonMobilityGrid::translateXicCoordFromTo().

◆ isValid()

bool pappso::MsRunId::isValid ( ) const

Definition at line 210 of file msrunid.cpp.

211{
212 return !m_fileName.isEmpty() && !m_runId.isEmpty() && !m_xmlId.isEmpty() &&
214}
@ unknown
unknown format

References m_fileName, m_mzFormat, m_runId, m_xmlId, and pappso::unknown.

◆ operator=()

MsRunId & pappso::MsRunId::operator= ( const MsRunId other)

Definition at line 181 of file msrunid.cpp.

182{
183 m_xmlId = other.m_xmlId;
184 m_fileName = other.m_fileName;
185 m_sampleName = other.m_sampleName;
186 m_mzFormat = other.m_mzFormat;
187
188 return *this;
189}

References m_fileName, m_mzFormat, m_sampleName, and m_xmlId.

◆ operator==()

bool pappso::MsRunId::operator== ( const MsRunId other) const

Definition at line 172 of file msrunid.cpp.

173{
174 if(m_xmlId == other.m_xmlId)
175 return true;
176 return false;
177}

References m_xmlId.

◆ setFileName()

void pappso::MsRunId::setFileName ( const QString &  file_name)

Definition at line 93 of file msrunid.cpp.

94{
95 m_fileName = file_name;
96
97 QFileInfo file_info(file_name);
98 QString extension = file_info.suffix();
99
100 if(m_sampleName.isEmpty())
101 {
102 // set sample name by default :
103 m_sampleName = file_info.baseName();
104 }
105
107
108 if(extension.toLower() == "mzxml")
109 {
111 }
112 else if(extension.toLower() == "mgf")
113 {
115 }
116 else if(extension.toLower() == "mzml")
117 {
119 }
120}
@ MGF
Mascot format.

References m_fileName, m_mzFormat, m_sampleName, pappso::MGF, pappso::mzML, pappso::mzXML, and pappso::unknown.

◆ setMzFormat()

void pappso::MsRunId::setMzFormat ( MzFormat  format)

◆ setRunId()

void pappso::MsRunId::setRunId ( const QString &  run_id)

Definition at line 123 of file msrunid.cpp.

124{
125 m_runId = run_id;
126}

References m_runId.

Referenced by pappso::TimsMsFileReader::getMsRunIds(), and pappso::XyMsFileReader::getMsRunIds().

◆ setSampleName()

void pappso::MsRunId::setSampleName ( const QString &  name)

set a sample name for this MsRunId

Definition at line 79 of file msrunid.cpp.

80{
81 m_sampleName = name;
82}

References m_sampleName.

Referenced by pappso::PwizMsFileReader::getMsRunIds(), pappso::TimsMsFileReader::getMsRunIds(), and pappso::XyMsFileReader::getMsRunIds().

◆ setXmlId()

void pappso::MsRunId::setXmlId ( const QString &  xml_id)

set an XML unique identifier for this MsRunId

Parameters
xml_idthis id must respect XML constraints (no space characters)

Definition at line 137 of file msrunid.cpp.

138{
139 m_xmlId = xml_id;
140}

References m_xmlId.

Referenced by pappso::PwizMsFileReader::getMsRunIds(), pappso::TimsMsFileReader::getMsRunIds(), pappso::XyMsFileReader::getMsRunIds(), and pappso::MsFileAccessor::getMsRunReaderSPtrByRunId().

◆ toString()

QString pappso::MsRunId::toString ( ) const

Definition at line 193 of file msrunid.cpp.

194{
195 QString text = QString(
196 "file name: '%1'\n"
197 "run id: '%2'\n"
198 "xml id: '%3'\n"
199 "sample name: '%4'\n")
200 .arg(m_fileName)
201 .arg(m_runId)
202 .arg(m_xmlId)
203 .arg(m_sampleName);
204
205 return text;
206}

References m_fileName, m_runId, m_sampleName, and m_xmlId.

Referenced by pappso::TimsMsFileReader::getMsRunIds().

Member Data Documentation

◆ m_fileName

QString pappso::MsRunId::m_fileName = "NOT_SET"
private

Definition at line 90 of file msrunid.h.

Referenced by MsRunId(), getFileName(), isValid(), operator=(), setFileName(), and toString().

◆ m_mzFormat

MzFormat pappso::MsRunId::m_mzFormat = MzFormat::mzXML
private

Definition at line 94 of file msrunid.h.

Referenced by getMzFormat(), isValid(), operator=(), setFileName(), and setMzFormat().

◆ m_runId

QString pappso::MsRunId::m_runId
private

Definition at line 91 of file msrunid.h.

Referenced by MsRunId(), getRunId(), isValid(), setRunId(), and toString().

◆ m_sampleName

QString pappso::MsRunId::m_sampleName
private

Definition at line 93 of file msrunid.h.

Referenced by MsRunId(), getSampleName(), operator=(), setFileName(), setSampleName(), and toString().

◆ m_xmlId

QString pappso::MsRunId::m_xmlId
private

Definition at line 92 of file msrunid.h.

Referenced by getXmlId(), isValid(), operator=(), operator==(), setXmlId(), and toString().


The documentation for this class was generated from the following files: