Bio::D...Loader(3pm)
π Bio::D...Loader β the manual page, but make it slay β¨
okay bestie, so this is Bio::DB::SeqFeature::Store::Loader from the User Contributed Perl Documentation section of the perl manpages (section 3pm, iykyk) β and it's literally the loader for SeqFeature stores. grab a boba, we're going in π§
πΈ NAME πΈ
Bio::DB::SeqFeature::Store::Loader β Loader π
β¨ SYNOPSIS β¨
# non-instantiable base class
no cap, that's the whole synopsis. it's a base class. you don't instantiate it directly, bestie π«Ά
π¦ DESCRIPTION π¦
so this is the base class for three lil modules that do the actual work:
Bio::DB::SeqFeature::Loader::GFF3LoaderBio::DB::SeqFeature::Loader::GFFLoaderBio::DB::SeqFeature::Loader::FeatureFileLoader
please go read the manual pages for those modules, okay? this one is just the parent vibes π
π new π
Title : new
Usage : $loader = Bio::DB::SeqFeature::Store::GFF3Loader->new(@options)
Function: create a new parser
Returns : a Bio::DB::SeqFeature::Store::GFF3Loader gff3 parser and loader
Args : several - see below
Status : public
this method creates a new GFF3 loader and establishes its connection with a Bio::DB::SeqFeature::Store database. the arguments are -name=>$value pairs, like this:
| Name | Value |
...jk we don't do tables here, so here's the list bestie π:
-storeβ a writableBio::DB::SeqFeature::Storedatabase handle.-seqfeature_classβ the name of the type ofBio::SeqFeatureIobject to create and store in the database (Bio::DB::SeqFeatureby default).-sf_classβ a shorter alias for-seqfeature_class.-verboseβ send progress information to standard error.-fastβ if true, activate fast loading (see below β¬οΈ).-chunk_sizeβ set the storage chunk size for nucleotide/protein sequences (default2000bytes).-tmpβ indicate a temporary directory to use when loading non-normalized features.-map_coordsβ a code ref that will transform a list of($ref,[$start1,$end1]...)coordinates into a list of($newref,[$newstart1,$newend1]...).-index_subfeaturesβ indicate true if subfeatures should be indexed. default is true.-summary_statsβ rebuild summary stats at the end of loading (not incremental, so it takes a long time π).
when you call new(), a connection to a Bio::DB::SeqFeature::Store database should already have been established and the database initialized (if appropriate). no skipping steps, bestie π«Ά
some combos of Bio::SeqFeatures and Bio::DB::SeqFeature::Store databases support a fast loading mode. rn the only reliable implementation of fast loading is the combination of DBI::mysql with Bio::DB::SeqFeature. the other big restriction on fast loading is that a feature that contains subfeatures must occur in the GFF3 file before any of its subfeatures. otherwise the subfeatures that occurred before the parent feature will not be attached to the parent correctly. this restriction does not apply to normal (slow) loading. okay periodt π
if you use an unnormalized feature class, like Bio::SeqFeature::Generic, then the loader needs to create a temporary database to cache features in until all their parts and subparts have been seen. this temporary database uses the "berkeleydb" adaptor. the -tmp option specifies the directory where that database gets created. if it's not present, it defaults to the system default tmp directory specified by File::Spec->tmpdir().
the -chunk_size option lets you tune the representation of DNA/Protein sequence in the Store database. by default, sequences get split into 2000 base/residue chunks and then reassembled as needed. this avoids the problem of pulling a whole chromosome into memory just to fetch a short subsequence from somewhere in the middle. depending on your usage patterns, you may wish to tune this parameter with a chunk size larger or smaller than the default. tune it, bestie, it's giving optimization π
π load π
Title : load
Usage : $count = $loader->load(@ARGV)
Function: load the indicated files or filehandles
Returns : number of feature lines loaded
Args : list of files or filehandles
Status : public
once the loader is created, invoke its load() method with a list of GFF3 or FASTA file paths, or previously-opened filehandles, to load them into the database. compressed files ending with .gz, .Z and .bz2 are automatically recognized and uncompressed on the fly. paths beginning with http: or ftp: are treated as URLs and opened using the LWP GET program (which must be on your path). yes queen, it does the fetching for you β¨
FASTA files are recognized by their initial ">" character. do not feed the loader a file that is neither GFF3 nor FASTA; I don't know what will happen, but it will probably not be what you expect. π
π§ accessors π§
the following read-only accessors return values passed or created during new():
store()β the long-termBio::DB::SeqFeature::Storeobjecttmp_store()β the temporaryBio::DB::SeqFeature::Storeobject used during loadingsfclass()β theBio::SeqFeatureIclassfast()β whether fast loading is activeseq_chunk_size()β the sequence chunk sizeverbose()β verbose progress messages
π Internal Methods π
the following methods are used internally and may be overridden by subclasses. (main character energy for subclass authors only, bestie)
default_seqfeature_class
$class = $loader->default_seqfeature_class
return the default SeqFeatureI class (Bio::DB::SeqFeature).
subfeatures_normalized
$flag = $loader->subfeatures_normalized([$new_flag])
get or set a flag that indicates that the subfeatures are normalized. this is deduced from the SeqFeature class information.
subfeatures_in_table
$flag = $loader->subfeatures_in_table([$new_flag])
get or set a flag that indicates that feature/subfeature relationships are stored in a table. this is deduced from the SeqFeature class and Store information.
load_fh
$count = $loader->load_fh($filehandle)
load the GFF3 data at the other end of the filehandle and return true if successful. internally, load_fh() invokes:
start_load();
do_load($filehandle);
finish_load();
start_load, finish_load
these methods are called at the start and end of a filehandle load.
build_summary
$loader->build_summary
call this to rebuild the summary coverage statistics. this is done automatically if new() was passed a true value for -summary_stats at create time.
do_load
$count = $loader->do_load($fh)
this is called by load_fh() to load the GFF3 file's filehandle and return the number of lines loaded.
load_line
$loader->load_line($data);
load a line of a GFF3 file. you must bracket this with calls to start_load() and finish_load()!
$loader->start_load();
$loader->load_line($_) while <FH>;
$loader->finish_load();
handle_feature
$loader->handle_feature($data_line)
this method is called to process a single data line. it manipulates information stored in a data structure called $self->{load_data}.
handle_meta
$loader->handle_meta($data_line)
this method is called to process a single data line. it manipulates information stored in a data structure called $self->{load_data}.
store_current_feature
$loader->store_current_feature()
this method is called to store the currently active feature in the database. it uses a data structure stored in $self->{load_data}.
parse_attributes
($reserved,$unreserved) = $loader->parse_attributes($attribute_line)
this method parses the information contained in the $attribute_line into two hashrefs, one containing the values of reserved attribute tags (e.g. ID) and the other containing the values of unreserved ones.
start_or_finish_sequence
$loader->start_or_finish_sequence('Chr9')
this method is called at the beginning and end of a fasta section.
load_sequence
$loader->load_sequence('gatttcccaaa')
this method is called to load some amount of sequence after start_or_finish_sequence() is first called.
open_fh
my $io_file = $loader->open_fh($filehandle_or_path)
this method opens up the indicated file or pipe, using some intelligence to recognize compressed files and URLs and doing the right thing. π
loaded_ids
my $ids = $loader->loaded_ids;
my $id_cnt = @$ids;
after performing a load, this returns an array ref containing all the feature primary ids that were created during the load.
local_ids
my $ids = $self->local_ids;
my $id_cnt = @$ids;
after performing a load, this returns an array ref containing all the load file IDs that were contained within the file just loaded.
time
my $time = $loader->time
this method returns the current time in seconds, using Time::HiRes if available.
unescape
my $unescaped = GFF3Loader::unescape($escaped)
this is an internal utility. it's the same as CGI::Util::unescape, but doesn't change pluses into spaces and ignores unicode escapes.
π BUGS π
this is an early version, so there are certainly some bugs. please use the BioPerl bug tracking system to report bugs. (not me being the bug reporter, bestie, use the tracker π)
π«Ά SEE ALSO π«Ά
bioperlBio::DB::SeqFeature::StoreBio::DB::SeqFeature::SegmentBio::DB::SeqFeature::NormalizedFeatureBio::DB::SeqFeature::Store::GFF3LoaderBio::DB::SeqFeature::Store::DBI::mysqlBio::DB::SeqFeature::Store::berkeleydb
β 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.
and that's the whole page, bestie π sign-off time: this was perl v5.40.0, dated 2024-10-11, from the Bio::D...Loader(3pm) manual. go load some features, you've got this πβ¨π¦
π¦ 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