Bio::S...dedSeq(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

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::EncodedSeq object πŸ’–
  • 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 says G or B but 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 matching G or B in the encoding, then G'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 with Bio::LocatableSeq. heads up though: the coordinates are relative to the encoding DNA sequence, not the implicit protein sequence. and if strand is 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 the new() 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 to 0.
    • 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 the location argument) are relative to the absolute start/end of the Bio::LocatableSeq, or to the internal, relative coordinate system (which begins at 1). defaults to 0, 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::EncodedSeq object, whose encoding consists only of "CCCC..".
  • Args:
    • nogaps β€” strip any gap characters (the ones resulting from 'G' or 'B' encodings) instead of replacing them with N'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::PrimarySeq object.
  • Args: same as the translate() function of Bio::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 of Bio::PrimarySeq. but bestie, note this β€” this function may not be used to set the protein sequence. if you wanna do that, go see the dnaseq() 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 the new() 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