libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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
 
const QString & getXmlId () const
 
void setSampleName (const QString &name)
 set a sample name for this MsRunId
 
const QString & getSampleName () const
 
void setMsDataFormat (Enums::MsDataFormat format)
 
Enums::MsDataFormat getMsDataFormat () const
 
QString toString () const
 
bool isValid () const
 

Private Attributes

QString m_fileName = "NOT_SET"
 
QString m_runId
 
QString m_xmlId
 
QString m_sampleName
 
Enums::MsDataFormat m_mzFormat = Enums::MsDataFormat::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 38 of file msrunid.cpp.

39{
40}

◆ MsRunId() [2/4]

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

Definition at line 43 of file msrunid.cpp.

43 : m_fileName(file_name)
44{
45 // by default, the sample name is given by the file name
46 QFileInfo fileinfo(m_fileName);
47 if(fileinfo.fileName() == "analysis.tdf")
48 {
49 m_fileName = fileinfo.absoluteDir().absolutePath();
50 }
51 m_sampleName = QFileInfo(m_fileName).baseName();
52}
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 55 of file msrunid.cpp.

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

References m_runId.

◆ MsRunId() [4/4]

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

Definition at line 61 of file msrunid.cpp.

62 : m_fileName(other.m_fileName),
63 m_runId(other.m_runId),
64 m_xmlId(other.m_xmlId),
65 m_sampleName(other.m_sampleName),
66 m_mzFormat(other.m_mzFormat)
67{
68}
QString m_xmlId
Definition msrunid.h:92
Enums::MsDataFormat m_mzFormat
Definition msrunid.h:94

◆ ~MsRunId()

pappso::MsRunId::~MsRunId ( )
virtual

Definition at line 71 of file msrunid.cpp.

72{
73}

Member Function Documentation

◆ getFileName()

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

Definition at line 157 of file msrunid.cpp.

158{
159 return m_fileName;
160}

References m_fileName.

◆ getMsDataFormat()

Enums::MsDataFormat pappso::MsRunId::getMsDataFormat ( ) const

Definition at line 171 of file msrunid.cpp.

172{
173 return m_mzFormat;
174}

References m_mzFormat.

◆ getRunId()

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

Definition at line 136 of file msrunid.cpp.

137{
138 return m_runId;
139}

References m_runId.

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

◆ getSampleName()

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

Definition at line 84 of file msrunid.cpp.

85{
86 return m_sampleName;
87}

References m_sampleName.

◆ getXmlId()

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

Definition at line 150 of file msrunid.cpp.

151{
152 return m_xmlId;
153}

References m_xmlId.

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

◆ isValid()

bool pappso::MsRunId::isValid ( ) const

Definition at line 216 of file msrunid.cpp.

217{
218 return !m_fileName.isEmpty() && !m_runId.isEmpty() && !m_xmlId.isEmpty() &&
220}

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

◆ operator=()

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

Definition at line 187 of file msrunid.cpp.

188{
189 m_xmlId = other.m_xmlId;
190 m_fileName = other.m_fileName;
191 m_sampleName = other.m_sampleName;
192 m_mzFormat = other.m_mzFormat;
193
194 return *this;
195}

References m_fileName, m_mzFormat, m_sampleName, and m_xmlId.

◆ operator==()

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

Definition at line 178 of file msrunid.cpp.

179{
180 if(m_xmlId == other.m_xmlId)
181 return true;
182 return false;
183}

References m_xmlId.

◆ setFileName()

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

Definition at line 91 of file msrunid.cpp.

92{
93
94 QFileInfo fileinfo(file_name);
95 if(fileinfo.fileName() == "analysis.tdf")
96 {
97 m_fileName = fileinfo.absoluteDir().absolutePath();
98 }
99 else
100 {
101 m_fileName = file_name;
102 }
103
104 QString extension = fileinfo.suffix();
105
106 if(m_sampleName.isEmpty())
107 {
108 // set sample name by default :
109 m_sampleName = QFileInfo(m_fileName).baseName();
110 }
111
113
114 if(extension.toLower() == "mzxml")
115 {
117 }
118 else if(extension.toLower() == "mgf")
119 {
121 }
122 else if(extension.toLower() == "mzml")
123 {
125 }
126}

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

◆ setMsDataFormat()

void pappso::MsRunId::setMsDataFormat ( Enums::MsDataFormat  format)

◆ setRunId()

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

◆ setSampleName()

◆ 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 143 of file msrunid.cpp.

144{
145 m_xmlId = xml_id;
146}

References m_xmlId.

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

◆ toString()

QString pappso::MsRunId::toString ( ) const

Definition at line 199 of file msrunid.cpp.

200{
201 QString text = QString(
202 "file name: '%1'\n"
203 "run id: '%2'\n"
204 "xml id: '%3'\n"
205 "sample name: '%4'\n")
206 .arg(m_fileName)
207 .arg(m_runId)
208 .arg(m_xmlId)
209 .arg(m_sampleName);
210
211 return text;
212}

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

Enums::MsDataFormat pappso::MsRunId::m_mzFormat = Enums::MsDataFormat::mzXML
private

Definition at line 94 of file msrunid.h.

Referenced by getMsDataFormat(), isValid(), operator=(), setFileName(), and setMsDataFormat().

◆ 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: