Bio::D...DBI::Pg(3pm)
π Bio::D...DBI::Pg(3pm) π
okay bestie, so this is the manual page for Bio::DB::SeqFeature::Store::DBI::Pg β it lives in the Bio::D...DBI::Pg(3pm) slot in the Perl docs, and it's the whole vibe guide for the PostgreSQL adaptor. pull up a chair, grab a strawberry π, we're doing this.
β¨ NAME β¨
Bio::DB::SeqFeature::Store::DBI::Pg β the PostgreSQL implementation of Bio::DB::SeqFeature::Store. that's it, that's the whole thing, she's a Postgres girlie π
πΈ SYNOPSIS πΈ
here's the whole flow, copy-paste ready, no cap:
use Bio::DB::SeqFeature::Store;
# Open the sequence database
my $db = Bio::DB::SeqFeature::Store->new(-adaptor => 'DBI::Pg',
-dsn => 'dbi:Pg: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);
$db->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);
store it, fetch it, update it, search it every which way, insert some sequence, peek at the types, spin up a brand new feature β it's giving full lifecycle, and we're obsessed. π¦
π DESCRIPTION π
Bio::DB::SeqFeature::Store::Pg is the Pg adaptor for Bio::DB::SeqFeature::Store. and here's the thing β you do not create it directly, bestie. like, don't even try. you go through Bio::DB::SeqFeature::Store->new() and let it handle the adaptor situation. that's the way.
for the complete usage instructions, go read Bio::DB::SeqFeature::Store. she's the main character, this page is just her Pg-flavored bestie. π
π Using the Pg adaptor π
before you can even use the adaptor, you've gotta use the Pgadmin tool to create a database and set up a user account with write permission. and listen β if you want to use "fast" loading, that user account must have "file" privileges. non-negotiable, fr fr. π₯
to establish a connection to the database, call Bio::DB::SeqFeature::Store->new(-adaptor=>'DBI::Pg',@more_args). and the extra args? here's the whole menu, bestie:
-dsnβ the database name. you can abbreviate"dbi:Pg:foo"as"foo"if you want, lowkey convenient.-userβ username for authentication.-passβ password for authentication.-namespaceβ creates a SCHEMA for the tables. this lets you have several virtual databases living inside the same physical database. like roommates but for schemas. π-tempβ boolean flag. if true, a temporary database gets created and destroyed as soon as the Store object goes out of scope. (synonym-temporary) β she's ephemeral, she's a ghost, she's gone the second you look away. π-autoindexβ boolean flag. if true, features in the database get reindexed every time they change. this is the default. yes, by default, every single time. she's thorough like that. β¨-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 the database for writing or updating.
and if all that works out? you get back a shiny new instance of Bio::DB::SeqFeature::Store::DBI::Pg. slay. π«Ά
on top of the standard methods that every well-behaved Bio::DB::SeqFeature::Store database supports, this adaptor also brings a few of her own special moves. those get their own 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::Typename objects
Args : none
Status : public
no args, public, returns you a whole array of Bio::DB::GFF::Typename objects β it's literally just "hey what types are in this database" and she delivers. iconic. π
and that's the whole page, bestie! π this one came from perl v5.40.0, dated 2024-10-11, and it's filed under Bio::D...DBI::Pg(3pm). go forth and Postgres responsibly. mwah. πβ¨
π¦ 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