.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Bio::DB::SeqFeature::Store::GFF3Loader 3pm" .TH Bio::DB::SeqFeature::Store::GFF3Loader 3pm "2020-01-13" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Bio::DB::SeqFeature::Store::GFF3Loader \-\- GFF3 file loader for Bio::DB::SeqFeature::Store .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Bio::DB::SeqFeature::Store; \& use Bio::DB::SeqFeature::Store::GFF3Loader; \& \& # Open the sequence database \& my $db = Bio::DB::SeqFeature::Store\->new( \-adaptor => \*(AqDBI::mysql\*(Aq, \& \-dsn => \*(Aqdbi:mysql:test\*(Aq, \& \-write => 1 ); \& \& my $loader = Bio::DB::SeqFeature::Store::GFF3Loader\->new(\-store => $db, \& \-verbose => 1, \& \-fast => 1); \& \& $loader\->load(\*(Aq./my_genome.gff3\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Bio::DB::SeqFeature::Store::GFF3Loader object parsers GFF3\-format sequence annotation files and loads Bio::DB::SeqFeature::Store databases. For certain combinations of SeqFeature classes and SeqFeature::Store databases it features a \*(L"fast load\*(R" mode which will greatly accelerate the loading of \s-1GFF3\s0 databases by a factor of 5\-10. .PP The \s-1GFF3\s0 file format has been extended very slightly to accommodate Bio::DB::SeqFeature::Store. First, the loader recognizes is a new directive: .PP .Vb 1 \& # #index\-subfeatures [0|1] .Ve .PP Note that you can place a space between the two #'s in order to prevent \s-1GFF3\s0 validators from complaining. .PP If this is true, then subfeatures are indexed (the default) so that they can be retrieved with a query. See Bio::DB::SeqFeature::Store for an explanation of this. If false, then subfeatures can only be accessed through their parent feature. .PP Second, the loader recognizes a new attribute tag called index, which if present, controls indexing of the current feature. Example: .PP .Vb 1 \& ctg123 . TF_binding_site 1000 1012 . + . ID=tfbs00001;index=1 .Ve .PP You can use this to turn indexing on and off, overriding the default for a particular feature. .PP Note that the loader keeps a record \*(-- in memory \*(-- of each feature that it has processed. If you find the loader running out of memory on particularly large \s-1GFF3\s0 files, please split the input file into smaller pieces and do the load in steps. .SS "new" .IX Subsection "new" .Vb 6 \& 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 .Ve .PP This method creates a new \s-1GFF3\s0 loader and establishes its connection with a Bio::DB::SeqFeature::Store database. Arguments are \-name=>$value pairs as described in this table: .PP .Vb 2 \& Name Value \& \-\-\-\- \-\-\-\-\- \& \& \-store A writable Bio::DB::SeqFeature::Store database handle. \& \& \-seqfeature_class The name of the type of Bio::SeqFeatureI object to create \& and store in the database (Bio::DB::SeqFeature by 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 \& (default 2000 bytes) \& \& \-tmp Indicate a temporary directory to use when loading non\-normalized \& features. \& \& \-ignore_seqregion Ignore ##sequence\-region directives. The default is to create a \& feature corresponding to the directive. \& \& \-noalias_target Don\*(Aqt create an Alias attribute for a target_id named in a \& Target attribute. The default is to create an Alias \& attribute containing the target_id found in a Target \& attribute. .Ve .PP When you call \fBnew()\fR, a connection to a Bio::DB::SeqFeature::Store database should already have been established and the database initialized (if appropriate). .PP Some combinations of Bio::SeqFeatures and Bio::DB::SeqFeature::Store databases support a fast loading mode. Currently the only reliable implementation of fast loading is the combination of DBI::mysql with Bio::DB::SeqFeature. The other important restriction on fast loading is the requirement that a feature that contains subfeatures must occur in the \s-1GFF3\s0 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. .PP If you use an unnormalized feature class, such as Bio::SeqFeature::Generic, then the loader needs to create a temporary database in which to cache features until all their parts and subparts have been seen. This temporary databases uses the \*(L"berkeleydb\*(R" adaptor. The \-tmp option specifies the directory in which that database will be created. If not present, it defaults to the system default tmp directory specified by File::Spec\->\fBtmpdir()\fR. .PP The \-chunk_size option allows you to tune the representation of DNA/Protein sequence in the Store database. By default, sequences are split into 2000 base/residue chunks and then reassembled as needed. This avoids the problem of pulling a whole chromosome into memory in order to fetch a short subsequence from somewhere in the middle. Depending on your usage patterns, you may wish to tune this parameter using a chunk size that is larger or smaller than the default. .SS "ignore_seqregion" .IX Subsection "ignore_seqregion" .Vb 1 \& $ignore_it = $loader\->ignore_seqregion([$new_flag]) .Ve .PP Get or set the ignore_seqregion flag, which if true, will cause \&\s-1GFF3\s0 ##sequence\-region directives to be ignored. The default behavior is to create a feature corresponding to the region. .SS "noalias_target" .IX Subsection "noalias_target" .Vb 1 \& $noalias_target = $loader\->noalias_target([$new_flag]) .Ve .PP Get or set the noalias_target flag, which if true, will disable the creation of an Alias attribute for a target_id named in a Target attribute. The default is to create an Alias attribute containing the target_id found in a Target attribute. .SS "load" .IX Subsection "load" .Vb 6 \& 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 .Ve .PP Once the loader is created, invoke its \fBload()\fR method with a list of \&\s-1GFF3\s0 or \s-1FASTA\s0 file paths or previously-opened filehandles in order 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 \&\s-1LWP GET\s0 program (which must be on your path). .PP \&\s-1FASTA\s0 files are recognized by their initial \*(L">\*(R" character. Do not feed the loader a file that is neither \s-1GFF3\s0 nor \s-1FASTA\s0; I don't know what will happen, but it will probably not be what you expect. .SS "accessors" .IX Subsection "accessors" The following read-only accessors return values passed or created during \fBnew()\fR: .PP .Vb 1 \& store() the long\-term Bio::DB::SeqFeature::Store object \& \& tmp_store() the temporary Bio::DB::SeqFeature::Store object used \& during loading \& \& sfclass() the Bio::SeqFeatureI class \& \& fast() whether fast loading is active \& \& seq_chunk_size() the sequence chunk size \& \& verbose() verbose progress messages .Ve .SS "Internal Methods" .IX Subsection "Internal Methods" The following methods are used internally and may be overridden by subclasses. .IP "default_seqfeature_class" 4 .IX Item "default_seqfeature_class" .Vb 1 \& $class = $loader\->default_seqfeature_class .Ve .Sp Return the default SeqFeatureI class (Bio::DB::SeqFeature). .IP "subfeatures_normalized" 4 .IX Item "subfeatures_normalized" .Vb 1 \& $flag = $loader\->subfeatures_normalized([$new_flag]) .Ve .Sp Get or set a flag that indicates that the subfeatures are normalized. This is deduced from the SeqFeature class information. .IP "subfeatures_in_table" 4 .IX Item "subfeatures_in_table" .Vb 1 \& $flag = $loader\->subfeatures_in_table([$new_flag]) .Ve .Sp 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. .IP "load_fh" 4 .IX Item "load_fh" .Vb 1 \& $count = $loader\->load_fh($filehandle) .Ve .Sp Load the \s-1GFF3\s0 data at the other end of the filehandle and return true if successful. Internally, \fBload_fh()\fR invokes: .Sp .Vb 3 \& start_load(); \& do_load($filehandle); \& finish_load(); .Ve .IP "start_load, finish_load" 4 .IX Item "start_load, finish_load" These methods are called at the start and end of a filehandle load. .IP "do_load" 4 .IX Item "do_load" .Vb 1 \& $count = $loader\->do_load($fh) .Ve .Sp This is called by \fBload_fh()\fR to load the \s-1GFF3\s0 file's filehandle and return the number of lines loaded. .IP "load_line" 4 .IX Item "load_line" .Vb 1 \& $loader\->load_line($data); .Ve .Sp Load a line of a \s-1GFF3\s0 file. You must bracket this with calls to \&\fBstart_load()\fR and \fBfinish_load()\fR! .Sp .Vb 3 \& $loader\->start_load(); \& $loader\->load_line($_) while ; \& $loader\->finish_load(); .Ve .IP "handle_meta" 4 .IX Item "handle_meta" .Vb 1 \& $loader\->handle_meta($meta_directive) .Ve .Sp This method is called to handle meta-directives such as ##sequence\-region. The method will receive the directive with the initial ## stripped off. .IP "handle_feature" 4 .IX Item "handle_feature" .Vb 1 \& $loader\->handle_feature($gff3_line) .Ve .Sp This method is called to process a single \s-1GFF3\s0 line. It manipulates information stored a data structure called \f(CW$self\fR\->{load_data}. .IP "allow_whitespace" 4 .IX Item "allow_whitespace" .Vb 1 \& $allow_it = $loader\->allow_whitespace([$newvalue]); .Ve .Sp Get or set the allow_whitespace flag. If true, then \s-1GFF3\s0 files are allowed to be delimited with whitespace in addition to tabs. .IP "store_current_feature" 4 .IX Item "store_current_feature" .Vb 1 \& $loader\->store_current_feature() .Ve .Sp This method is called to store the currently active feature in the database. It uses a data structure stored in \f(CW$self\fR\->{load_data}. .IP "build_object_tree" 4 .IX Item "build_object_tree" .Vb 1 \& $loader\->build_object_tree() .Ve .Sp This method gathers together features and subfeatures and builds the graph that connects them. .IP "build_object_tree_in_tables" 4 .IX Item "build_object_tree_in_tables" .Vb 1 \& $loader\->build_object_tree_in_tables() .Ve .Sp This method gathers together features and subfeatures and builds the graph that connects them, assuming that parent/child relationships will be stored in a database table. .IP "build_object_tree_in_features" 4 .IX Item "build_object_tree_in_features" .Vb 1 \& $loader\->build_object_tree_in_features() .Ve .Sp This method gathers together features and subfeatures and builds the graph that connects them, assuming that parent/child relationships are stored in the seqfeature objects themselves. .IP "attach_children" 4 .IX Item "attach_children" .Vb 1 \& $loader\->attach_children($store,$load_data,$load_id,$feature) .Ve .Sp This recursively adds children to features and their subfeatures. It is called when subfeatures are directly contained within other features, rather than stored in a relational table. .IP "fetch" 4 .IX Item "fetch" .Vb 1 \& my $feature = $loader\->fetch($load_id) .Ve .Sp Given a load \s-1ID\s0 (from the ID= attribute) this method returns the feature from the temporary database or the permanent one, depending on where it is stored. .IP "add_segment" 4 .IX Item "add_segment" .Vb 1 \& $loader\->add_segment($parent,$child) .Ve .Sp This method is used to add a split location to the parent. .IP "parse_attributes" 4 .IX Item "parse_attributes" .Vb 1 \& ($reserved,$unreserved) = $loader\->parse_attributes($attribute_line) .Ve .Sp This method parses the information contained in the \f(CW$attribute_line\fR into two hashrefs, one containing the values of reserved attribute tags (e.g. \s-1ID\s0) and the other containing the values of unreserved ones. .IP "start_or_finish_sequence" 4 .IX Item "start_or_finish_sequence" .Vb 1 \& $loader\->start_or_finish_sequence(\*(AqChr9\*(Aq) .Ve .Sp This method is called at the beginning and end of a fasta section. .IP "load_sequence" 4 .IX Item "load_sequence" .Vb 1 \& $loader\->load_sequence(\*(Aqgatttcccaaa\*(Aq) .Ve .Sp This method is called to load some amount of sequence after \&\fBstart_or_finish_sequence()\fR is first called. .IP "open_fh" 4 .IX Item "open_fh" .Vb 1 \& my $io_file = $loader\->open_fh($filehandle_or_path) .Ve .Sp This method opens up the indicated file or pipe, using some intelligence to recognized compressed files and URLs and doing the right thing. .IP "time" 4 .IX Item "time" .Vb 1 \& my $time = $loader\->time .Ve .Sp This method returns the current time in seconds, using Time::HiRes if available. .IP "unescape" 4 .IX Item "unescape" .Vb 1 \& my $unescaped = GFF3Loader::unescape($escaped) .Ve .Sp This is an internal utility. It is the same as CGI::Util::unescape, but doesn't change pluses into spaces and ignores unicode escapes. .IP "local_ids" 4 .IX Item "local_ids" .Vb 2 \& my $ids = $self\->local_ids; \& my $id_cnt = @$ids; .Ve .Sp After performing a load, this returns an array ref containing all the load file IDs that were contained within the file just loaded. .IP "loaded_ids" 4 .IX Item "loaded_ids" .Vb 2 \& my $ids = $loader\->loaded_ids; \& my $id_cnt = @$ids; .Ve .Sp After performing a load, this returns an array ref containing all the feature primary ids that were created during the load. .SH "BUGS" .IX Header "BUGS" This is an early version, so there are certainly some bugs. Please use the BioPerl bug tracking system to report bugs. .SH "SEE ALSO" .IX Header "SEE ALSO" Bio::DB::SeqFeature::Store, Bio::DB::SeqFeature::Segment, Bio::DB::SeqFeature::NormalizedFeature, Bio::DB::SeqFeature::GFF2Loader, Bio::DB::SeqFeature::Store::DBI::mysql, Bio::DB::SeqFeature::Store::berkeleydb .SH "AUTHOR" .IX Header "AUTHOR" Lincoln Stein . .PP Copyright (c) 2006 Cold Spring Harbor Laboratory. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.