sbrt.shell.io.fba
Class RowOrFbaOptOutputFile<F extends Fluxome>

java.lang.Object
  extended by sbrt.shell.io.fba.RowOrFbaOptOutputFile<F>
Type Parameters:
F - the fluxome type.
All Implemented Interfaces:
ResultsManager<FbaOptimizer.Results>, FbaOptOutputFile<F>, OutputFile<FbaOptimizer.Results>, SbrtFile

public class RowOrFbaOptOutputFile<F extends Fluxome>
extends java.lang.Object
implements FbaOptOutputFile<F>

This class is used to write row-oriented output files containing FBA optimization data.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
RowOrFbaOptOutputFile(java.lang.String fileName, FileFormat fileFormat, FbaOptFileLineFormat fbaFormat)
          Constructs a new row-oriented FBA optimization output file.
RowOrFbaOptOutputFile(java.lang.String fileName, FileFormat fileFormat, java.util.Set<java.lang.String> rowHeaders, FbaOptFileLineFormat fbaFormat)
          Constructs a new row-oriented FBA optimization output file.
 
Method Summary
 void addData(FbaOptimizer.Results results)
          Writes the appropriate values in the provided FbaOptimizer.Results to this file.
 void addData(java.util.Map<java.lang.String,java.lang.Double> results)
          Writes the appropriate values in the provided map to this file.
 void breakPoint()
          Writes a line of # symbols to this file.
 void close()
          Closes this file.
 java.lang.String getCanonicalName()
          Returns the canonical name of this file.
 FbaOptFileLineFormat getFbaOptFileLineFormat()
          Returns the FBA optimization file line format used to write data strings to this file.
 java.lang.String getName()
          Returns the canonical name of this file.
 java.lang.String getOriginalName()
          Returns the provided name of this file.
 java.util.Set<java.lang.String> getRowHeaders()
          Returns the set of row headers whose values will be written to this output file when results are added.
 boolean isClosed()
          Indicates if this file has already been closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sbrt.kernel.io.ResultsManager
addData
 

Constructor Detail

RowOrFbaOptOutputFile

public RowOrFbaOptOutputFile(java.lang.String fileName,
                             FileFormat fileFormat,
                             java.util.Set<java.lang.String> rowHeaders,
                             FbaOptFileLineFormat fbaFormat)
Constructs a new row-oriented FBA optimization output file.

Parameters:
fileName - the name of the file to create.
fileFormat - the format of the file to create.
rowHeaders - a set of valid row headers that will appear in the file. This set can consist of reaction names and the objective function header. If null, all values from every added set of results will be written to this file.
fbaFormat - the map format used to write data strings to the file.

RowOrFbaOptOutputFile

public RowOrFbaOptOutputFile(java.lang.String fileName,
                             FileFormat fileFormat,
                             FbaOptFileLineFormat fbaFormat)
Constructs a new row-oriented FBA optimization output file.

Parameters:
fileName - the name of the file to create.
fileFormat - the format of the file to create.
fbaFormat - the map format used to write data strings to the file.
Method Detail

getFbaOptFileLineFormat

public FbaOptFileLineFormat getFbaOptFileLineFormat()
Returns the FBA optimization file line format used to write data strings to this file.

Specified by:
getFbaOptFileLineFormat in interface FbaOptOutputFile<F extends Fluxome>
Returns:
the FBA optimization file line format used to write data strings to this file.

getRowHeaders

public java.util.Set<java.lang.String> getRowHeaders()
Returns the set of row headers whose values will be written to this output file when results are added. This set acts as a type of filter to control which values in a set of results are saved, and which are discarded.

Returns:
the set of row headers whose values will be written to this output file when a map is added; or null if every value in an added set of results will be written to this file.

addData

public void addData(FbaOptimizer.Results results)
Writes the appropriate values in the provided FbaOptimizer.Results to this file. The appropriates values are those returned by getRowHeaders().

Parameters:
results - the results to write to this file.
Throws:
java.lang.IllegalArgumentException - if the provided results object does not contain all the variables in the set returned by getRowHeaders().
java.lang.IllegalStateException - if close() has already been called.

addData

public void addData(java.util.Map<java.lang.String,java.lang.Double> results)
Writes the appropriate values in the provided map to this file. The appropriates values are those returned by getRowHeaders().

Parameters:
results - the results vector to write to this file.
Throws:
java.lang.IllegalArgumentException - if the provided map does not contain all the keys in the set returned by getRowHeaders().
java.lang.IllegalStateException - if close() has already been called.

close

public void close()
Closes this file. If the file is already closed, no action will be taken.

Specified by:
close in interface ResultsManager<FbaOptimizer.Results>
Specified by:
close in interface SbrtFile

getName

public final java.lang.String getName()
Returns the canonical name of this file.

Specified by:
getName in interface ResultsManager<FbaOptimizer.Results>
Returns:
the canonical name of this file.

getOriginalName

public final java.lang.String getOriginalName()
Returns the provided name of this file.

Specified by:
getOriginalName in interface SbrtFile
Returns:
the provided name of this file.

getCanonicalName

public final java.lang.String getCanonicalName()
Returns the canonical name of this file.

Specified by:
getCanonicalName in interface SbrtFile
Returns:
the canonical name of this file.
See Also:
File.getCanonicalPath()

isClosed

public boolean isClosed()
Indicates if this file has already been closed.

Specified by:
isClosed in interface ResultsManager<FbaOptimizer.Results>
Specified by:
isClosed in interface SbrtFile
Returns:
true if this file is closed; false othewise.
See Also:
ResultsManager.close()

breakPoint

public void breakPoint()
Writes a line of # symbols to this file.

Specified by:
breakPoint in interface ResultsManager<FbaOptimizer.Results>
Throws:
java.lang.IllegalStateException - if close() has already been called.