NAME¶
Bio::DB::SeqFeature::Store::memory -- In-memory implementation of
Bio::DB::SeqFeature::Store
SYNOPSIS¶
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);
DESCRIPTION¶
Bio::DB::SeqFeature::Store::memory is the in-memory adaptor for
Bio::DB::SeqFeature::Store. You will not create it directly, but instead use
Bio::DB::SeqFeature::Store->
new() to do so.
See Bio::DB::SeqFeature::Store for complete usage instructions.
Using the memory adaptor¶
Before using the memory adaptor, populate a readable-directory on the file
system with annotation and/or sequence files. The annotation files must be in
GFF3 format, and sholud end in the extension .gff or .gff3. They may be
compressed with "compress", "gzip" or "bzip2"
(in which case the appropriate compression extension must be present as well.)
You may include sequence data inline in the GFF3 files, or put the sequence data
in one or more separate FASTA-format files. These files must end with .fa or
.fasta and may be compressed. Because of the way the adaptor works, you will
get much better performance if you keep the sequence data in separate FASTA
files.
Initialize the database using the -dsn option. This should point to the
directory creating the annotation and sequence files, or to a single GFF3
file. Examples:
# 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.
See Bio::DB::SeqFeature::Store for all the access methods supported by this
adaptor. The various methods for storing and updating features and sequences
into the database are supported, including GFF3 loading support, but since
this is an in-memory adaptor all changes you make will be lost when the script
exits.
types¶
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. Please use the
BioPerl bug tracking system to report bugs.
SEE ALSO¶
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>.
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.