NAME
Bio::Seq::EncodedSeq - subtype of Bio::LocatableSeq to store DNA that encodes a protein
SYNOPSIS
$obj = Bio::Seq::EncodedSeq->new( -seq => $dna,-encoding => "CCCCCCCIIIIICCCCC",-start => 1,-strand => 1,-length => 17 );# splice out (and possibly revcomp) the coding sequence$cds = obj->cds;# obtain the protein translation of the sequence$prot = $obj->translate;# other access/inspection routines as with Bio::LocatableSeq and# Bio::SeqI; note that coordinates are relative only to the DNA# sequence, not it's implicit encoded protein sequence.
DESCRIPTION
Bio::Seq::EncodedSeq is a Bio::LocatableSeq object that holds a DNA sequence as well as information about the coding potential of that DNA sequence. It is meant to be useful in an alignment context, where the DNA may contain frameshifts, gaps and/or introns, or in describing the transcript of a gene. An EncodedSeq provides the ability to access the "spliced" coding sequence, meaning that all introns and gaps are removed, and any frameshifts are adjusted to provide a "clean" CDS.
In order to make simultaneous use of either the DNA or the implicit encoded protein sequence coordinates, please see Bio::Coordinate::EncodingPair.
ENCODING
We use the term "encoding" here to refer to the series of symbols that we use to identify which residues of a DNA sequence are protein-coding (i.e. part of a codon), intronic, part of a 5' or 3', frameshift "mutations", etc. From this information, a Bio::Seq::EncodedSeq is able to "figure out" its translational CDS. There are two sets of coding characters, one termed "implicit" and one termed "explicit".
The "implicit" encoding is a bit simpler than the "explicit" encoding: 'C' is used for any nucleotide that's part of a codon, 'U' for any UTR, etc. The full list is shown below:
Code Meaning---- -------C codingI intronicU untranslatedG gapped (for use in alignments)F a "forward", +1 frameshiftB a "backward", -1 frameshift
The "explicit" encoding is just an expansion of the "implicit" encoding, to denote phase:
Code Meaning---- -------C coding, 1st codon positionD coding, 2nd codon positionE coding, 3rd codon positionI intronic, phase 0 (relative to intron begin)J intronic, phase 1K intronic, phase 2U untranslated 3'UTRV untranslated 5'UTRG gapped (for use in alignments)F a "forward", +1 frameshiftB a "backward", -1 frameshift
Note that the explicit coding is meant to provide easy access to position/phase specific nucleotides:
$obj = Bio::Seq::EncodedSeq->new(-seq => "ACAATCAGACTACG...",-encoding => "CCCCCCIII...");# fetch arrays of nucleotides at each codon position:my @pos1 = $obj->dnaseq(encoding => 'C', explicit => 1);my @pos2 = $obj->dnaseq(encoding => 'D');my @pos3 = $obj->dnaseq(encoding => 'E');# fetch arrays of "3-1" codon dinucleotides, useful for genomic# signature analyses without compounding influences of codon bias:my @pairs = $obj->dnaseq(encoding => 'EC');
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Aaron Mackey
Email [email protected]
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : $obj = Bio::Seq::EncodedSeq->new(-seq => "AGTACGTGTCATG",-encoding => "CCCCCCFCCCCCC",-id => "myseq",-start => 1,-end => 13,-strand => 1);Function: creates a new Bio::Seq::EncodedSeq object from a supplied DNAsequenceReturns : a new Bio::Seq::EncodedSeq objectArgs : seq - primary nucleotide sequence used to encode theprotein; note that any positions involved in agap ('G') or backward frameshift ('B') shouldhave one or more gap characters; if the encodingspecifies G or B, but no (or not enough) gapcharacters exist, *they'll be added*; similarly,if there are gap characters without acorresponding G or B encoding, G's will beinserted into the encoding. This allows someflexibility in specifying your sequence andcoding without having to calculate a lot of theencoding for yourself.encoding - a string of characters (see Encoding Table)describing backwards frameshifts implied by theencoding but not present in the sequence will beadded (as '-'s) to the sequence. If notsupplied, it will be assumed that all positionsare coding (C). Encoding may include eitherimplicit phase encoding characters (i.e. "CCC")and/or explicit encoding characters (i.e. "CDE").Additionally, prefixed numbers may be used todenote repetition (i.e. "27C3I28C").Alternatively, encoding may be a hashrefdatastructure, with encoding characters as keysand Bio::LocationI objects (or arrayrefs ofBio::LocationI objects) as values, e.g.:{ C => [ Bio::Location::Simple->new(1,9),Bio::Location::Simple->new(11,13) ],F => Bio::Location::Simple->new(10,10),} # same as "CCCCCCCCCFCCC"Note that if the location ranges overlap, thebehavior of the encoding will be undefined(well, it will be defined, but only according tothe order in which the hash keys are read, whichis basically undefined ... just don't do that).id, start, end, strand - as with Bio::LocatableSeq; notethat the coordinates are relative to theencoding DNA sequence, not the implicit proteinsequence. If strand is reversed, then theencoding is assumed to be relative to thereverse strand as well.
encoding
Title : encodingUsage : $obj->encoding("CCCCCC");$obj->encoding( -encoding => { I => $location } );$enc = $obj->encoding(-explicit => 1);$enc = $obj->encoding("CCCCCC", -explicit => 1);$enc = $obj->encoding(-location => $location,-explicit => 1,-absolute => 1 );Function: get/set the objects encoding, either globally or by location(s).Returns : the (possibly new) encoding string.Args : encoding - see the encoding argument to the new() function.explicit - whether or not to return explicit phaseinformation in the coding (i.e. "CCC" becomes"CDE", "III" becomes "IJK", etc); defaults to 0.location - optional; location to get/set the encoding.Defaults to the entire sequence.absolute - whether or not the locational elements (eitherin the encoding hashref or the locationargument) are relative to the absolute start/endof the Bio::LocatableSeq, or to the internal,relative coordinate system (beginning at 1);defaults to 0 (i.e. relative)
cds
Title : cdsUsage : $cds = $obj->cds(-nogaps => 1);Function: obtain the "spliced" DNA sequence, by removing anynucleotides that participate in an UTR, forward frameshiftor intron, and replacing any unknown nucleotide implied bya backward frameshift or gap with N's.Returns : a Bio::Seq::EncodedSeq object, with an encoding consisting onlyof "CCCC..".Args : nogaps - strip any gap characters (resulting from 'G' or 'B'encodings), rather than replacing them with N's.
translate
Title : translateUsage : $prot = $obj->translate(@args);Function: obtain the protein sequence encoded by the underlying DNAsequence; same as $obj->cds()->translate(@args).Returns : a Bio::PrimarySeq object.Args : same as the translate() function of Bio::PrimarySeqI
protseq
Title : seqUsage : $protseq = $obj->protseq();Function: obtain the raw protein sequence encoded by the underlyingDNA sequence; This is the same as calling$obj->translate()->seq();Returns : a string of single-letter amino acid codesArgs : same as the seq() function of Bio::PrimarySeq; note that thisfunction may not be used to set the protein sequence; seethe dnaseq() function for that.
dnaseq
Title : dnaseqUsage : $dnaseq = $obj->dnaseq();$obj->dnaseq("ACGTGTCGT", "CCCCCCCCC");$obj->dnaseq(-seq => "ATG",-encoding => "CCC",-location => $loc );@introns = $obj->$dnaseq(-encoding => 'I')Function: get/set the underlying DNA sequence; will overwrite anycurrent DNA and/or encoding information present.Returns : a string of single-letter nucleotide codes, including anygaps implied by the encoding.Args : seq - the DNA sequence to be used as a replacementencoding - the encoding of the DNA sequence (see the new()constructor); defaults to all 'C' if setting anew DNA sequence. If no new DNA sequence isbeing provided, then the encoding is used as a"filter" for which to return fragments ofnon-overlapping DNA that match the encoding.location - optional, the location of the DNA sequence toget/set; defaults to the entire sequence.