Bio::D...ariaDB(3pm)
π 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 toFile::Spec->tmpdir(). (synonyms-dump_dir,-dumpdir,-tmp)-dbi_optionsβ a hashref you pass toDBI->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::Typenameobjects - 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::Typenameobjects - 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
- ubuntu resolute: libbio-db-seqfeature-perl 1.7.5-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbio-db-seqfeature-perl 1.7.5-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms