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

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

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

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

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

Constructor Summary
ColumnOrFbaOptOutputFile(java.lang.String fileName, FileFormat fileFormat, java.util.Set<java.lang.String> columnHeaders, FbaOptFileLineFormat fbaFormat)
          Constructs a new column-oriented FBA optimization output file.
 
Method Summary
 void addData(java.util.Map<java.lang.String,java.lang.Double> results)
          Writes the appropriate values in the provided map to this file.
<S extends FbaOptimizer.Results>
void
addData(S results)
          Writes the appropriate values in the provided FbaOptimizer.Results 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.
 java.util.Set<java.lang.String> getColumnHeaders()
          Returns the set of column headers that are written to 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.
 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
 

Constructor Detail

ColumnOrFbaOptOutputFile

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

Parameters:
fileName - the name of the file to create.
fileFormat - the format of the file to create.
columnHeaders - a set of valid column headers that will appear in the file. This set can consist of reaction names and the objective function header.
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.

getColumnHeaders

public java.util.Set<java.lang.String> getColumnHeaders()
Returns the set of column headers that are written to this file.

Returns:
the set of column headers that are written to this file.

addData

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

Specified by:
addData in interface ResultsManager<FbaOptimizer.Results>
Type Parameters:
S - a type extending FbaOptimizer.Results
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 getColumnHeaders().
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 getColumnHeaders().

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 getColumnHeaders().
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 origianl 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.