.\" 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::SeqFeature::Collection 3pm" .TH Bio::SeqFeature::Collection 3pm "2020-10-28" "perl v5.30.3" "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::SeqFeature::Collection \- A container class for SeqFeatures suitable for performing operations such as finding features within a range, that match a certain feature type, etc. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 10 \& use Bio::SeqFeature::Collection; \& use Bio::Location::Simple; \& use Bio::Tools::GFF; \& use Bio::Root::IO; \& use File::Spec; \& # let\*(Aqs first input some features \& my $gffio = Bio::Tools::GFF\->new(\-file => File::Spec\->catfile \& ("t","data","myco_sites.gff"), \& \-gff_version => 2); \& my @features = (); \& # loop over the input stream \& while(my $feature = $gffio\->next_feature()) { \& # do something with feature \& push @features, $feature; \& } \& $gffio\->close(); \& # build the Collection object \& my $col = Bio::SeqFeature::Collection\->new(); \& # add these features to the object \& my $totaladded = $col\->add_features(\e@features); \& \& my @subset = $col\->features_in_range(\-start => 1, \& \-end => 25000, \& \-strand => 1, \& \-contain => 0); \& # subset should have 18 entries for this dataset \& print "size is ", scalar @subset, "\en"; \& @subset = $col\->features_in_range(\-range => Bio::Location::Simple\->new \& (\-start => 70000, \& \-end => 150000, \& \-strand => \-1), \& \-contain => 1, \& \-strandmatch => \*(Aqstrong\*(Aq); \& \& # subset should have 22 entries for this dataset \& print "size is ", scalar @subset, "\en"; \& print "total number of features in collection is ", \& $col\->feature_count(),"\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This object will efficiently allow one for query subsets of ranges within a large collection of sequence features (in fact the objects just have to be Bio::RangeI compliant). This is done by the creation of bins which are stored in order in a B\-Tree data structure as provided by the DB_File interface to the Berkeley \s-1DB.\s0 .PP This is based on work done by Lincoln for storage in a mysql instance \&\- this is intended to be an embedded in-memory implementation for easily querying for subsets of a large range set. .PP Collections can be made persistent by keeping the indexfile and passing in the \-keep flag like this: .PP .Vb 4 \& my $collection = Bio::SeqFeature::Collection\->new(\-keep => 1, \& \-file => \*(Aqcol.idx\*(Aq); \& $collaction\->add_features(\e@features); \& undef $collection; \& \& # To reuse this collection, next time you initialize a Collection object \& # specify the filename and the index will be reused. \& $collection = Bio::SeqFeature::Collection\->new(\-keep => 1, \& \-file => \*(Aqcol.idx\*(Aq); .Ve .SH "FEEDBACK" .IX Header "FEEDBACK" .SS "Mailing Lists" .IX Subsection "Mailing Lists" User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. .PP .Vb 2 \& bioperl\-l@bioperl.org \- General discussion \& http://bioperl.org/wiki/Mailing_lists \- About the mailing lists .Ve .SS "Support" .IX Subsection "Support" Please direct usage questions or support issues to the mailing list: .PP \&\fIbioperl\-l@bioperl.org\fR .PP rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. .SS "Reporting Bugs" .IX Subsection "Reporting Bugs" Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: .PP .Vb 1 \& https://github.com/bioperl/bioperl\-live/issues .Ve .SH "AUTHOR \- Jason Stajich" .IX Header "AUTHOR - Jason Stajich" Email jason@bioperl.org .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Using code and strategy developed by Lincoln Stein (lstein@cshl.org) in Bio::DB::GFF implementation. Credit also to Lincoln for suggesting using Storable to serialize features rather than my previous implementation which kept the features in memory. .SH "APPENDIX" .IX Header "APPENDIX" The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ .SS "new" .IX Subsection "new" .Vb 5 \& Title : new \& Usage : my $obj = Bio::SeqFeature::Collection\->new(); \& Function: Builds a new Bio::SeqFeature::Collection object \& Returns : Bio::SeqFeature::Collection \& Args : \& \& \-minbin minimum value to use for binning \& (default is 100,000,000) \& \-maxbin maximum value to use for binning \& (default is 1,000) \& \-file filename to store/read the \& BTREE from rather than an in\-memory structure \& (default is false and in\-memory). \& \-keep boolean, will not remove index file on \& object destruction. \& \-features Array ref of features to add initially .Ve .SS "add_features" .IX Subsection "add_features" .Vb 5 \& Title : add_features \& Usage : $collection\->add_features(\e@features); \& Function: \& Returns : number of features added \& Args : arrayref of Bio::SeqFeatureI objects to index .Ve .SS "features_in_range" .IX Subsection "features_in_range" .Vb 11 \& Title : features_in_range \& Usage : my @features = $collection\->features_in_range($range) \& Function: Retrieves a list of features which were contained or overlap the \& the requested range (see Args for way to specify overlap or \& only those containe)d \& Returns : List of Bio::SeqFeatureI objects \& Args : \-range => Bio::RangeI object defining range to search, \& OR \& \-start => start, \& \-end => end, \& \-strand => strand \& \& \-contain => boolean \- true if feature must be completely \& contained with range \& OR false if should include features that simply overlap \& the range. Default: true. \& \-strandmatch => \*(Aqstrong\*(Aq, ranges must have the same strand \& \*(Aqweak\*(Aq, ranges must have the same \& strand or no strand \& \*(Aqignore\*(Aq, ignore strand information \& Default. \*(Aqignore\*(Aq. .Ve .SS "remove_features" .IX Subsection "remove_features" .Vb 6 \& Title : remove_features \& Usage : $collection\->remove_features(\e@array) \& Function: Removes the requested sequence features (based on features \& which have the same location) \& Returns : Number of features removed \& Args : Arrayref of Bio::RangeI objects .Ve .SS "get_all_features" .IX Subsection "get_all_features" .Vb 5 \& Title : get_all_features \& Usage : my @f = $col\->get_all_features() \& Function: Return all the features stored in this collection (Could be large) \& Returns : Array of Bio::RangeI objects \& Args : None .Ve .SS "min_bin" .IX Subsection "min_bin" .Vb 5 \& Title : min_bin \& Usage : my $minbin= $self\->min_bin; \& Function: Get/Set the minimum value to use for binning \& Returns : integer \& Args : [optional] minimum bin value .Ve .SS "max_bin" .IX Subsection "max_bin" .Vb 5 \& Title : max_bin \& Usage : my $maxbin= $self\->max_bin; \& Function: Get/Set the maximum value to use for binning \& Returns : integer \& Args : [optional] maximum bin value .Ve .SS "feature_count" .IX Subsection "feature_count" .Vb 5 \& Title : feature_count \& Usage : my $c = $col\->feature_count() \& Function: Retrieve the total number of features in the collection \& Returns : integer \& Args : none .Ve .SS "indexfile" .IX Subsection "indexfile" .Vb 5 \& Title : indexfile \& Usage : $obj\->indexfile($newval) \& Function: Get/set the filename where index is kept \& Returns : value of indexfile (a filename string) \& Args : on set, new value (a filename string ) .Ve .SS "keep" .IX Subsection "keep" .Vb 7 \& Title : keep \& Usage : $obj\->keep($newval) \& Function: Get/set boolean flag to keep the indexfile after \& exiting program \& Example : \& Returns : value of keep (boolean) \& Args : on set, new value (boolean) .Ve