Mass++ mzML IO Plugin v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
kome::io::mzml::MzmlSample Class Reference

mzML sample class More...

#include <MzmlSample.h>

Inheritance diagram for kome::io::mzml::MzmlSample:
Inheritance graph
[legend]
Collaboration diagram for kome::io::mzml::MzmlSample:
Collaboration graph
[legend]

Classes

struct  ArrayInfo
 

Public Member Functions

 MzmlSample (MzmlSampleSet *sampleSet)
 constructor More...
 
virtual ~MzmlSample ()
 destructor
 
MzmlSampleSetgetMzmlSampleSet ()
 gets mzML sample set object More...
 
void addParentFile (const char *path)
 adds parent files More...
 
unsigned int getNumberOfParentFiles ()
 gets the number of parent files More...
 
const char * getParentFilePath (const unsigned int index)
 gets parent file path More...
 
void addArrayInfo (const char *name, const int bits, const bool compressed, const double scale, const bool isY)
 adds array information More...
 
ArrayInfogetArrayInfo (const char *name)
 gets array information More...
 

Public Attributes

MzmlSampleSetm_sampleSet
 
std::vector< std::string > m_parentFiles
 

Protected Member Functions

virtual bool onOpenSample (kome::objects::DataGroupNode *rootGroup, kome::core::Progress *progress=NULL)
 This method is called by openTreatment method. (override method) More...
 
virtual bool onCloseSample ()
 This method is called by closeTreatment method. (override method) More...
 

Protected Attributes

std::vector< ArrayInfom_arrayInfo
 

Detailed Description

mzML sample class

Definition at line 26 of file MzmlSample.h.

Constructor & Destructor Documentation

kome::io::mzml::MzmlSample::MzmlSample ( MzmlSampleSet sampleSet)

constructor

Parameters
sampleSetsample set object

Definition at line 31 of file MzmlSample.cpp.

31  : kome::objects::Sample( sampleSet ) {
32  // initialize
33  m_sampleSet = sampleSet;
34 
35  setParallelReadable( true );
36 }
MzmlSampleSet * m_sampleSet
Definition: MzmlSample.h:43

Member Function Documentation

void kome::io::mzml::MzmlSample::addArrayInfo ( const char *  name,
const int  bits,
const bool  compressed,
const double  scale,
const bool  isY 
)

adds array information

Parameters
namearray information name
bitsdata size of element
compressedif true, the array data is compressed
scaleunit size scale
isYif true, the array data is y coordinate values

Definition at line 83 of file MzmlSample.cpp.

89  {
90  // check the name
91  if( name == NULL ) {
92  return;
93  }
94 
95  // get array information
96  ArrayInfo* info = getArrayInfo( name );
97  if( info == NULL ) {
98  m_arrayInfo.resize( m_arrayInfo.size() + 1 );
99  info = &( m_arrayInfo.back() );
100  }
101 
102  // set values
103  info->name = name;
104  info->bits = bits;
105  info->compressed = compressed;
106  info->scale = scale;
107  info->isY = isY;
108 }
std::vector< ArrayInfo > m_arrayInfo
Definition: MzmlSample.h:63
ArrayInfo * getArrayInfo(const char *name)
gets array information
Definition: MzmlSample.cpp:111

Here is the call graph for this function:

void kome::io::mzml::MzmlSample::addParentFile ( const char *  path)

adds parent files

Parameters
pathparent file path

Definition at line 43 of file MzmlSample.cpp.

43  {
44  // string object
45  std::string p = NVL( path, "" );
46 
47  // check
48  for( unsigned int i = 0; i < m_parentFiles.size(); i++ ) {
49  if( p.compare( m_parentFiles[ i ] ) == 0 ) {
50  return;
51  }
52  }
53 
54  // property
55  kome::core::Properties& props = getRootDataGroupNode()->getProperties();
56 
57  std::string key = FMT( "Parent File %d", m_parentFiles.size() );
58  props.setValue( key.c_str(), p.c_str() );
59 
60  // add
61  m_parentFiles.push_back( p );
62 }
std::vector< std::string > m_parentFiles
Definition: MzmlSample.h:46
ArrayInfo * kome::io::mzml::MzmlSample::getArrayInfo ( const char *  name)

gets array information

Parameters
namearray information name
Returns
array information (If NULL, specified name is not found.)

Definition at line 111 of file MzmlSample.cpp.

111  {
112  // check the name
113  if( name == NULL ) {
114  return NULL;
115  }
116 
117  // search
118  ArrayInfo* info = NULL;
119  for( unsigned int i = 0; i < m_arrayInfo.size() && info == NULL; i++ ) {
120  ArrayInfo* tmp = &( m_arrayInfo[ i ] );
121  if( tmp->name.compare( name ) == 0 ) {
122  info = tmp;
123  }
124  }
125 
126  return info;
127 }
std::vector< ArrayInfo > m_arrayInfo
Definition: MzmlSample.h:63
MzmlSampleSet * kome::io::mzml::MzmlSample::getMzmlSampleSet ( )

gets mzML sample set object

Returns
mzML sample set object

Definition at line 65 of file MzmlSample.cpp.

65  {
66  return m_sampleSet;
67 }
MzmlSampleSet * m_sampleSet
Definition: MzmlSample.h:43
unsigned int kome::io::mzml::MzmlSample::getNumberOfParentFiles ( )

gets the number of parent files

Returns
the number of parent files

Definition at line 70 of file MzmlSample.cpp.

70  {
71  return m_parentFiles.size();
72 }
std::vector< std::string > m_parentFiles
Definition: MzmlSample.h:46
const char * kome::io::mzml::MzmlSample::getParentFilePath ( const unsigned int  index)

gets parent file path

Parameters
indexparent file index
Returns
parent file path (If the index is illegal, this method returns NULL.)

Definition at line 75 of file MzmlSample.cpp.

75  {
76  if( index >= m_parentFiles.size() ) {
77  return NULL;
78  }
79  return m_parentFiles[ index ].c_str();
80 }
std::vector< std::string > m_parentFiles
Definition: MzmlSample.h:46
bool kome::io::mzml::MzmlSample::onCloseSample ( )
protectedvirtual

This method is called by closeTreatment method. (override method)

Returns
If true, it succeeded to close this sample.

Definition at line 139 of file MzmlSample.cpp.

139  {
140  return true;
141 }
bool kome::io::mzml::MzmlSample::onOpenSample ( kome::objects::DataGroupNode *  rootGroup,
kome::core::Progress *  progress = NULL 
)
protectedvirtual

This method is called by openTreatment method. (override method)

Parameters
rootGrouproot spectrum group
Returns
If true, it succeeded to open this sample.

Definition at line 130 of file MzmlSample.cpp.

130  {
131  // handler
132  MzmlHandler handler( *this );
133  handler.parse( m_sampleSet->getFilePath() );
134 
135  return !handler.isError();
136 }
MzmlSampleSet * m_sampleSet
Definition: MzmlSample.h:43
XML handler class to read mzML file.
Definition: MzmlHandler.h:33

Member Data Documentation

std::vector< ArrayInfo > kome::io::mzml::MzmlSample::m_arrayInfo
protected

array information

Definition at line 63 of file MzmlSample.h.

std::vector< std::string > kome::io::mzml::MzmlSample::m_parentFiles

parent files

Definition at line 46 of file MzmlSample.h.

MzmlSampleSet* kome::io::mzml::MzmlSample::m_sampleSet

sample set

Definition at line 43 of file MzmlSample.h.


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