sbrt.shell.io.fba
Class FluxIntervalInputFile

java.lang.Object
  extended by sbrt.shell.io.fba.FluxIntervalInputFile
All Implemented Interfaces:
java.lang.Iterable<FluxConstraints>, InputFile<FluxConstraints>, SbrtFile

public class FluxIntervalInputFile
extends java.lang.Object
implements InputFile<FluxConstraints>

This class is used to read flux interval input files.

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

Constructor Summary
FluxIntervalInputFile(java.lang.String fileName, FileFormat fileFormat, java.util.Set<LinearComb<java.lang.String>> requiredVariables, MapFormat<LinearComb<java.lang.String>,Interval> mapFormat, Fluxome fluxome, double tolerance)
          Constructs a new flux-interval input file.
 
Method Summary
 void close()
          Closes this file.
static FluxConstraints convertConstraints(java.util.Map<LinearComb<java.lang.String>,Interval> intervals, Fluxome fluxome, double tolerance)
          Converts the provided intervals into a FluxConstraints object.
static java.util.Set<LinearComb<java.lang.String>> convertVariables(java.util.Set<java.lang.String> rxnNames)
          Converts a set of reaction names to a set of single-term linear combinations.
 java.lang.String getCanonicalName()
          Returns the canonical name of this file.
 java.lang.String getOriginalName()
          Returns the provided name of this file.
 double getTolerance()
          Returns the constraint tolerance.
 boolean isClosed()
          Indicates if this file has already been closed.
 java.util.Iterator<FluxConstraints> iterator()
          Returns an iterator over the flux intervals contained in this file.
static void verifyFluxConstraints(java.util.Map<java.lang.String,Interval> fluxConsts, Fluxome fluxome, double tolerance)
          Verifies that the provided constraints are legitimate for the provided fluxome.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FluxIntervalInputFile

public FluxIntervalInputFile(java.lang.String fileName,
                             FileFormat fileFormat,
                             java.util.Set<LinearComb<java.lang.String>> requiredVariables,
                             MapFormat<LinearComb<java.lang.String>,Interval> mapFormat,
                             Fluxome fluxome,
                             double tolerance)
Constructs a new flux-interval input file.

Parameters:
fileName - the name of the file to be read.
fileFormat - the format of the file to be read.
requiredVariables - the variables that must be contained in the file to be read.
mapFormat - the format of data strings in the file to be read.
fluxome - the fluxome for which flux intervals correspond.
tolerance - the constraint tolerance.
Method Detail

getTolerance

public double getTolerance()
Returns the constraint tolerance.

Returns:
the constraint tolerance.

close

public void close()
Closes this file. If this file is already closed, then invoking this method has no effect.

Specified by:
close in interface SbrtFile

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 SbrtFile
Returns:
true if this file is closed; false othewise.

iterator

public java.util.Iterator<FluxConstraints> iterator()
Returns an iterator over the flux intervals contained in this file.

Specified by:
iterator in interface java.lang.Iterable<FluxConstraints>
Returns:
an iterator over the flux intervals contained in this file.

convertVariables

public static java.util.Set<LinearComb<java.lang.String>> convertVariables(java.util.Set<java.lang.String> rxnNames)
Converts a set of reaction names to a set of single-term linear combinations.

Parameters:
rxnNames - the reaction names to be used for constructing single-term linear combinations.
Returns:
a set of single-term linear combinations corresponding to the provided reaction names.

convertConstraints

public static FluxConstraints convertConstraints(java.util.Map<LinearComb<java.lang.String>,Interval> intervals,
                                                 Fluxome fluxome,
                                                 double tolerance)
Converts the provided intervals into a FluxConstraints object. If a provided linear combination contains a single term, with coefficient equal to 1, and constant equal to 0, the interval will be applied to the variable itself (not the linear combination), which is retrievable using FluxConstraints.getConstraint(String) and FluxConstraints.getFluxConstraints(). The flux intervals are also verified against the provided fluxome.

Parameters:
intervals - reaction name expressions mapped to their corresponding interval.
fluxome - the fluxome for which flux intervals correspond.
tolerance - the contraint tolerance.
Returns:
a FluxConstraints object corresponding to the provided input.

verifyFluxConstraints

public static void verifyFluxConstraints(java.util.Map<java.lang.String,Interval> fluxConsts,
                                         Fluxome fluxome,
                                         double tolerance)
Verifies that the provided constraints are legitimate for the provided fluxome.

Parameters:
fluxConsts - reaction named mapped to flux constraints.
fluxome - the fluxome for which the flux constraints correspond.
tolerance - the constraint tolerance.
Throws:
ApplicationException - if the provided flux constraints are not valid for the provided fluxome.
See Also:
Fluxome.isValid(Interval, String, double)