Bio::D...ariaDB(3pm)

πŸ“¦
version 1.7.5 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Bio::D...ariaDB(3pm) πŸ’–

okay bestie, so this is the manpage for Bio::DB::SeqFeature::Store::DBI::MariaDB β€” she's part of the User Contributed Perl Documentation, and the manual herself goes by Bio::D...ariaDB(3pm). grab a lil snack, we're getting into it πŸ“


✨ NAME ✨

Bio::DB::SeqFeature::Store::DBI::MariaDB β€” the MariaDB implementation of Bio::DB::SeqFeature::Store. no cap, that's literally her whole job πŸ’…


🌸 SYNOPSIS 🌸

vibe check, here's the whole flow, verbatim, don't @ me:

  use Bio::DB::SeqFeature::Store;

  # Open the sequence database
  my $db = Bio::DB::SeqFeature::Store->new(-adaptor => 'DBI::MariaDB',
                                          -dsn     => 'dbi:MariaDB:test');

  # get a feature from somewhere
  my $feature = Bio::SeqFeature::Generic->new(...);

  # store it
  $db->store($feature) or die "Couldn't store!";

  # primary ID of the feature is changed to indicate its primary ID
  # in the database...
  my $id = $feature->primary_id;

  # get the feature back out
  my $f  = $db->fetch($id);

  # change the feature and update it
  $f->start(100);
  $f->update($f) or die "Couldn't update!";

  # searching...
  # ...by id
  my @features = $db->fetch_many(@list_of_ids);

  # ...by name
  @features = $db->get_features_by_name('ZK909');

  # ...by alias
  @features = $db->get_features_by_alias('sma-3');

  # ...by type
  @features = $db->get_features_by_name('gene');

  # ...by location
  @features = $db->get_features_by_location(-seq_id=>'Chr1',-start=>4000,-end=>600000);

  # ...by attribute
  @features = $db->get_features_by_attribute({description => 'protein kinase'})

  # ...by the GFF "Note" field
  @result_list = $db->search_notes('kinase');

  # ...by arbitrary combinations of selectors
  @features = $db->features(-name => $name,
                            -type => $types,
                            -seq_id => $seqid,
                            -start  => $start,
                            -end    => $end,
                            -attributes => $attributes);

  # ...using an iterator
  my $iterator = $db->get_seq_stream(-name => $name,
                                     -type => $types,
                                     -seq_id => $seqid,
                                     -start  => $start,
                                     -end    => $end,
                                     -attributes => $attributes);

  while (my $feature = $iterator->next_seq) {
    # do something with the feature
  }

  # ...limiting the search to a particular region
  my $segment  = $db->segment('Chr1',5000=>6000);
  my @features = $segment->features(-type=>['mRNA','match']);

  # getting & storing sequence information
  # Warning: this returns a string, and not a PrimarySeq object
  $db->insert_sequence('Chr1','GATCCCCCGGGATTCCAAAA...');
  my $sequence = $db->fetch_sequence('Chr1',5000=>6000);

  # what feature types are defined in the database?
  my @types    = $db->types;

  # create a new feature in the database
  my $feature = $db->new_feature(-primary_tag => 'mRNA',
                                 -seq_id      => 'chr3',
                                 -start      => 10000,
                                 -end        => 11000);

πŸ¦‹ DESCRIPTION πŸ¦‹

Bio::DB::SeqFeature::Store::MariaDB is the MariaDB adaptor for Bio::DB::SeqFeature::Store. and listen β€” you do not create it directly, okay? that's not the move. instead you use Bio::DB::SeqFeature::Store->new() and let her do her thing. main character energy, but off-screen πŸ’…

for the complete usage instructions, go read Bio::DB::SeqFeature::Store. she's the blueprint, fr fr.


πŸŽ€ Using the MariaDB adaptor πŸŽ€

before you can even think about using this adaptor, you have to use the mariadb-admin tool to create a database and set up a user account with write permission. that's step one, non-negotiable. and if you wanna use "fast" loading? then that user account also needs "file" privileges. periodt.

to establish a connection to the database, call Bio::DB::SeqFeature::Store->new(-adaptor=>'DBI::MariaDB',@more_args).

and the additional arguments are as follows, bestie β€” every single one, no skipping:

  • -dsn β€” the database name. you can abbreviate "dbi:mariadb:foo" as "foo" if you want, cute little shortcut ✨
  • -user β€” username for authentication.
  • -pass β€” password for authentication.
  • -namespace β€” a prefix to attach to each table. this is how you get several virtual databases living inside the same physical database. iconic, honestly.
  • -temp β€” boolean flag. if true, a temporary database gets created and destroyed as soon as the Store object goes out of scope. (synonym -temporary)
  • -autoindex β€” boolean flag. if true, features in the database get reindexed every time they change. and yes, this is the default. the grind never stops 🫢
  • -tmpdir β€” directory where temporary files go during "fast" loading. defaults to File::Spec->tmpdir(). (synonyms -dump_dir, -dumpdir, -tmp)
  • -dbi_options β€” a hashref you pass to DBI->connect's 4th argument, the "attributes." (synonyms -options, -dbi_attr)
  • -write β€” pass true to open the database for writing or updating.

if all goes well, you get back a brand new instance of Bio::DB::SeqFeature::Store::DBI::MariaDB. slay.

on top of the standard methods that every well-behaved Bio::DB::SeqFeature::Store database supports, there are also a few adaptor-specific methods. those are the next sections, keep scrolling πŸ’œ


⭐ types ⭐

  • Title: types
  • Usage: @type_list = $db->types
  • Function: get all the types in the database
  • Returns: array of Bio::DB::GFF::Typename objects
  • Args: none
  • Status: public

🌈 toplevel_types 🌈

  • Title: toplevel_types
  • Usage: @type_list = $db->toplevel_types
  • Function: get the toplevel types in the database
  • Returns: array of Bio::DB::GFF::Typename objects
  • Args: none
  • Status: public

this one is similar to types() but it only returns the types of INDEXED (toplevel) features. so like, the VIP section of the type list πŸ‘‘


okay that's the whole page, you made it, I'm so proud of you πŸ₯Ή

and that's a wrap on Bio::D...ariaDB(3pm) β€” this version is straight from perl v5.40.0, dated 2024-10-11. go forth and store your features, bestie, you've got this πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from