Slice Tools
  • Home
  • SourceForge Page


  • libSlice
  • Home
  • Modules
  • Files
  • Examples
  • Additional Information


  • SourceForge.net Logo
     

    libSlice::SliceData Class Reference
    [C++ Interface]


    Detailed Description

    Stores information about a given slice.

    Each slice is responsible for calculating its own results of calling libSlice. Error information is also stored within the slice, so that all available information about the error cause slice is stored in a single place.

    Examples:

    SliceDataExample.cc.

    Definition at line 38 of file SliceData.hh.

    Public Types

    enum  SliceErrorCode
     Error Codes for slices.

    enum  StringOperation
     Special codes for string operations errrors.


    Public Member Functions

     SliceData (const ReadManager &readManager, const char *index, const char *gindex, const char *existing, long sliceRangeIndex=0, long sliceRangeGindex=0)
     Constructor initializes the slice information.

    virtual ~SliceData ()
     Deletes the flattened slice.

    void addNuc (const char *nucData)
     Appends data to the list of Nuc Data.

    void addQualVal (const char *qualVal)
     Appends data to the list of QualVal Data.

    void addReadId (const char *readId)
     Appends data to the list of ReadId Data.

    void print (ostream &out, const string &prefix="")
     Prints a slice to a specified output stream.

    void printError (ostream &out) const
     Prints out the error information from the slice to a given output stream.

    void printXML (ostream &out, const string &prefix="")
     Prints a slice to a specified output stream in Slice XML.

    int getErrorCode () const
     Gets the internal error code that threw an exception.

    int getErrorOperation () const
     Gets the code for the string operation threw the exception.

    void setDistributionTable (double freqA, double freqC, double freqG, double freqT, double freqGap)
     Sets the distribution table.

    void setHighQualityThreshold (int highQualityThreshold)
     Sets the threshold of high quality for getConsensus and getConsQC.

    void setDoAmbiguity (int doAmbiguity)
     Set if consensus and quality class should be based on an ambiguity code.

    ConsensusData doCalculations (bool recallEmpty=false)
     Flattens a slice, and calls libSlice to do the quality calculations.

    unsigned short getDepth () const
     Returns the depth of coverage based on the number of bases specified.

    ReadDatagetRead (unsigned short index) const
     Gets ReadId[index].

    long getIndex () const
     Returns the ungapped index of the slice.

    long getGindex () const
     Returns the gapped index of the slice.

    char getBase (unsigned short index)
     Gets bc[index].

    char getQualVal (unsigned short index)
     Gets qv[index].

    char getConsensus ()
     Gets the existing consensus.

    const string & getNucData () const
     Gets the complete nuc string set by addNuc.

    const string & getQualValData () const
     Gets the complete qualval string set by addQualVal.

    const string & getReadIdData () const
     Gets the complete readid string set by addReadId.

    void resetIndex (long index, long gindex)
     Resets the index.

    void resetReadId ()
     Resets the read id data.

    void resetQualVal ()
     Resets the QualVal data.

    void resetNuc ()
     Resets the Nuc data.

    void setConsensus (char consensus)
     Force the consensus to be a certain value.


    Static Public Member Functions

    char getBaseCompliment (char base)
     Get the compliment of a base or ambiguity code.


    Constructor & Destructor Documentation

    libSlice::SliceData::SliceData const ReadManager readManager,
    const char *  index,
    const char *  gindex,
    const char *  existing,
    long  sliceRangeIndex = 0,
    long  sliceRangeGindex = 0
     

    Constructor initializes the slice information.

    The read manager needs to be provided so that reverse compliment flags can be looked up.

    Parameters:
    readManager Manager of all associated reads
    index Index of slice [optional]
    gindex Gindex of slice [optional]
    existing Existing consensus of slice [optional default=' ']
    sliceRangeIndex Ungapped Index of the parent SliceRange
    sliceRangeGindex Gapped index of the parent SliceRange

    Definition at line 23 of file SliceData.cc.

    libSlice::SliceData::~SliceData  )  [virtual]
     

    Deletes the flattened slice.

    If the slice has been flattened into a struct slice, deletes the pointer to that struct and the data fields that are pointers.

    Definition at line 74 of file SliceData.cc.


    Member Function Documentation

    void libSlice::SliceData::addNuc const char *  nucData  ) 
     

    Appends data to the list of Nuc Data.

    Useful because Xerces won't guarantee that all of the character data will come in a single message, which is how Nuc data is specified.

    Examples:
    SliceDataExample.cc.

    Definition at line 111 of file SliceData.cc.

    void libSlice::SliceData::addQualVal const char *  qualVal  ) 
     

    Appends data to the list of QualVal Data.

    Useful because Xerces won't guarantee that all of the character data will come in a single message, which is how QualVal data is specified.

    Examples:
    SliceDataExample.cc.

    Definition at line 120 of file SliceData.cc.

    void libSlice::SliceData::addReadId const char *  readId  ) 
     

    Appends data to the list of ReadId Data.

    Useful because Xerces won't guarantee that all of the character data will come in a single message, which is how ReadId data is specified

    Examples:
    SliceDataExample.cc.

    Definition at line 129 of file SliceData.cc.

    ConsensusData libSlice::SliceData::doCalculations bool  recallEmpty = false  ) 
     

    Flattens a slice, and calls libSlice to do the quality calculations.

    A new consensus is always calculated before the quality class or quality value is calculated.

    The new consensus is set to be used as the "Existing" attribute of the XML slice

    See also:
    flattenSlice()

    Definition at line 492 of file SliceData.cc.

    long libSlice::SliceData::getGindex  )  const
     

    Returns the gapped index of the slice.

    The gapped index is gindex + sliceRangeGindex

    Definition at line 469 of file SliceData.cc.

    long libSlice::SliceData::getIndex  )  const
     

    Returns the ungapped index of the slice.

    The ungapped index is index + sliceRangeIndex

    Definition at line 461 of file SliceData.cc.

    void libSlice::SliceData::print ostream &  out,
    const string &  prefix = ""
     

    Prints a slice to a specified output stream.

    Flattens the slice first so that the triplet of (base, qv, rc) can be printed for each base. Data is enclosed in <Slice ...> ... </Slice> tags and each base is written as <Base ...>

    This does not produce valid Slice XML, but shows how the data was actually parsed.

    See also:
    flattenSlice

    Definition at line 587 of file SliceData.cc.

    void libSlice::SliceData::printError ostream &  out  )  const
     

    Prints out the error information from the slice to a given output stream.

    Before an exception is thrown from SliceData, information is stored in the slice so that the details of the error can be displayed along with all of the other information (if requested)

    Definition at line 718 of file SliceData.cc.

    void libSlice::SliceData::printXML ostream &  out,
    const string &  prefix = " "
     

    Prints a slice to a specified output stream in Slice XML.

    This does produce valid XML. The bases, qualvals, and readids come from the unparsed add* functions.

    The slice is not flattened

    Definition at line 617 of file SliceData.cc.

    void libSlice::SliceData::resetIndex long  index,
    long  gindex
     

    Resets the index.

    Overwrites the index and gindex provided at construction

    Useful so a slice can be modified without making a copy

    Definition at line 689 of file SliceData.cc.

    void libSlice::SliceData::resetNuc  ) 
     

    Resets the Nuc data.

    Truncates the data added with addNuc()

    Useful so a slice can be modified without making a copy

    Definition at line 673 of file SliceData.cc.

    void libSlice::SliceData::resetQualVal  ) 
     

    Resets the QualVal data.

    Truncates the data added with addQualVal()

    Useful so a slice can be modified without making a copy

    Definition at line 657 of file SliceData.cc.

    void libSlice::SliceData::resetReadId  ) 
     

    Resets the read id data.

    Truncates the data added with addReadId()

    Useful so a slice can be modified without making a copy.

    Note: Any subsequent attempts to flatten the slice for calculations will potentially fail if the readId values are changed to ones that do not occur in the ReadManager

    Definition at line 641 of file SliceData.cc.

    void libSlice::SliceData::setDistributionTable double  freqA,
    double  freqC,
    double  freqG,
    double  freqT,
    double  freqGap
     

    Sets the distribution table.

    This is the table used by getConsQV

    Definition at line 90 of file SliceData.cc.

    void libSlice::SliceData::setDoAmbiguity int  doAmbiguity  ) 
     

    Set if consensus and quality class should be based on an ambiguity code.

    0 means no ambiguity
    1 means do minimal Churchill&Waterman
    2 means do minimal Churchill&Waterman and updateAmbiguity
    3 means do minimal Churchill&Waterman and updateAmbiguityConic

    Definition at line 799 of file SliceData.cc.


    The documentation for this class was generated from the following files: