Last update: 2011-06-23

org.proteios.io
Class MascotParameterFileUtil

java.lang.Object
  extended by org.proteios.io.MascotParameterFileUtil
All Implemented Interfaces:
FileValidationInterface, MascotParameterFileUtilInterface

public class MascotParameterFileUtil
extends Object
implements MascotParameterFileUtilInterface, FileValidationInterface

This class implements the MascotParameterFileUtilInterface that defines methods to access input data from a Mascot input file.

Author:
olle

Constructor Summary
MascotParameterFileUtil()
          Default constructor.
MascotParameterFileUtil(File mascotParameterFile)
          Constructor that takes a Mascot parameter file item as parameter.
MascotParameterFileUtil(InputStream xmlInputStream)
          Constructor that takes a Mascot input XML input stream as parameter.
 
Method Summary
 void exportMascotParameterSet(MascotParameterSet mascotParameterSet)
          Export MascotParameterSet 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> fetchDataFormatAlternativesList()
          Data format alternatives list, key=
 List<String> fetchEnzymeAlternativesList()
          Enzyme alternatives list, key=
 List<String> fetchInstrumentAlternativesList()
          Instrument alternatives list, key=
 MascotParameterSet fetchMascotParameterSet()
          Fetch MascotParameterSet item from input stream.
 List<String> fetchMassIonTypeAlternativesList()
          Mass ion type alternatives list, key=
 Hashtable<String,String> fetchMassIonTypeAttributeHashtable()
          Mass ion type attribute hash table, key=, value=
 List<String> fetchMassTypeAlternativesList()
          Mass type alternatives list, key=
 List<String> fetchMissedCleavagesAlternativesList()
          Missed cleavages alternatives list, key=
 List<String> fetchModificationAlternativesList()
          Modification alternatives list, key=
 List<String> fetchMsMsTolUnitAlternativesList()
          MS-MS tolerance unit alternatives list, key=
 List<String> fetchPeptideChargeAlternativesList()
          Peptide charge alternatives list, key=
 List<String> fetchPeptideIsotopeErrorAlternativesList()
          Peptide isotope error alternatives list, key=
 List<String> fetchPeptideTolUnitAlternativesList()
          Peptide tolerance unit alternatives list, key=
 List<String> fetchQuantitationAlternativesList()
          Quantitation alternatives list, key=
 List<String> fetchReportTopAlternativesList()
          Report top alternatives list, key=
 List<String> fetchSearchTypeAlternativesList()
          Search type alternatives list, key=
 Hashtable<String,String> fetchSearchTypeAttributeHashtable()
          Search type attribute hash table, key=, value=
 List<String> fetchSequenceLibraryAlternativesList()
          Sequence library alternatives list, key=
 List<String> fetchSpeciesAlternativesList()
          Species alternatives list, key=
 File getMascotParameterFile()
          Get the Mascot parameter file item.
 MascotParameterSet getMascotParameterSet()
          Get the Mascot parameter set item.
 String getXMLFilePath()
          Get Mascot input XML file path.
 InputStream getXMLInputStream()
          Get Mascot input XML input stream.
 OutputStream getXMLOutputStream()
          Get Mascot input XML output stream.
 String getXsdFilePath()
          Get XSD schema file to validate against.
 boolean importable()
          Validates first element of input stream.
 void saveMascotParameterSet()
          Saves Mascot parameter set from MascotParameterSet item instance variable to XML output stream.
 void saveMascotParameterSet(MascotParameterSet mascotParameterSetArg)
          Saves Mascot parameter set from MascotParameterSet item to XML output stream.
 void setMascotParameterFile(File mascotParameterFile)
          Set the Mascot parameter file item.
 void setMascotParameterSet(MascotParameterSet mascotParameterSet)
          Set the Mascot parameter set item.
 void setXMLFilePath(String xmlFilePath)
          Set Mascot input XML file path.
 void setXMLInputStream(InputStream xmlInputStream)
          Set Mascot input XML input stream.
 void setXMLOutputStream(OutputStream xmlOutputStream)
          Set Mascot input XML output stream.
 void setXsdFilePath(String xsdFilePath)
          Set XSD schema file to validate against.
 boolean valid()
          Validates Mascot input XML input stream against current Mascot 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 a Mascot input XML single tag with "value" attribute as label.
 void writeLabeledTagPair(String tagName, String label, String value)
          Writes a Mascot 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 a Mascot input XML tag pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MascotParameterFileUtil

public MascotParameterFileUtil()
Default constructor.


MascotParameterFileUtil

public MascotParameterFileUtil(File mascotParameterFile)
Constructor that takes a Mascot parameter file item as parameter.

Parameters:
mascotParameterFile - File Mascot parameter file item.

MascotParameterFileUtil

public MascotParameterFileUtil(InputStream xmlInputStream)
Constructor that takes a Mascot input XML input stream as parameter.

Parameters:
xmlInputStream - InputStream Mascot 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 Mascot input XML file path.

Returns:
String with path for Mascot input XML file.

setXMLFilePath

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

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

getXMLInputStream

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

Returns:
InputStream Mascot input XML input stream.

setXMLInputStream

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

Parameters:
xmlInputStream - InputStream Mascot input XML input stream.

getXMLOutputStream

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

Returns:
OutputStream Mascot input XML output stream.

setXMLOutputStream

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

Parameters:
xmlOutputStream - OutputStream Mascot input XML output stream.

getMascotParameterFile

public File getMascotParameterFile()
Get the Mascot parameter file item.

Returns:
File Mascot parameter file item.

setMascotParameterFile

public void setMascotParameterFile(File mascotParameterFile)
Set the Mascot parameter file item.

Parameters:
mascotParameterFile - File Mascot parameter file item.

getMascotParameterSet

public MascotParameterSet getMascotParameterSet()
Get the Mascot parameter set item.

Specified by:
getMascotParameterSet in interface MascotParameterFileUtilInterface
Returns:
MascotParameterSet Mascot parameter set item.

setMascotParameterSet

public void setMascotParameterSet(MascotParameterSet mascotParameterSet)
Set the Mascot parameter set item.

Parameters:
mascotParameterSet - MascotParameterSet Mascot parameter set item.

valid

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

Specified by:
valid in interface FileValidationInterface
Returns:
boolean True if the Mascot 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

fetchMascotParameterSet

public MascotParameterSet fetchMascotParameterSet()
Fetch MascotParameterSet item from input stream.

Returns:
MascotParameterSet item with settings data.

saveMascotParameterSet

public void saveMascotParameterSet()
Saves Mascot parameter set from MascotParameterSet item instance variable to XML output stream.


saveMascotParameterSet

public void saveMascotParameterSet(MascotParameterSet mascotParameterSetArg)
Saves Mascot parameter set from MascotParameterSet item to XML output stream.

Parameters:
mascotParameterSetArg - MascotParameterSet 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.

fetchEnzymeAlternativesList

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

Returns:
List List with alternatives for XML tag values.

fetchSequenceLibraryAlternativesList

public List<String> fetchSequenceLibraryAlternativesList()
Sequence library alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchMissedCleavagesAlternativesList

public List<String> fetchMissedCleavagesAlternativesList()
Missed cleavages alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchSpeciesAlternativesList

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

Returns:
List List with alternatives for XML tag values.

fetchModificationAlternativesList

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

Returns:
List List with alternatives for XML tag values.

fetchQuantitationAlternativesList

public List<String> fetchQuantitationAlternativesList()
Quantitation alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchPeptideTolUnitAlternativesList

public List<String> fetchPeptideTolUnitAlternativesList()
Peptide tolerance unit alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchPeptideIsotopeErrorAlternativesList

public List<String> fetchPeptideIsotopeErrorAlternativesList()
Peptide isotope error alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchMsMsTolUnitAlternativesList

public List<String> fetchMsMsTolUnitAlternativesList()
MS-MS tolerance unit alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchPeptideChargeAlternativesList

public List<String> fetchPeptideChargeAlternativesList()
Peptide charge alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchMassIonTypeAttributeHashtable

public Hashtable<String,String> fetchMassIonTypeAttributeHashtable()
Mass ion type attribute hash table, key=, value=

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

fetchMassIonTypeAlternativesList

public List<String> fetchMassIonTypeAlternativesList()
Mass ion type alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchMassTypeAlternativesList

public List<String> fetchMassTypeAlternativesList()
Mass type alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchDataFormatAlternativesList

public List<String> fetchDataFormatAlternativesList()
Data format alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchInstrumentAlternativesList

public List<String> fetchInstrumentAlternativesList()
Instrument alternatives list, key=

Returns:
List List with alternatives for XML tag values.

fetchReportTopAlternativesList

public List<String> fetchReportTopAlternativesList()
Report top 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.

exportMascotParameterSet

public void exportMascotParameterSet(MascotParameterSet mascotParameterSet)
Export MascotParameterSet item to output stream.

Parameters:
mascotParameterSet - MascotParameterSet 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 a Mascot 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 a Mascot 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 a Mascot 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