org.fhcrc.cpl.toolbox.proteomics.filehandler
Class BasePepXmlWriter

java.lang.Object
  extended by org.fhcrc.cpl.toolbox.proteomics.filehandler.BasePepXmlWriter
Direct Known Subclasses:
FeaturePepXmlWriter

public abstract class BasePepXmlWriter
extends java.lang.Object

An abstract base class for use as a wrapper for writing PepXml files. We take advantage of XmlBeans to build the structure of the pepxml file, and search_summaries (for modifications), but we stitch the XmlBeans XML output for features together by hand, writing out to a file as we go, so that we don't have to hold the whole structure in memory. This class is abstract because different implementations are likely to want to use different objects to populate the individual spectrum_queries that are written out. The only implementing class at the time of this comment is viewer.feature.FeaturePepXmlWriter, which uses an array of viewer.Feature.Feature to populate the spectrum_queries. I can foresee at least two issues arising when another implementation needs to be created (likely on the CPAS side): 1. More file-level data may need to be written out at the top of the file. In that case, please discuss with me (Damon) and we'll make sure that anything that's useful for everybody gets stuck in this abstract base class 2. Something other than MS2Modifications might be desired to populate the modifications. In that case, this abstract base class can turn into two levels of abstract base classes. :) Also I think there may be some weirdness with where the MS2Modifications are declared, in the case that there's more than one fraction. We'll burn that bridge when we come to it.


Field Summary
protected  java.lang.String _baseName
           
protected  java.lang.String _documentPostscript
           
protected  java.lang.String _documentPrefix
           
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary _firstRunSummary
           
protected  MS2Modification[] _modifications
           
protected  org.apache.xmlbeans.XmlOptions _optionsForPrinting
           
protected  java.lang.String _precursorMassType
           
protected  java.lang.String _searchEngine
           
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SearchSummary _searchSummary
           
protected  java.lang.String _spectrumBaseString
           
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis _xmlBeansAnalysis
           
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument _xmlBeansPepXmlDoc
           
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary[] _xmlBeansRunSummaryArray
           
static java.lang.String PRECURSOR_MASS_TYPE_MONOISOTOPIC
           
static java.lang.String SEARCH_ENGINE_XTANDEM_COMET
           
 
Constructor Summary
BasePepXmlWriter()
          Constructor creates the XmlBeans representing the shell of a PepXml document, and creates the "prefix" and "postscript" strings representing that shell
BasePepXmlWriter(MS2Modification[] modifications)
          Create doc structure, populate features and modifications
 
Method Summary
protected  void addModificationsToSearchHit(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit, java.util.List<ModifiedAminoAcid>[] modifiedAminoAcids, float nTermModMass, float cTermModMass)
          Utility method for adding modified aminoacids
protected  void addModificationsToXML()
          Add modifications to the xml output We assume a reasonably small number of modifications.
protected  void addPeptideProphet(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit, float pprophet, java.lang.String allNttProb, float fval)
          Adds an AnalysisResult representing the peptide prophet score
protected  void addSearchScore(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit, java.lang.String searchScoreName, java.lang.String searchScoreValue)
          Add a search score.
protected  net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery addSpectrumQuery(int scanFirst, int scanLast, int charge, int index)
          Utility method to create a spectrumQuery, added to the first run summary
 java.lang.String get_precursorMassType()
           
 java.lang.String get_searchEngine()
           
 net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SearchSummary getSearchSummary()
           
 java.lang.String getSpectrumBaseString()
           
protected  void preWrite()
           
 void set_precursorMassType(java.lang.String _precursorMassType)
           
 void set_searchEngine(java.lang.String _searchEngine)
           
 void setBaseName(java.lang.String baseName)
          setter for basename
 void setModifications(MS2Modification[] modifications)
          setter for modifications
 void setSearchConstraints(int maxCleavages, int minTermini)
          Better only call once.
 void setSearchDatabase(java.lang.String databasePath)
          Better only call once
 void setSpectrumBaseString(java.lang.String spectrumBaseString)
           
 void write(java.io.File file)
          Write out the full document, with all modifications and features, to a file
protected abstract  void writeSpectrumQueries(java.io.PrintWriter pw)
          Write out all features immediately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_xmlBeansPepXmlDoc

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument _xmlBeansPepXmlDoc

_xmlBeansAnalysis

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis _xmlBeansAnalysis

_xmlBeansRunSummaryArray

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary[] _xmlBeansRunSummaryArray

_firstRunSummary

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary _firstRunSummary

_searchSummary

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SearchSummary _searchSummary

_documentPrefix

protected java.lang.String _documentPrefix

_documentPostscript

protected java.lang.String _documentPostscript

_optionsForPrinting

protected org.apache.xmlbeans.XmlOptions _optionsForPrinting

_modifications

protected MS2Modification[] _modifications

_spectrumBaseString

protected java.lang.String _spectrumBaseString

_baseName

protected java.lang.String _baseName

PRECURSOR_MASS_TYPE_MONOISOTOPIC

public static final java.lang.String PRECURSOR_MASS_TYPE_MONOISOTOPIC
See Also:
Constant Field Values

_precursorMassType

protected java.lang.String _precursorMassType

SEARCH_ENGINE_XTANDEM_COMET

public static final java.lang.String SEARCH_ENGINE_XTANDEM_COMET
See Also:
Constant Field Values

_searchEngine

protected java.lang.String _searchEngine
Constructor Detail

BasePepXmlWriter

public BasePepXmlWriter()
Constructor creates the XmlBeans representing the shell of a PepXml document, and creates the "prefix" and "postscript" strings representing that shell


BasePepXmlWriter

public BasePepXmlWriter(MS2Modification[] modifications)
Create doc structure, populate features and modifications

Parameters:
modifications -
Method Detail

getSearchSummary

public net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SearchSummary getSearchSummary()

setModifications

public void setModifications(MS2Modification[] modifications)
setter for modifications

Parameters:
modifications -

setBaseName

public void setBaseName(java.lang.String baseName)
setter for basename

Parameters:
baseName -

addModificationsToXML

protected void addModificationsToXML()
Add modifications to the xml output We assume a reasonably small number of modifications. No need to write them each out individually and then dispose of the java object


writeSpectrumQueries

protected abstract void writeSpectrumQueries(java.io.PrintWriter pw)
Write out all features immediately

Parameters:
pw -

addPeptideProphet

protected void addPeptideProphet(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit,
                                 float pprophet,
                                 java.lang.String allNttProb,
                                 float fval)
Adds an AnalysisResult representing the peptide prophet score

Parameters:
searchHit -
pprophet -
allNttProb -
fval - 0 is a sentinel value meaning absent

addSearchScore

protected void addSearchScore(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit,
                              java.lang.String searchScoreName,
                              java.lang.String searchScoreValue)
Add a search score. Doesn't make any attempt to prevent duplicates

Parameters:
searchHit -
searchScoreName -
searchScoreValue -

addSpectrumQuery

protected net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery addSpectrumQuery(int scanFirst,
                                                                                                                                             int scanLast,
                                                                                                                                             int charge,
                                                                                                                                             int index)
Utility method to create a spectrumQuery, added to the first run summary

Parameters:
scanFirst -
scanLast -
charge -
Returns:

addModificationsToSearchHit

protected void addModificationsToSearchHit(net.systemsbiology.regisWeb.pepXML.MsmsPipelineAnalysisDocument.MsmsPipelineAnalysis.MsmsRunSummary.SpectrumQuery.SearchResult.SearchHit searchHit,
                                           java.util.List<ModifiedAminoAcid>[] modifiedAminoAcids,
                                           float nTermModMass,
                                           float cTermModMass)
Utility method for adding modified aminoacids

Parameters:
searchHit -
modifiedAminoAcids -

setSearchDatabase

public void setSearchDatabase(java.lang.String databasePath)
Better only call once

Parameters:
databasePath -

setSearchConstraints

public void setSearchConstraints(int maxCleavages,
                                 int minTermini)
Better only call once. TODO: un-hardcode trypsin

Parameters:
maxCleavages -
minTermini -

preWrite

protected void preWrite()

write

public void write(java.io.File file)
           throws java.io.IOException
Write out the full document, with all modifications and features, to a file

Parameters:
file -
Throws:
java.io.IOException

getSpectrumBaseString

public java.lang.String getSpectrumBaseString()

setSpectrumBaseString

public void setSpectrumBaseString(java.lang.String spectrumBaseString)

get_precursorMassType

public java.lang.String get_precursorMassType()

set_precursorMassType

public void set_precursorMassType(java.lang.String _precursorMassType)

get_searchEngine

public java.lang.String get_searchEngine()

set_searchEngine

public void set_searchEngine(java.lang.String _searchEngine)


Fred Hutchinson Cancer Research Center