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}

Referenced by MsRunId(), MsRunId(), operator=(), and operator==().

◆ 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 MsRunId(), and 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

References MsRunId(), m_fileName, m_mzFormat, m_runId, m_sampleName, and m_xmlId.

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

162{
163 return m_fileName;
164}

References m_fileName.

Referenced by pappso::MzxmlOutput::writeHeader().

◆ getMsDataFormat()

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

Definition at line 175 of file msrunid.cpp.

176{
177 return m_mzFormat;
178}

References m_mzFormat.

◆ getRunId()

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

Definition at line 140 of file msrunid.cpp.

141{
142 return m_runId;
143}

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.

Referenced by pappso::MgfOutput::write().

◆ getXmlId()

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

Definition at line 154 of file msrunid.cpp.

155{
156 return m_xmlId;
157}

References m_xmlId.

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

◆ isValid()

bool pappso::MsRunId::isValid ( ) const

Definition at line 220 of file msrunid.cpp.

221{
222 return !m_fileName.isEmpty() && !m_runId.isEmpty() && !m_xmlId.isEmpty() &&
224}
@ unknown
unknown format
Definition types.h:149

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

◆ operator=()

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

Definition at line 191 of file msrunid.cpp.

192{
193 m_xmlId = other.m_xmlId;
194 m_fileName = other.m_fileName;
195 m_sampleName = other.m_sampleName;
196 m_mzFormat = other.m_mzFormat;
197
198 return *this;
199}

References MsRunId(), m_fileName, m_mzFormat, m_sampleName, and m_xmlId.

◆ operator==()

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

Definition at line 182 of file msrunid.cpp.

183{
184 if(m_xmlId == other.m_xmlId)
185 return true;
186 return false;
187}

References MsRunId(), and 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 else if((extension.toLower() == "mzcbor") || (extension.toLower() == "cbor"))
127 {
129 }
130}
@ MGF
Mascot format.
Definition types.h:152

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

◆ setMsDataFormat()

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

148{
149 m_xmlId = xml_id;
150}

References m_xmlId.

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

◆ toString()

QString pappso::MsRunId::toString ( ) const

Definition at line 203 of file msrunid.cpp.

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

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(), 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 MsRunId(), 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(), 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(), 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 MsRunId(), getXmlId(), isValid(), operator=(), operator==(), setXmlId(), and toString().


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