Last update: 2011-06-23

org.proteios.io.mzdata
Class MzDataImpMzDataBlock

java.lang.Object
  extended by org.proteios.io.mzdata.MzDataImpCommon
      extended by org.proteios.io.mzdata.MzDataImpCommonDc
          extended by org.proteios.io.mzdata.MzDataImpCommonAnnotation
              extended by org.proteios.io.mzdata.MzDataImpCommonPeakListSet
                  extended by org.proteios.io.mzdata.MzDataImpMzDataBlock

public class MzDataImpMzDataBlock
extends MzDataImpCommonPeakListSet

This class processes an "mzData" XML block in an mzData file. An mzData file contains information on a mass spectrometry experiment. The mzData file is first vaildated against the XML Schema Definition file mzdata.xsd. If the file is valid, its content is parsed and selected information stored in Proteios. The mzData file is parsed using cursor-based XML stream parsing. The StAX (Stream API for XML) parser finds start and stop (end) tags, which are then processed. Element attributes are located in the start tag, and elements of simple types are stored directly after the start tag is read. For more complex elements, values of attributes and sub-elements are collected in temporary variables, until the end tag is reached, and the colelcted contents are stored. Example: XML tag tagData At start tag: Method thisTagElementStart() stores attribute values. Between tags: tagData is stored in temporary StringBuffer. At end tag: Method thisTagItem() processes collected data. Tag data may be exchanged for a start/end tag pair, etc.

Version:
2.0
Author:
Olle
Last modified
$Date: 2006-11-08 16:40:00 +0200 (Mon, 16 Oct 2006) $

Field Summary
 
Fields inherited from class org.proteios.io.mzdata.MzDataImpCommonPeakListSet
aPeakListSet
 
Fields inherited from class org.proteios.io.mzdata.MzDataImpCommonDc
anna, dc, factory
 
Fields inherited from class org.proteios.io.mzdata.MzDataImpCommon
log
 
Constructor Summary
MzDataImpMzDataBlock(SessionControl sc)
          Default constructor.
 
Method Summary
 void blockEnd(javax.xml.stream.XMLStreamReader parser)
          Processes end of XML block processed by this class.
 void blockStart(javax.xml.stream.XMLStreamReader parser)
          Processes start of XML block processed by this class.
 String currentDateTime()
          Current date and time as a string.
 void cvLookupElementStart(javax.xml.stream.XMLStreamReader parser)
          Processes start of cvLookup XML element.
 String getMzDataAccessionNumber()
          Get the mzData accessionNumber.
 String getMzDataNamespacePrefix()
          Get the mzData namespace prefix.
 String getMzDataNamespaceURI()
          Get the mzData namespace uri.
 String getMzDataVersion()
          Get the mzData version.
 PeakList getPeakList()
          Get the current PeakList for the mzData file.
 PeakListSet getPeakListSet()
          Get the PeakListSet created from the imported mzData file.
 ProgressReporter getProgressReporter()
          Get the ProgressReporter.
 File getSourceFile()
          Get source core file with mzData.
 String getXMLFilePath()
          Get mzData XML file path.
 void peakListSetItemEnd(PeakListSet peakListSet)
          Processes a PeakListSet item after all data has been collected.
 PeakListSet peakListSetItemStart()
          Creates a PeakListSet item at start of parsing mzData file, and not all data has been collected.
 void processInternalStartElement(javax.xml.stream.XMLStreamReader parser)
          Processes an Internal StartElement event.
 void setMzDataAccessionNumber(String mzDataAccessionNumber)
          Set the mzData accessionNumber.
 void setMzDataNamespacePrefix(String mzDataNamespacePrefix)
          Set the mzData namespace prefix.
 void setMzDataNamespaceURI(String mzDataNamespaceURI)
          Set the mzData namespace uri.
 void setMzDataVersion(String mzDataVersion)
          Set the mzData version.
 void setPeakList(PeakList peakList)
          Set the current PeakList for the mzData file.
 void setPeakListSet(PeakListSet peakListSet)
          Set the PeakListSet created from the imported mzData file.
 void setProgressReporter(ProgressReporter progress)
          Set the ProgressReporter.
 void setSourceFile(File sourceFile)
          Set source core file with mzData.
 void setXMLFilePath(String xmlFilePath)
          Set mzData XML file path.
 String zeroLeftPad(String numAsString, int minNumChars)
          Pad number string with zeros from left if necessary Note: Only intended for non-negative integer values.
 
Methods inherited from class org.proteios.io.mzdata.MzDataImpCommonPeakListSet
parse
 
Methods inherited from class org.proteios.io.mzdata.MzDataImpCommonAnnotation
fetchCvLookupAnnotation, fetchCvLookupAnnotationList, fetchCvParamAnnotation, fetchCvParamAnnotationList, fetchUserParamAnnotation, fetchUserParamAnnotationList, storeAnnotation, storeCvLookupAnnotation, storeCvParamAnnotation, storeUserParamAnnotation
 
Methods inherited from class org.proteios.io.mzdata.MzDataImpCommonDc
enableDbControl, enableDbControl, getDbControl, getSessionControl, setDbControl
 
Methods inherited from class org.proteios.io.mzdata.MzDataImpCommon
getBlockTagName, getTempStrBuf, parse, processCData, processCharacters, processInternalEndElement, setBlockTagName, setTempStrBuf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MzDataImpMzDataBlock

public MzDataImpMzDataBlock(SessionControl sc)
Default constructor.

Method Detail

getXMLFilePath

public String getXMLFilePath()
Get mzData XML file path.

Overrides:
getXMLFilePath in class MzDataImpCommonPeakListSet
Returns:
xmlFilePath String with path for mzData XML file.

setXMLFilePath

public void setXMLFilePath(String xmlFilePath)
Set mzData XML file path.

Overrides:
setXMLFilePath in class MzDataImpCommonPeakListSet
Parameters:
xmlFilePath - String with path for mzData XML file.

getSourceFile

public File getSourceFile()
Get source core file with mzData.

Returns:
sourceFile File source core file with mzData.

setSourceFile

public void setSourceFile(File sourceFile)
Set source core file with mzData.

Parameters:
sourceFile - File source core file with mzData.

getMzDataVersion

public String getMzDataVersion()
Get the mzData version.

Returns:
mzDataVersion String the mzDataVersion

setMzDataVersion

public void setMzDataVersion(String mzDataVersion)
Set the mzData version.

Parameters:
mzDataVersion - String the mzDataVersion to set.

getMzDataAccessionNumber

public String getMzDataAccessionNumber()
Get the mzData accessionNumber.

Returns:
mzDataAccessionNumber String the mzDataAccessionNumber

setMzDataAccessionNumber

public void setMzDataAccessionNumber(String mzDataAccessionNumber)
Set the mzData accessionNumber.

Parameters:
mzDataAccessionNumber - String the mzDataAccessionNumber to set.

getMzDataNamespacePrefix

public String getMzDataNamespacePrefix()
Get the mzData namespace prefix.

Returns:
mzDataNamespacePrefix String the mzDataNamespacePrefix

setMzDataNamespacePrefix

public void setMzDataNamespacePrefix(String mzDataNamespacePrefix)
Set the mzData namespace prefix.

Parameters:
mzDataNamespacePrefix - String the mzDataNamespacePrefix to set.

getMzDataNamespaceURI

public String getMzDataNamespaceURI()
Get the mzData namespace uri.

Returns:
mzDataNamespaceURI String the mzDataNamespaceURI

setMzDataNamespaceURI

public void setMzDataNamespaceURI(String mzDataNamespaceURI)
Set the mzData namespace uri.

Parameters:
mzDataNamespaceURI - String the mzDataNamespaceURI to set.

getPeakListSet

public PeakListSet getPeakListSet()
Get the PeakListSet created from the imported mzData file.

Overrides:
getPeakListSet in class MzDataImpCommonPeakListSet
Returns:
peakListSet PeakListSet the PeakListSet created from the mzdata file.

setPeakListSet

public void setPeakListSet(PeakListSet peakListSet)
Set the PeakListSet created from the imported mzData file.

Overrides:
setPeakListSet in class MzDataImpCommonPeakListSet
Parameters:
peakListSet - PeakListSet the PeakListSet created from the mzdata file.

getPeakList

public PeakList getPeakList()
Get the current PeakList for the mzData file.

Returns:
peakList The current created PeakList for the mzdata file.

setPeakList

public void setPeakList(PeakList peakList)
Set the current PeakList for the mzData file.

Parameters:
peakList - PeakList the peakList to set.

getProgressReporter

public ProgressReporter getProgressReporter()
Get the ProgressReporter.

Returns:
The ProgressReporter object.

setProgressReporter

public void setProgressReporter(ProgressReporter progress)
Set the ProgressReporter.

Parameters:
progress - The ProgressReporter object to set.

blockStart

public void blockStart(javax.xml.stream.XMLStreamReader parser)
                throws javax.xml.stream.XMLStreamException
Processes start of XML block processed by this class. Extracts data from attributes.

Overrides:
blockStart in class MzDataImpCommon
Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

processInternalStartElement

public void processInternalStartElement(javax.xml.stream.XMLStreamReader parser)
                                 throws javax.xml.stream.XMLStreamException
Processes an Internal StartElement event. The blocks in the if-else section are placed in the order of appearance of the start elements in the mzData XML file. This not essential for the functionality, but makes it easier to see if a specific element is handled or not. Elements that may be daughter elements to different types of parent elements, e.g. and , are placed at a suitable location.

Overrides:
processInternalStartElement in class MzDataImpCommon
Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

blockEnd

public void blockEnd(javax.xml.stream.XMLStreamReader parser)
              throws javax.xml.stream.XMLStreamException
Processes end of XML block processed by this class.

Overrides:
blockEnd in class MzDataImpCommon
Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

cvLookupElementStart

public void cvLookupElementStart(javax.xml.stream.XMLStreamReader parser)
                          throws javax.xml.stream.XMLStreamException
Processes start of cvLookup XML element. Extracts data from attributes.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

peakListSetItemStart

public PeakListSet peakListSetItemStart()
Creates a PeakListSet item at start of parsing mzData file, and not all data has been collected.

Returns:
peakListSet PeakListSet peakListSet

peakListSetItemEnd

public void peakListSetItemEnd(PeakListSet peakListSet)
Processes a PeakListSet item after all data has been collected. Foreign keys for PeakListSet stored in database.

Parameters:
peakListSet - PeakListSet peakListSet

zeroLeftPad

public String zeroLeftPad(String numAsString,
                          int minNumChars)
Pad number string with zeros from left if necessary Note: Only intended for non-negative integer values. If input number string has a length > minNumChars, the input string is returned.

Parameters:
numAsString - String with number value to format
minNumChars - int Minimum number of characters in output
Returns:
String value formatted to minimum number of characters

currentDateTime

public String currentDateTime()
Current date and time as a string.

Returns:
String date and time formatted as "YYYY-MM-DD hh:mm".

Last update: 2011-06-23