Bio::S...dedSeq(3pm)
Bio::Seq::EncodedSeq π
ok so bestie, welcome to Bio::Seq::EncodedSeq(3pm) β it's part of the User Contributed Perl Documentation and it's literally the DNA-holding, protein-encoding bestie you didn't know you needed π§¬β¨
β¨ NAME β¨
Bio::Seq::EncodedSeq β a subtype of Bio::LocatableSeq that stores DNA which 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 and the tea on that sequence's coding potential. βπ
It's meant to be useful in an alignment context β like when your DNA has frameshifts, gaps, and/or introns (messy queen behavior, honestly) β or when you're describing the transcript of a gene. An EncodedSeq gives you the ability to grab the "spliced" coding sequence, meaning all introns and gaps get removed, and any frameshifts get adjusted so you end up with a "clean" CDS. no cap, it's giving tidy. π§Όβ¨
If you wanna use the DNA coordinates and the implicit encoded protein coordinates at the same time, pls go look at Bio::Coordinate::EncodingPair. π«Ά
π ENCODING π
ok so when we say "encoding" here, we mean the series of symbols we use to flag which residues of a DNA sequence are protein-coding (i.e. part of a codon), intronic, part of a 5' or 3' something, frameshift "mutations", etc. From that info, a Bio::Seq::EncodedSeq is able to "figure out" its translational CDS. main character detective energy ππ
There are two sets of coding characters: one called "implicit" and one called "explicit". π
The "implicit" encoding is a lil simpler than the "explicit" one: 'C' is used for any nucleotide that's part of a codon, 'U' for any UTR, etc. Full list right here bestie: π
Code Meaning
---- -------
C coding
I intronic
U untranslated
G gapped (for use in alignments)
F a "forward", +1 frameshift
B a "backward", -1 frameshift
The "explicit" encoding is just an expansion of the "implicit" encoding, but it denotes phase: β¨
Code Meaning
---- -------
C coding, 1st codon position
D coding, 2nd codon position
E coding, 3rd codon position
I intronic, phase 0 (relative to intron begin)
J intronic, phase 1
K intronic, phase 2
U untranslated 3'UTR
V untranslated 5'UTR
G gapped (for use in alignments)
F a "forward", +1 frameshift
B a "backward", -1 frameshift
ngl, the explicit coding is there to give you 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. π«Άπ
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π« Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
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 amackey@virginia.edu π
π APPENDIX π
okay so this is the part where we go method by method, deep-dive style. every single object method gets its own little spotlight. and bestie, heads up: the internal ones? they usually start with an _ (iykyk). π«Ά
β¨ new β¨
- Title: new
- Usage:
$obj = Bio::Seq::EncodedSeq->new(-seq => "AGTACGTGTCATG",
-encoding => "CCCCCCFCCCCCC",
-id => "myseq",
-start => 1,
-end => 13,
-strand => 1
);
- Function: makes a brand new Bio::Seq::EncodedSeq object out of a DNA sequence you hand it. slay.
- Returns: a new
Bio::Seq::EncodedSeqobject π - Args:
seqβ this is the primary nucleotide sequence that's being used to encode the protein. important note bestie: any positions that are part of a gap ('G') or a backward frameshift ('B') should have one or more gap characters. and if your encoding saysGorBbut there aren't any gap characters (or not enough of them)? they'll be added. same energy the other way β if there are gap characters with no matchingGorBin the encoding, thenG's get inserted into the encoding. this is lowkey a gift because it means you get some flexibility in how you specify your sequence and coding, and you don't have to sit there calculating a ton of the encoding yourself. π§encodingβ a string of characters (peep the Encoding Table) describing backwards frameshifts. any frameshifts that are implied by the encoding but aren't actually present in the sequence will be added (as'-'s) to the sequence. if you don't supply one, it just assumes every position is coding (C). the encoding can include implicit phase encoding characters (like"CCC") and/or explicit encoding characters (like"CDE"). and bonus: prefixed numbers can denote repetition, like"27C3I28C". obsessed. β¨
alternatively, encoding can be a hashref data structure, where the encoding characters are the keys and Bio::LocationI objects (or arrayrefs of Bio::LocationI objects) are the values, like:
{ C => [ Bio::Location::Simple->new(1,9),
Bio::Location::Simple->new(11,13) ],
F => Bio::Location::Simple->new(10,10),
} # same as "CCCCCCCCCFCCC"
okay and here's the β οΈ tea: if the location ranges overlap, the behavior of the encoding is undefined. well β technically it will be defined, but only according to the order in which the hash keys get read, which is basically undefined anyway. so like... just don't do that. π
id,start,end,strandβ same as withBio::LocatableSeq. heads up though: the coordinates are relative to the encoding DNA sequence, not the implicit protein sequence. and ifstrandis reversed, then the encoding is assumed to be relative to the reverse strand too.
β¨ encoding β¨
- Title: encoding
- Usage:
$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 object's encoding β either globally, or by location(s).
- Returns: the (possibly new) encoding string.
- Args:
encodingβ same deal as the encoding argument on thenew()function, go look up there bestie.explicitβ whether or not to return explicit phase information in the coding (so"CCC"becomes"CDE","III"becomes"IJK", etc). defaults to0.locationβ optional! the location to get/set the encoding at. defaults to the entire sequence.absoluteβ whether or not the locational elements (whether they're in the encoding hashref or in thelocationargument) are relative to the absolutestart/endof theBio::LocatableSeq, or to the internal, relative coordinate system (which begins at1). defaults to0, i.e. relative.
β¨ cds β¨
- Title: cds
- Usage:
$cds = $obj->cds(-nogaps => 1);
- Function: gets you the "spliced" DNA sequence. it does this by removing any nucleotides that participate in a UTR, forward frameshift or intron, and replacing any unknown nucleotide implied by a backward frameshift or gap with
N's. it's giving cleanup era. π - Returns: a
Bio::Seq::EncodedSeqobject, whose encoding consists only of"CCCC..". - Args:
nogapsβ strip any gap characters (the ones resulting from'G'or'B'encodings) instead of replacing them withN's.
β¨ translate β¨
- Title: translate
- Usage:
$prot = $obj->translate(@args);
- Function: gets you the protein sequence encoded by the underlying DNA sequence. literally the same thing as
$obj->cds()->translate(@args). no cap. π¦ - Returns: a
Bio::PrimarySeqobject. - Args: same as the
translate()function ofBio::PrimarySeqI.
β¨ protseq β¨
- Title: seq
- Usage:
$protseq = $obj->protseq();
- Function: gets you the raw protein sequence encoded by the underlying DNA sequence. this is the same as calling
$obj->translate()->seq(); - Returns: a string of single-letter amino acid codes.
- Args: same as the
seq()function ofBio::PrimarySeq. but bestie, note this β this function may not be used to set the protein sequence. if you wanna do that, go see thednaseq()function. π
β¨ dnaseq β¨
- Title: dnaseq
- Usage:
$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. warning: it will overwrite any current DNA and/or encoding info that's already there. π
- Returns: a string of single-letter nucleotide codes, including any gaps implied by the encoding.
- Args:
seqβ the DNA sequence to be used as the replacement.encodingβ the encoding of the DNA sequence (check thenew()constructor for the details). defaults to all'C'when you're setting a new DNA sequence. but if you're not providing a new DNA sequence, then the encoding gets used as a "filter" β it decides which fragments of non-overlapping DNA matching that encoding get returned.locationβ optional! the location of the DNA sequence to get/set. defaults to the entire sequence.
and that's a wrap on the whole page, bestie!! πβ¨ this doc was built for perl v5.32.1 and last got a glow-up on 2021-08-15, and yeah, the Bio::S...dedSeq(3pm) name really does get the ellipsis treatment in the footer. iconic. go forth and encode some sequences, you absolute legend. ππ¦π
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms