iPE::Sequence(3)

NAME
iPE::Sequence - base class for biological sequences, including consensus sequences.

DESCRIPTION
Construction of these objects require an iPE::SequenceReader object. This provides major functionality for single sequences which can be read with a standard fasta file. All objects which claim to be a sequence for estimation in iPE must have the functions below defined.

VARIABLES

@alphabet
    The letters of the sequence which represent a single letter. getAlphabet () returns the array.

%ambigCodes
    The ambiguity codes of the alphabet, represented as a hash of array references. This should include the wildcard character.

$wildCard
    The character which represents any letter in the alphabet.

CLASS METHODS

getAlphabet (), getAmbigCodes (), getWildCard ()
    Gets the above global variables as defined by the calling class. getAlphabet and getAmbigCodes return references, whereas getWildCard returns a string containing the wildcard character.

expandAmbigSeq (sequence, exclusionList)
    Expands an ambiguity sequence to all its possible sequences. Pass in a reference to an array of ambiguity codes that you do not want resolved to ignore those ambiguity codes. Returns an array of sequences which represent the expansion of the sequence.

ambigSeqToRegExp (seq[, strictWildCard])
    Converts any ambiguity sequence (including wildcard characters) into a regular expression and returns it. If you pass 1 for strictWildCard, the wildCard character will only match sequences in the original alphabet. Otherwise the wildcard character will match any character.

ambigSeqRegExp
    Gives a regular expression that will detect if any ambiguity code exists in a string.

generateWildCardSeq (length)
    Generate a sequence of characters with only the wildcards included.

getAllSequences (length[, ambiguate])
    Returns all the sequences for a given length by expanding the wildcard sequence of the given length. If the 'ambiguate' flag is set to 1, then the results will include the wildcard caracter of the alphabet.

METHODS

new ({sr => sequenceReader})
    The constructor of a sequence takes a hash reference that is required to contain a SequenceReader object. The SequenceReader object will not be advanced to the next sequence in the SequenceReader file after construction.

writeFeatureToFH (fh, feature), writeRegionToFH (fh, region)
    This writes out the sequence for a feature to the filehandle. By default, this assumes a simple sequence, but if a sequence needs extra coercing, you must override this method.

length ()
    This returns the length of the sequence. This is passed on from the sequence reader.

def ()
    Return a reference to the definition string of this sequence.

loaded ()
    Indicates whether the sequence is loaded into memory. If 1, the seqRef and rcRef strings should be valid, if not, you may access the sequences via the getContext function.

seqRef ()
    Return a *reference* to the sequence string. The sequence string is a reference to prevent unwanted copying of long sequences. In the case where this is a complex datatype and not just a string, this should be overridden to return an object reference.

rcRef ()
    Return a reference to the reverse complement (or just reverse) of the sequence. Note that this is not implemented in the base class, and must be overridden in all subclasses.

seqReader ()
    In the case that the sequence has not been loaded, you may use the sequence reader to retrieve parts of the sequence needed.

type ()
    All sequences should have a brief tag for the english description of the type of sequence for matching up with the parameter template file. For example, plain DNA sequence is "DNA". This is not defined in the base class, and all Sequence subclasses must define this.

getContext (pos, strand, context[, targetContext])
    Gets the context encoded into a single space-delimited (by position) string. Optionally pass a target context if you want a different context size for the target. The missing letters will be replaced with "X"s. Here is an example which illustrates the encoding:

    Alignment: T: AT I1:CG I2:GC

    Encoding of getContext(1,"+",1): ACG TGC

    Encoding of getContext(1,"+",0,1): AXX TGC

SEE ALSO
iPE::SequenceReader

AUTHOR
Bob Zimmermann (rpz@cse.wustl.edu).