Bio::D...:mysql(3pm)
π NAME π
Bio::DB::SeqFeature::Store::DBI::mysql β the Mysql implementation of Bio::DB::SeqFeature::Store. This is the page Bio::D...:mysql(3pm), section 3pm, and yes she's iconic π
β¨ SYNOPSIS β¨
use Bio::DB::SeqFeature::Store;
# Open the sequence database
my $db = Bio::DB::SeqFeature::Store->new(-adaptor => 'DBI::mysql',
-dsn => 'dbi:mysql: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::mysql is the Mysql adaptor for Bio::DB::SeqFeature::Store. Okay so important: you do not create her directly, bestie. You use Bio::DB::SeqFeature::Store->new() and that does the matchmaking π«Ά
For the complete usage instructions, go read Bio::DB::SeqFeature::Store. Periodt.
π Using the Mysql adaptor π
Before you can even use the adaptor, you gotta use the mysqladmin tool to create a database and set up a user account with write permission. And if you wanna use "fast" loading, that user account must have "file" privileges too. No shortcuts, the vibes require it π
To establish a connection to the database, call Bio::DB::SeqFeature::Store->new(-adaptor=>'DBI::mysql',@more_args). The additional arguments are as follows:
-dsnβ The database name. You can abbreviate"dbi:mysql:foo"as"foo"if you wish, lowkey convenient.-userβ Username for authentication.-passβ Password for authentication.-namespaceβ A prefix to attach to each table. This is how you get to have several virtual databases living inside the same physical database, which is honestly so main character β¨-tempβ Boolean flag. If true, a temporary database will be created and destroyed as soon as the Store object goes out of scope. (synonym-temporary)-autoindexβ Boolean flag. If true, features in the database will be reindexed every time they change. This is the default.-tmpdirβ Directory in which to place temporary files during"fast"loading. Defaults toFile::Spec->tmpdir(). (synonyms-dump_dir,-dumpdir,-tmp)-dbi_optionsβ A hashref to pass toDBI->connect's 4th argument, the"attributes."(synonyms-options,-dbi_attr)-writeβ Pass true to open database for writing or updating.
If it all works out, a new instance of Bio::DB::SeqFeature::Store::DBI::mysql will be returned π¦
On top of the standard methods that every well-behaved Bio::DB::SeqFeature::Store database supports, there are several following adaptor-specific methods provided. They're described in the next sections, keep scrolling bestie π
πΈ 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 is similar to types() but only returns the types of INDEXED (toplevel) features. Not me being picky about which features make the cut π
And that's the whole page, bestie! This lil gem is living under perl v5.40.0, dated 2024-10-11, from the Bio::D...:mysql(3pm) manual β go forth and query, you absolute legend ππ
π¦ 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