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

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

🌸 Bio::Seq::Meta::Array 🌸

part of the Perl User Contributed Documentation, manual section 3pm β€” yes bestie, that's the Bio::S...::Array(3pm) you clicked on, the terminal just truncates it like that 😭


✨ NAME ✨

Bio::Seq::Meta::Array β€” array-based generic implementation of a sequence class with residue-based meta information


πŸ¦‹ SYNOPSIS πŸ¦‹

use Bio::LocatableSeq;
use Bio::Seq::Meta::Array;

my $seq = Bio::Seq::Meta::Array->new(-id=>'test',
                                 -seq=>'ACTGCTAGCT',
                                 -start=>2434,
                                 -start=>2443,
                                 -strand=>1,
                                 -verbose=>1, # to see warnings
                                );

# to test this is a meta seq object
$seq->isa("Bio::Seq::Meta::Array")
    || $seq->throw("$seq is not a Bio::Seq::Meta::Array");

$seq->meta('1 2 3 4 5 6 7 8 9 10');

# or you could create the Meta object directly
$seq = Bio::Seq::Meta::Array->new(-id=>'test',
                                  -seq=>'ACTGCTAGCT',
                                  -start=>2434,
                                  -start=>2443,
                                  -strand=>1,
                                  -meta=>'1 2 3 4 5 6 7 8 9 10',
                                  -verbose=>1, # to see warnings
                                 );

# accessors
$arrayref   = $seq->meta();
$string     = $seq->meta_text();
$substring  = $seq->submeta_text(2,5);
$unique_key = $seq->accession_number();

πŸ’… DESCRIPTION πŸ’…

Okay so, this class is the generic methods era for sequences that carry residue-based meta information ✨ Meta sequences with meta data are literally Bio::LocatableSeq objects, but with extra methods bolted on to store that meta info. Go look at Bio::LocatableSeq and Bio::Seq::MetaI for the receipts 🫢

The meta information in this class can be a string of variable length and can be a whole complex structure β€” it's giving flexible, ngl. Blank values are undef or zero.

Application specific implementations should inherit from this class to override and add to these methods. That's your moment, go be the main character πŸŽ€

This class can be used for storing sequence quality values, but Bio::Seq::Quality has named methods that make it easier. So like… iykyk, use the right tool bestie πŸ’–


🌈 SEE ALSO 🌈

Bio::LocatableSeq, Bio::Seq::MetaI, Bio::Seq::Meta, Bio::Seq::Quality


⚠️ NOTE ⚠️

This Bio::Seq::MetaI implementation inherits from Bio::LocatableSeq, which itself inherits from Bio::PrimarySeq. It is not a Bio::SeqI, so bless-ing objects of this class into a Bio::SeqI or vice versa and will not work as expected (see bug 2262). This may be addressed in a future refactor of Bio::LocatableSeq.

🚨 fr fr, do not try to cross-bless these. It will not slay. It will break. See bug 2262.

πŸ’Œ 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.

bestie, please go through the list first πŸ™ˆ the maintainers are doing their best, and the list has experts who will clock the problem in seconds. Code and data examples = iconic behavior.

πŸ› 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 - Heikki Lehvaslaiho πŸ‘‘

Email heikki-at-bioperl-dot-org


🌟 CONTRIBUTORS 🌟

Chad Matsalla, bioinformatics@dieselwurks.com Aaron Mackey, amackey@virginia.edu


🧚 APPENDIX 🧚

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


πŸ“ new

Title   : new
Usage   : $metaseq = Bio::Seq::Meta::Array->new
              ( -meta => 'aaaaaaaabbbbbbbb',
                -seq =>  'TKLMILVSHIVILSRM'
                -id  => 'human_id',
                -accession_number => 'S000012',
              );
Function: Constructor for Bio::Seq::Meta::Array class, meta data being in a
          string. Note that you can provide an empty quality string.
Returns : a new Bio::Seq::Meta::Array object

πŸ“ meta

Title   : meta
Usage   : $meta_values  = $obj->meta($values_string);
Function:

          Get and set method for the meta data starting from residue
          position one. Since it is dependent on the length of the
          sequence, it needs to be manipulated after the sequence.

          The length of the returned value always matches the length
          of the sequence.

Returns : reference to an array of meta data
Args    : new value, string or array ref, optional

πŸ“ meta_text

Title   : meta_text
Usage   : $meta_values  = $obj->meta_text($values_arrayref);
Function: Variant of meta() guarantied to return a string
          representation  of meta data. For details, see L<meta>.
Returns : a string
Args    : new value, string or array ref, optional

πŸ“ named_meta

Title   : named_meta()
Usage   : $meta_values  = $obj->named_meta($name, $values_arrayref);
Function: A more general version of meta(). Each meta data set needs
          to be named. See also L<meta_names>.
Returns : reference to an array of meta data
Args    : scalar, name of the meta data set
          new value, string or array ref, optional

πŸ“ _test_gap_positions

Title   : _test_gap_positions
Usage   : $meta_values  = $obj->_test_gap_positions($name);
Function: Internal test for correct position of gap characters.
          Gap being only '-' this time.

          This method is called from named_meta() when setting meta
          data but only if verbose is positive as this can be an
          expensive process on very long sequences. Set verbose(1) to
          see warnings when gaps do not align in sequence and meta
          data and turn them into errors by setting verbose(2).

Returns : true on success, prints warnings
Args    : none
πŸ‘€ internal method alert! And heads up: this one can get expensive on very long sequences, which is exactly why it only runs when verbose is positive. verbose(1) = warnings, verbose(2) = full on errors. Choose your fighter πŸ’€

πŸ“ named_meta_text

Title   : named_meta_text()
Usage   : $meta_values  = $obj->named_meta_text($name, $values_arrayref);
Function: Variant of named_meta() guarantied to return a textual
          representation  of the named meta data.
          For details, see L<meta>.
Returns : a string
Args    : scalar, name of the meta data set
          new value, string or array ref, optional

πŸ“ submeta

Title   : submeta
Usage   : $subset_of_meta_values = $obj->submeta(10, 20, $value_string);
          $subset_of_meta_values = $obj->submeta(10, undef, $value_string);
Function:

          Get and set method for meta data for subsequences.

          Numbering starts from 1 and the number is inclusive, ie 1-2
          are the first two residue of the sequence. Start cannot be
          larger than end but can be equal.

          If the second argument is missing the returned values
          should extend to the end of the sequence.

          The return value may be a string or an array reference,
          depending on the implementation. If in doubt, use
          submeta_text() which is a variant guarantied to return a
          string.  See L<submeta_text>.

Returns : A reference to an array or a string
Args    : integer, start position
          integer, end position, optional when a third argument present
          new value, string or array ref, optional
🧠 remember: numbering starts at 1, inclusive, and start can equal end but can never be bigger. If in doubt β†’ submeta_text() πŸ’–

πŸ“ submeta_text

Title   : submeta_text
Usage   : $meta_values  = $obj->submeta_text(20, $value_string);
Function: Variant of submeta() guarantied to return a textual
          representation  of meta data. For details, see L<meta>.
Returns : a string
Args    : new value, string or array ref, optional

πŸ“ named_submeta

Title   : named_submeta
Usage   : $subset_of_meta_values = $obj->named_submeta($name, 10, 20, $value_string);
          $subset_of_meta_values = $obj->named_submeta($name, 10);
Function: Variant of submeta() guarantied to return a textual
          representation  of meta data. For details, see L<meta>.
Returns : A reference to an array or a string
Args    : scalar, name of the meta data set
          integer, start position
          integer, end position, optional when a third argument present (can be undef)
          new value, string or array ref, optional

πŸ“ named_submeta_text

Title   : named_submeta_text
Usage   : $meta_values  = $obj->named_submeta_text($name, 20, $value_string);
Function: Variant of submeta() guarantied to return a textual
          representation  of meta data. For details, see L<meta>.
Returns : a string
Args    : scalar, name of the meta data
Args    : integer, start position, optional
          integer, end position, optional
          new value, string or array ref, optional

πŸ“ meta_names

Title   : meta_names
Usage   : @meta_names  = $obj->meta_names()
Function: Retrieves an array of meta data set names. The default
          (unnamed) set name is guarantied to be the first name if it
          contains any data.
Returns : an array of names
Args    : none

πŸ“ meta_length

Title   : meta_length()
Usage   : $meta_len  = $obj->meta_length();
Function: return the number of elements in the meta set
Returns : integer
Args    : -

πŸ“ named_meta_length

Title   : named_meta_length()
Usage   : $meeta_len  = $obj->named_meta_length($name);
Function: return the number of elements in the named meta set
Returns : integer
Args    : -

πŸ“ force_flush

Title   : force_flush()
Usage   : $force_flush = $obj->force_flush(1);
Function: Automatically pad with empty values or truncate meta values
          to sequence length. Not done by default.
Returns : boolean 1 or 0
Args    : optional boolean value

Note that if you turn this forced padding off, the previously padded values are not changed.

πŸ’€ key detail bestie: turning it off does not un-pad anything you already padded. The past is the past, periodt.

πŸ“ _do_flush

Title   : _do_flush
Usage   :
Function: internal method to do the force that meta values are same
          length as sequence . Called from L<force_flush>
Returns :
Args    :

πŸ“ is_flush

Title   : is_flush
Usage   : $is_flush  = $obj->is_flush()
          or  $is_flush = $obj->is_flush($my_meta_name)
Function: Boolean to tell if all meta values are in
          flush with the sequence length.
          Returns true if force_flush() is set
          Set verbosity to a positive value to see failed meta sets
Returns : boolean 1 or 0
Args    : optional name of the meta set

…and that's part one, bestie β€” more coming πŸ’œ

🌸 Bio::PrimarySeqI methods 🌸


πŸ’« revcom

  • Title β€” revcom
  • Usage β€” $newseq = $seq->revcom();
  • Function β€” bestie it makes you a whole new Bio::Seq::MetaI implementing object, where the residues AND their meta info get flipped into reverse order. the way that it reverses literally everything ✨
  • Returns β€” a brand new (fresh out the box, no cap) Bio::Seq::Meta object
  • Args β€” none. zero. nada. she takes no arguments πŸ’…
  • Throws β€” if the object returns false on is_flush() 😭 like she will throw hands
Note: the method does nothing to the actual meta values β€” it only reorders them. so the vibes stay the same, just the lineup changes πŸŽ€

πŸ¦‹ trunc

  • Title β€” trunc
  • Usage β€” $subseq = $seq->trunc(10,100);
  • Function β€” gives you a truncation of a sequence, meta data included, all bundled together 🫢
  • Returns β€” a fresh Bio::Seq::Meta implementing object
  • Args β€” two integers, denoting the first and last residue of the sub-sequence. just two numbers and she's ready 🧚

that's the whole page bestie, you ate it πŸ’…βœ¨ this little cutie was served up by perl v5.32.1, dated 2021-08-15, and it lives under the name Bio::S...::Array(3pm) β€” iconic, obsessed, periodt πŸ’–

πŸ“¦ where this page comes from