Bio::D...memory(3pm)
π Bio::DB::SeqFeature::Store::memory β the manual, but make it make sense π
okay bestie, so this page is Bio::D...memory(3pm) β yeah the title gets truncated because Unix is dramatic like that. It lives in the User Contributed Perl Documentation section, and it's the whole scoop on Bio::DB::SeqFeature::Store::memory. Sit down, hydrate, we're doing Perl π«Ά
β¨ NAME β¨
Bio::DB::SeqFeature::Store::memory β the in-memory implementation of Bio::DB::SeqFeature::Store. literally it just keeps everything in RAM. no cap.
π SYNOPSIS π
here's the vibe, copied exactly because code is sacred:
use Bio::DB::SeqFeature::Store;
# Open the sequence database
my $db = Bio::DB::SeqFeature::Store->new( -adaptor => 'memory',
-dsn => '/var/databases/test');
# search... 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_type('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);
β οΈ bestie READ the comment:fetch_sequencegives you a string, not aPrimarySeqobject. don't come for me, it's in the original π
π¦ DESCRIPTION π¦
Bio::DB::SeqFeature::Store::memory is the in-memory adaptor for Bio::DB::SeqFeature::Store. You do not create it yourself, okay? You let Bio::DB::SeqFeature::Store->new() do it for you. it's giving backstage pass, not front door π
For the complete usage instructions, go read Bio::DB::SeqFeature::Store. that's the main character page, this one is the sidekick π
π Using the memory adaptor π
Before you use the memory adaptor, you gotta populate a readable directory on the file system with your annotation and/or sequence files. it's the pregame, you can't skip it.
- The annotation files have to be in GFF3 format, and they should end in the extension
.gffor.gff3. - They may be compressed with
compress,gziporbzip2β and in that case the matching compression extension has to be there too. yes, both extensions. don't fight it.
You can either include sequence data inline in the GFF3 files, or you can put the sequence data in one or more separate FASTA-format files.
- Those FASTA files must end with
.faor.fasta, and they may be compressed too. - Because of the way the adaptor works, you will get MUCH better performance if you keep the sequence data in separate FASTA files. fr fr, do this. it's the glow-up your runtime deserves β¨
Initialize the database using the -dsn option. It should point to the directory containing the annotation and sequence files, or to a single GFF3 file. Examples, verbatim:
# load all GFF3 and FASTA files located in /var/databases/test directory
$db = Bio::DB::SeqFeature::Store->new( -adaptor => 'memory',
-dsn => '/var/databases/test');
# load the data in a single compressed GFF3 file located at
# /usr/annotations/worm.gf33.gz
$db = Bio::DB::SeqFeature::Store->new( -adaptor => 'memory',
-dsn => '/usr/annotations/worm.gff3.gz');
For compatibility with the Bio::DB::GFF memory adaptor, -gff is recognized as an alias for -dsn. twins π«Ά
Now β see Bio::DB::SeqFeature::Store for all the access methods this adaptor supports. The various methods for storing and updating features and sequences into the database are supported, GFF3 loading support included. BUT. and this is a big but π since this is an in-memory adaptor, all changes you make will be lost when the script exits. poof. gone. no save file, no undo, nothing. write it out if you need it to survive, iykyk.
β types β
okay so this one comes as a little spec sheet, and i'm keeping every line of it:
- Title :
types - Usage :
@type_list = $db->types - Function: Get all the types in the database
- Returns : array of
Bio::DB::GFF::Typenameobjects (arrayref in scalar context) - Args : none
- Status : public
π BUGS π
This is an early version, so there are certainly some bugs. bestie, it's not being shady, it literally says so. Please use the BioPerl bug tracking system to report bugs. π
π SEE ALSO π
the whole friend group:
bioperlBio::DB::SeqFeatureBio::DB::SeqFeature::StoreBio::DB::SeqFeature::GFF3LoaderBio::DB::SeqFeature::SegmentBio::DB::SeqFeature::Store::berkeleydbBio::DB::SeqFeature::Store::DBI::mysql
πΈ AUTHOR πΈ
Lincoln Stein <lstein@cshl.org>. iconic behavior.
Copyright (c) 2006 Cold Spring Harbor Laboratory.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie β perl v5.40.0, dated 2024-10-11, and this adaptation of Bio::D...memory(3pm) ate and left no crumbs π β¨π
π¦ 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