Last update: 2011-06-23

org.proteios.io
Class OMSSAParameterFileUtil

java.lang.Object
  extended by org.proteios.io.OMSSAParameterFileUtil
All Implemented Interfaces:
FileValidationInterface, OMSSAParameterFileUtilInterface

public class OMSSAParameterFileUtil
extends Object
implements OMSSAParameterFileUtilInterface, FileValidationInterface

This class implements the OMSSAParameterFileUtilInterface that defines methods to access input data from an OMSSA input file.

Author:
olle

Constructor Summary
OMSSAParameterFileUtil()
          Default constructor.
OMSSAParameterFileUtil(File omssaParameterFile)
          Constructor that takes an OMSSA parameter file item as parameter.
OMSSAParameterFileUtil(InputStream xmlInputStream)
          Constructor that takes an OMSSA input XML input stream as parameter.
 
Method Summary
 void exportOMSSAParameterSet(OMSSAParameterSet omssaParameterSet)
          Export OMSSAParameterSet item to output stream.
 String fetchAttribute(Hashtable<String,String> hashtable, String tagValue)
          Convenience method to get an XML tag attribute for an XML tag value from a hash table.
 List<String> fetchEnzymeAlternativesList()
          Enxyme alternatives list, key=
 Hashtable<String,String> fetchEnzymeAttributeHashtable()
          Enzyme attribute hash table, key=, value=
 List<String> fetchIonTypeAlternativesList()
          Ion type alternatives list, key=
 Hashtable<String,String> fetchIonTypeAttributeHashtable()
          Ion type attribute hash table, key=, value=
 List<String> fetchModificationAlternativesList()
          Modification alternatives list, key=
 Hashtable<String,String> fetchModificationAttributeHashtable()
          Modification attribute hash table, key=, value= Note that this hash table, that was obtained from the OMSSA web search HTML form, has the following gaps in the numerical key sequence up till key 165: 119-128, 142-161.
 OMSSAParameterSet fetchOMSSAParameterSet()
          Fetch OMSSAParameterSet item from input stream.
 List<String> fetchSearchTypeAlternativesList()
          Search type alternatives list, key=
 Hashtable<String,String> fetchSearchTypeAttributeHashtable()
          Search type attribute hash table, key=, value=
 List<String> fetchSpeciesAlternativesList()
          Species alternatives list, key=
 Hashtable<String,String> fetchSpeciesAttributeHashtable()
          Species attribute hash table, key=, value= This hash table was obtained from the OMSSA web search HTML form.
 List<String> fetchZDependenceAlternativesList()
          Z dependence alternatives list, key=
 Hashtable<String,String> fetchZDependenceAttributeHashtable()
          Z dependence attribute hash table, key=, value=
 File getOMSSAParameterFile()
          Get the OMSSA parameter file item.
 OMSSAParameterSet getOMSSAParameterSet()
          Get the OMSSA parameter set item.
 String getXMLFilePath()
          Get OMSSA input XML file path.
 InputStream getXMLInputStream()
          Get OMSSA input XML input stream.
 OutputStream getXMLOutputStream()
          Get OMSSA input XML output stream.
 String getXsdFilePath()
          Get XSD schema file to validate against.
 boolean importable()
          Validates first element of input stream.
 void saveOMSSAParameterSet()
          Saves OMSSA parameter set from OMSSAParameterSet item instance variable to XML output stream.
 void saveOMSSAParameterSet(OMSSAParameterSet omssaParameterSetArg)
          Saves OMSSA parameter set from OMSSAParameterSet item to XML output stream.
 void setOMSSAParameterFile(File omssaParameterFile)
          Set the OMSSA parameter file item.
 void setOMSSAParameterSet(OMSSAParameterSet omssaParameterSet)
          Set the OMSSA parameter set item.
 void setXMLFilePath(String xmlFilePath)
          Set OMSSA input XML file path.
 void setXMLInputStream(InputStream xmlInputStream)
          Set OMSSA input XML input stream.
 void setXMLOutputStream(OutputStream xmlOutputStream)
          Set OMSSA input XML output stream.
 void setXsdFilePath(String xsdFilePath)
          Set XSD schema file to validate against.
 boolean valid()
          Validates OMSSA input XML input stream against current OMSSA input XSD file.
 void writeBlankLine()
          Writes a blank line.
 void writeEndTag(String tagName)
          Writes XML end tag for an XML block.
 void writeIndentedText(String text, int extraIndentation)
          Writes indented text with optional extra indentation.
 void writeLabeledSingleTag(String tagName, String label)
          Writes an OMSSA input XML single tag with "value" attribute as label.
 void writeLabeledTagPair(String tagName, String label, String value)
          Writes an OMSSA input XML tag pair with "value" attribute as label.
 void writeStartTag(String tagName)
          Writes XML start tag for an XML block.
 void writeTagPair(String tagName, String value)
          Writes an OMSSA input XML tag pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OMSSAParameterFileUtil

public OMSSAParameterFileUtil()
Default constructor.


OMSSAParameterFileUtil

public OMSSAParameterFileUtil(File omssaParameterFile)
Constructor that takes an OMSSA parameter file item as parameter.

Parameters:
omssaParameterFile - File OMSSA parameter file item.

OMSSAParameterFileUtil

public OMSSAParameterFileUtil(InputStream xmlInputStream)
Constructor that takes an OMSSA input XML input stream as parameter.

Parameters:
xmlInputStream - InputStream OMSSA input XML input stream.
Method Detail

getXsdFilePath

public String getXsdFilePath()
Get XSD schema file to validate against.

Returns:
String with path for XSD schema file.

setXsdFilePath

public void setXsdFilePath(String xsdFilePath)
Set XSD schema file to validate against.

Parameters:
xsdFilePath - String with path for XSD schema file.

getXMLFilePath

public String getXMLFilePath()
Get OMSSA input XML file path.

Returns:
String with path for OMSSA input XML file.

setXMLFilePath

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

Parameters:
xmlFilePath - String with path for OMSSA input XML file.

getXMLInputStream

public InputStream getXMLInputStream()
Get OMSSA input XML input stream.

Returns:
InputStream OMSSA input XML input stream.

setXMLInputStream

public void setXMLInputStream(InputStream xmlInputStream)
Set OMSSA input XML input stream.

Parameters:
xmlInputStream - InputStream OMSSA input XML input stream.

getXMLOutputStream

public OutputStream getXMLOutputStream()
Get OMSSA input XML output stream.

Returns:
OutputStream OMSSA input XML output stream.

setXMLOutputStream

public void setXMLOutputStream(OutputStream xmlOutputStream)
Set OMSSA input XML output stream.

Parameters:
xmlOutputStream - OutputStream OMSSA input XML output stream.

getOMSSAParameterFile

public File getOMSSAParameterFile()
Get the OMSSA parameter file item.

Returns:
File OMSSA parameter file item.

setOMSSAParameterFile

public void setOMSSAParameterFile(File omssaParameterFile)
Set the OMSSA parameter file item.

Parameters:
omssaParameterFile - File OMSSA parameter file item.

getOMSSAParameterSet

public OMSSAParameterSet getOMSSAParameterSet()
Get the OMSSA parameter set item.

Specified by:
getOMSSAParameterSet in interface OMSSAParameterFileUtilInterface
Returns:
OMSSAParameterSet OMSSA parameter set item.

setOMSSAParameterSet

public void setOMSSAParameterSet(OMSSAParameterSet omssaParameterSet)
Set the OMSSA parameter set item.

Parameters:
omssaParameterSet - OMSSAParameterSet OMSSA parameter set item.

valid

public boolean valid()
              throws javax.xml.stream.XMLStreamException,
                     SAXException
Validates OMSSA input XML input stream against current OMSSA input XSD file.

Specified by:
valid in interface FileValidationInterface
Returns:
boolean True if the OMSSA input XML input stream is valid, else false
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
SAXException

importable

public boolean importable()
Validates first element of input stream.

Specified by:
importable in interface FileValidationInterface
Returns:
boolean True if the input stream is valid, else false

fetchOMSSAParameterSet

public OMSSAParameterSet fetchOMSSAParameterSet()
Fetch OMSSAParameterSet item from input stream.

Returns:
OMSSAParameterSet item with settings data.

saveOMSSAParameterSet

public void saveOMSSAParameterSet()
Saves OMSSA parameter set from OMSSAParameterSet item instance variable to XML output stream.


saveOMSSAParameterSet

public void saveOMSSAParameterSet(OMSSAParameterSet omssaParameterSetArg)
Saves OMSSA parameter set from OMSSAParameterSet item to XML output stream.

Parameters:
omssaParameterSetArg - OMSSAParameterSet item with settings data.

fetchSearchTypeAttributeHashtable

public Hashtable<String,String> fetchSearchTypeAttributeHashtable()
Search type attribute hash table, key=, value=

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchSearchTypeAlternativesList

public List<String> fetchSearchTypeAlternativesList()
Search type alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchIonTypeAttributeHashtable

public Hashtable<String,String> fetchIonTypeAttributeHashtable()
Ion type attribute hash table, key=, value=

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchIonTypeAlternativesList

public List<String> fetchIonTypeAlternativesList()
Ion type alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchZDependenceAttributeHashtable

public Hashtable<String,String> fetchZDependenceAttributeHashtable()
Z dependence attribute hash table, key=, value=

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchZDependenceAlternativesList

public List<String> fetchZDependenceAlternativesList()
Z dependence alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchEnzymeAttributeHashtable

public Hashtable<String,String> fetchEnzymeAttributeHashtable()
Enzyme attribute hash table, key=, value=

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchEnzymeAlternativesList

public List<String> fetchEnzymeAlternativesList()
Enxyme alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchSpeciesAttributeHashtable

public Hashtable<String,String> fetchSpeciesAttributeHashtable()
Species attribute hash table, key=, value= This hash table was obtained from the OMSSA web search HTML form.

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchSpeciesAlternativesList

public List<String> fetchSpeciesAlternativesList()
Species alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchModificationAttributeHashtable

public Hashtable<String,String> fetchModificationAttributeHashtable()
Modification attribute hash table, key=, value= Note that this hash table, that was obtained from the OMSSA web search HTML form, has the following gaps in the numerical key sequence up till key 165: 119-128, 142-161. Entries 166-185 obtained from list returned by command `omssacl -ml`.

Returns:
Hashtable Hashtable to find XML tag attribute for given XML tag value.

fetchModificationAlternativesList

public List<String> fetchModificationAlternativesList()
Modification alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchAttribute

public String fetchAttribute(Hashtable<String,String> hashtable,
                             String tagValue)
Convenience method to get an XML tag attribute for an XML tag value from a hash table. It the input tag value is null, or the mapped attribute value is null, an empty string is returned.

Parameters:
hashtable - Hashtable The hashtable to use.
tagValue - String The XML tag value to find the attribute for.
Returns:
String The XML tag attribute for the XML tag value.

exportOMSSAParameterSet

public void exportOMSSAParameterSet(OMSSAParameterSet omssaParameterSet)
Export OMSSAParameterSet item to output stream.

Parameters:
omssaParameterSet - OMSSAParameterSet item with settings data.

writeStartTag

public void writeStartTag(String tagName)
                   throws javax.xml.stream.XMLStreamException
Writes XML start tag for an XML block.

Parameters:
tagName - String tag name
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeEndTag

public void writeEndTag(String tagName)
                 throws javax.xml.stream.XMLStreamException
Writes XML end tag for an XML block.

Parameters:
tagName - String tag name
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeBlankLine

public void writeBlankLine()
                    throws javax.xml.stream.XMLStreamException
Writes a blank line.

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

writeLabeledSingleTag

public void writeLabeledSingleTag(String tagName,
                                  String label)
                           throws javax.xml.stream.XMLStreamException
Writes an OMSSA input XML single tag with "value" attribute as label.

Parameters:
tagName - String
label - String
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeLabeledTagPair

public void writeLabeledTagPair(String tagName,
                                String label,
                                String value)
                         throws javax.xml.stream.XMLStreamException
Writes an OMSSA input XML tag pair with "value" attribute as label.

Parameters:
tagName - String
label - String
value - String
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeTagPair

public void writeTagPair(String tagName,
                         String value)
                  throws javax.xml.stream.XMLStreamException
Writes an OMSSA input XML tag pair.

Parameters:
tagName - String
value - String
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeIndentedText

public void writeIndentedText(String text,
                              int extraIndentation)
                       throws javax.xml.stream.XMLStreamException
Writes indented text with optional extra indentation. The indentation level counter is not updated.

Parameters:
text - String with text.
extraIndentation - int optional extra indentation.
Throws:
javax.xml.stream.XMLStreamException - If there is an error

Last update: 2011-06-23