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 73 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  m_sampleName = QFileInfo(file_name).baseName();
47 }

References m_sampleName.

◆ MsRunId() [3/4]

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

Definition at line 50 of file msrunid.cpp.

51  : MsRunId(file_name)
52 {
53  m_runId = run_id;
54 }

References m_runId.

◆ MsRunId() [4/4]

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

Definition at line 57 of file msrunid.cpp.

58  : m_fileName(other.m_fileName),
59  m_runId(other.m_runId),
60  m_xmlId(other.m_xmlId),
61  m_sampleName(other.m_sampleName),
62  m_mzFormat(other.m_mzFormat)
63 {
64 }

◆ ~MsRunId()

pappso::MsRunId::~MsRunId ( )
virtual

Definition at line 67 of file msrunid.cpp.

68 {
69 }

Member Function Documentation

◆ getFileName()

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

Definition at line 145 of file msrunid.cpp.

146 {
147  return m_fileName;
148 }

References m_fileName.

◆ getMzFormat()

MzFormat pappso::MsRunId::getMzFormat ( ) const

Definition at line 159 of file msrunid.cpp.

160 {
161  return m_mzFormat;
162 }

References m_mzFormat.

◆ getRunId()

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

Definition at line 124 of file msrunid.cpp.

125 {
126  return m_runId;
127 }

References m_runId.

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

◆ getSampleName()

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

Definition at line 80 of file msrunid.cpp.

81 {
82  return m_sampleName;
83 }

References m_sampleName.

◆ getXmlId()

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

Definition at line 138 of file msrunid.cpp.

139 {
140  return m_xmlId;
141 }

References m_xmlId.

◆ isValid()

bool pappso::MsRunId::isValid ( ) const

Definition at line 204 of file msrunid.cpp.

205 {
206  return !m_fileName.isEmpty() && !m_runId.isEmpty() && !m_xmlId.isEmpty() &&
208 }

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

◆ operator=()

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

Definition at line 175 of file msrunid.cpp.

176 {
177  m_xmlId = other.m_xmlId;
178  m_fileName = other.m_fileName;
179  m_sampleName = other.m_sampleName;
180  m_mzFormat = other.m_mzFormat;
181 
182  return *this;
183 }

References m_fileName, m_mzFormat, m_sampleName, and m_xmlId.

◆ operator==()

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

Definition at line 166 of file msrunid.cpp.

167 {
168  if(m_xmlId == other.m_xmlId)
169  return true;
170  return false;
171 }

References m_xmlId.

◆ setFileName()

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

Definition at line 87 of file msrunid.cpp.

88 {
89  m_fileName = file_name;
90 
91  QFileInfo file_info(file_name);
92  QString extension = file_info.suffix();
93 
94  if(m_sampleName.isEmpty())
95  {
96  // set sample name by default :
97  m_sampleName = file_info.baseName();
98  }
99 
101 
102  if(extension.toLower() == "mzxml")
103  {
105  }
106  else if(extension.toLower() == "mgf")
107  {
109  }
110  else if(extension.toLower() == "mzml")
111  {
113  }
114 }

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

◆ setMzFormat()

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

Definition at line 152 of file msrunid.cpp.

153 {
154  m_mzFormat = format;
155 }

References m_mzFormat.

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

◆ setRunId()

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

Definition at line 117 of file msrunid.cpp.

118 {
119  m_runId = run_id;
120 }

References m_runId.

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

◆ setSampleName()

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

set a sample name for this MsRunId

Definition at line 73 of file msrunid.cpp.

74 {
75  m_sampleName = name;
76 }

References m_sampleName.

Referenced by pappso::XyMsFileReader::getMsRunIds(), and pappso::PwizMsFileReader::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 131 of file msrunid.cpp.

132 {
133  m_xmlId = xml_id;
134 }

References m_xmlId.

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

◆ toString()

QString pappso::MsRunId::toString ( ) const

Definition at line 187 of file msrunid.cpp.

188 {
189  QString text = QString(
190  "file name: '%1'\n"
191  "run id: '%2'\n"
192  "xml id: '%3'\n"
193  "sample name: '%4'\n")
194  .arg(m_fileName)
195  .arg(m_runId)
196  .arg(m_xmlId)
197  .arg(m_sampleName);
198 
199  return text;
200 }

References m_fileName, m_runId, m_sampleName, and m_xmlId.

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

Member Data Documentation

◆ m_fileName

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

Definition at line 110 of file msrunid.h.

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

◆ m_mzFormat

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

Definition at line 114 of file msrunid.h.

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

◆ m_runId

QString pappso::MsRunId::m_runId
private

Definition at line 111 of file msrunid.h.

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

◆ m_sampleName

QString pappso::MsRunId::m_sampleName
private

Definition at line 113 of file msrunid.h.

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

◆ m_xmlId

QString pappso::MsRunId::m_xmlId
private

Definition at line 112 of file msrunid.h.

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


The documentation for this class was generated from the following files:
pappso::MsRunId::MsRunId
MsRunId()
Definition: msrunid.cpp:38
pappso::MsRunId::m_mzFormat
MzFormat m_mzFormat
Definition: msrunid.h:114
pappso::MsRunId::m_runId
QString m_runId
Definition: msrunid.h:111
pappso::MzFormat::unknown
@ unknown
unknown format
pappso::MzFormat::mzXML
@ mzXML
mzXML
pappso::MsRunId::m_sampleName
QString m_sampleName
Definition: msrunid.h:113
pappso::MsRunId::m_xmlId
QString m_xmlId
Definition: msrunid.h:112
pappso::MsRunId::m_fileName
QString m_fileName
Definition: msrunid.h:110
pappso::MzFormat::mzML
@ mzML
mzML
pappso::MzFormat::MGF
@ MGF
Mascot format.