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

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

πŸ’– 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_sequence gives you a string, not a PrimarySeq object. 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 .gff or .gff3.
  • They may be compressed with compress, gzip or bzip2 β€” 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 .fa or .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::Typename objects (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:

  • bioperl
  • Bio::DB::SeqFeature
  • Bio::DB::SeqFeature::Store
  • Bio::DB::SeqFeature::GFF3Loader
  • Bio::DB::SeqFeature::Segment
  • Bio::DB::SeqFeature::Store::berkeleydb
  • Bio::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