mzml sample spectrum class
More...
#include <MzmlSpectrum.h>
|
| void | parse (xercesc::SAX2XMLReader *parser) |
| | parse XML data More...
|
| |
| virtual void | onGetXYData (kome::core::XYData *const xyData, const double minX, const double maxX) |
| | This method is called by getXYData method. (override method) More...
|
| |
| virtual void | onGetXRange (double *minX, double *maxX) |
| | This method is called by getMinX or getMaxX method. (override method) More...
|
| |
| virtual double | onGetTotalIntensity (const double minX, const double maxX) |
| | This method is called by getTotalIntensity method. (override method) More...
|
| |
| virtual double | onGetMaxIntensity (const double minX, const double maxX) |
| | This method is called by getMaxIntensity method. (override method) More...
|
| |
|
virtual void | onSetRequestLoadData (void) |
| | This method is called by setRequestLoadData method. (abstract method)
|
| |
|
virtual void | onResetRequestLoadData (void) |
| | This method is called by resetRequestLoadData method. (abstract method)
|
| |
| virtual bool | onIsRequestLoadData (void) |
| | This method is called by isRequestLoadData method. (abstract method) More...
|
| |
|
virtual void | onSetFirstAccess (void) |
| | This method is called by setFirstAccess method. (abstract method)
|
| |
|
virtual void | onResetFirstAccess (void) |
| | This method is called by resetFirstAccess method. (abstract method)
|
| |
| virtual bool | onIsFirstAccess (void) |
| | This method is called by isFirstAccess method. (abstract method) More...
|
| |
| virtual bool | onLoadData (void) |
| | This method is called by loadData method. (abstract method) More...
|
| |
mzml sample spectrum class
Definition at line 29 of file MzmlSpectrum.h.
| kome::io::mzml::MzmlSpectrum::MzmlSpectrum |
( |
MzmlSample * |
file, |
|
|
const char * |
name |
|
) |
| |
constructor
- Parameters
-
| file | sample file |
| name | spectrum name |
Definition at line 37 of file MzmlSpectrum.cpp.
38 : kome::objects::Spectrum( file, name ) {
MzmlSample * m_mzmlSample
| long long kome::io::mzml::MzmlSpectrum::getOffset |
( |
| ) |
|
| double kome::io::mzml::MzmlSpectrum::onGetMaxIntensity |
( |
const double |
minX, |
|
|
const double |
maxX |
|
) |
| |
|
protectedvirtual |
This method is called by getMaxIntensity method. (override method)
- Parameters
-
| minX | minimum x of range (If minX is negative number, minimum x value is unbounded.) |
| maxX | maximum x of range (If maxX is negative number, maximum x value is unbounded.) |
- Returns
- max intensity
Definition at line 225 of file MzmlSpectrum.cpp.
227 kome::core::DataPoints pt;
231 double intensity = 0.0;
232 for(
unsigned int i = 0; i < pt.getLength(); i++ ) {
233 double y = pt.getY( i );
234 intensity = MAX( y, intensity );
virtual void onGetXYData(kome::core::XYData *const xyData, const double minX, const double maxX)
This method is called by getXYData method. (override method)
| double kome::io::mzml::MzmlSpectrum::onGetTotalIntensity |
( |
const double |
minX, |
|
|
const double |
maxX |
|
) |
| |
|
protectedvirtual |
This method is called by getTotalIntensity method. (override method)
- Parameters
-
| minX | minimum x of range (If minX is negative number, minimum x value is unbounded.) |
| maxX | maximum x of range (If maxX is negative number, maximum x value is unbounded.) |
- Returns
- total intensity
Definition at line 210 of file MzmlSpectrum.cpp.
212 kome::core::DataPoints pt;
216 double intensity = 0.0;
217 for(
unsigned int i = 0; i < pt.getLength(); i++ ) {
218 intensity += pt.getY( i );
virtual void onGetXYData(kome::core::XYData *const xyData, const double minX, const double maxX)
This method is called by getXYData method. (override method)
| void kome::io::mzml::MzmlSpectrum::onGetXRange |
( |
double * |
minX, |
|
|
double * |
maxX |
|
) |
| |
|
protectedvirtual |
This method is called by getMinX or getMaxX method. (override method)
- Parameters
-
| minX | the pointer to store minimum x value |
| maxX | the pointer to store maximum x value |
Definition at line 195 of file MzmlSpectrum.cpp.
197 kome::core::DataPoints dps;
202 *minX = dps.getMinX();
205 *maxX = dps.getMaxX();
virtual void onGetXYData(kome::core::XYData *const xyData, const double minX, const double maxX)
This method is called by getXYData method. (override method)
| void kome::io::mzml::MzmlSpectrum::onGetXYData |
( |
kome::core::XYData *const |
xyData, |
|
|
const double |
minX, |
|
|
const double |
maxX |
|
) |
| |
|
protectedvirtual |
This method is called by getXYData method. (override method)
- Parameters
-
| xyData | the object to store data points |
| minX | minimum x value. (If minX is negative number, minimum x value is not unbounded.) |
| maxX | maximum x value. (If maxX is negative number, maximum x value is not unbounded.) |
Definition at line 129 of file MzmlSpectrum.cpp.
134 #pragma omp critical ( getMzmlSpectrumData )
137 kome::core::DataPoints pt;
140 xercesc::SAX2XMLReader* parser = kome::xml::XercesTool::getParser( NULL );
141 parser->setFeature( xercesc::XMLUni::fgXercesSchema,
false );
142 parser->setFeature( xercesc::XMLUni::fgXercesSchemaFullChecking,
false );
147 parser->setContentHandler( &handler );
148 parser->setErrorHandler( &handler );
154 catch(
const xercesc::XMLException& e ) {
155 LOG_ERROR( FMT(
"XML Exception: %s", kome::xml::XercesTool::transcode( e.getMessage() ).c_str() ) );
156 handler.setError(
true );
158 catch(
const xercesc::SAXParseException& e ) {
159 LOG_ERROR( FMT(
"SAX Parse Exception: %s", kome::xml::XercesTool::transcode( e.getMessage() ).c_str() ) );
160 handler.setError(
true );
163 LOG_ERROR( FMT(
"Unexpected Exception" ) );
164 handler.setError(
true );
170 startIdx = pt.searchIndex( minX );
172 startIdx = - startIdx - 1;
176 int endIdx = (int)pt.getLength() - 1;
178 endIdx = pt.searchIndex( maxX );
180 endIdx = - endIdx - 2;
184 int num = endIdx - startIdx + 1;
186 xyData->reserve( num );
187 for(
int i = startIdx; i <= endIdx; i++ ) {
188 xyData->addPoint( pt.getX( i ), pt.getY( i ) );
XML data handler to get spectrum data points.
void parse(xercesc::SAX2XMLReader *parser)
parse XML data
MzmlSample * m_mzmlSample
| bool kome::io::mzml::MzmlSpectrum::onIsFirstAccess |
( |
void |
| ) |
|
|
protectedvirtual |
This method is called by isFirstAccess method. (abstract method)
- Returns
- If true, the first accessing.
Definition at line 273 of file MzmlSpectrum.cpp.
275 return kome::objects::Spectrum::onIsFirstAccess( );
| bool kome::io::mzml::MzmlSpectrum::onIsRequestLoadData |
( |
void |
| ) |
|
|
protectedvirtual |
This method is called by isRequestLoadData method. (abstract method)
- Returns
- If true, file read request is valid.
Definition at line 255 of file MzmlSpectrum.cpp.
257 return kome::objects::Spectrum::onIsRequestLoadData( );
| bool kome::io::mzml::MzmlSpectrum::onLoadData |
( |
void |
| ) |
|
|
protectedvirtual |
This method is called by loadData method. (abstract method)
- Returns
- If true, file reading success.
Definition at line 279 of file MzmlSpectrum.cpp.
281 return kome::objects::Spectrum::onLoadData( );
| void kome::io::mzml::MzmlSpectrum::parse |
( |
xercesc::SAX2XMLReader * |
parser | ) |
|
|
protected |
parse XML data
- Parameters
-
Definition at line 58 of file MzmlSpectrum.cpp.
66 FILE* fp = sampleSet->
getFile();
82 int readSize = fread( buff, 1, 1023, fp );
86 buff[ readSize ] =
'\0';
92 szPos = (size_t)tag.find(
"</spectrum>" );
93 if( szPos != (
size_t)tag.npos ) {
97 tag = tag.substr( 0, szPos );
98 tag.append(
"</spectrum>" );
102 if( readSize < 1023 ) {
107 szPos = (size_t)tag.find(
"<spectrum" );
108 if( szPos != (
size_t)tag.npos ) {
109 tag = tag.substr( szPos );
115 xercesc::MemBufInputSource source( (
const XMLByte*)tag.c_str(), tag.size(),
"memory_buffer", false );
116 parser->parse( source );
119 LOG_WARN( FMT(
"Failed to get the spectrum tag." ) );
124 parser->parse( sampleSet->getFilePath() );
MzmlSampleSet * getMzmlSampleSet()
gets mzML sample set object
FILE * getFile()
gets file descriptor
| void kome::io::mzml::MzmlSpectrum::setOffset |
( |
const long long |
offset | ) |
|
| MzmlSample* kome::io::mzml::MzmlSpectrum::m_mzmlSample |
|
protected |
| long long kome::io::mzml::MzmlSpectrum::m_offset |
|
protected |
The documentation for this class was generated from the following files: