0
|
1 # $Id: CollectionI.pm,v 1.2 2002/10/22 07:45:20 lapp Exp $
|
|
2 #
|
|
3 # BioPerl module for Bio::SeqFeature::CollectionI
|
|
4 #
|
|
5 # Cared for by Jason Stajich <jason@bioperl.org>
|
|
6 #
|
|
7 # Copyright Jason Stajich
|
|
8 #
|
|
9 # You may distribute this module under the same terms as perl itself
|
|
10
|
|
11 # POD documentation - main docs before the code
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::SeqFeature::CollectionI - An interface for a collection of SeqFeatureI objects.
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19
|
|
20 # get a Bio::SeqFeature::CollectionI somehow
|
|
21 # perhaps a Bio::SeqFeature::Collection
|
|
22
|
|
23
|
|
24 use Bio::SeqFeature::Collection;
|
|
25 my $collection = new Bio::SeqFeature::Collection;
|
|
26 $collection->add_features(\@featurelist);
|
|
27
|
|
28
|
|
29 $collection->features(-attributes =>
|
|
30 [ { 'location' => new Bio::Location::Simple
|
|
31 (-start=> 1, -end => 300) ,
|
|
32 'overlaps' }]);
|
|
33
|
|
34 =head1 DESCRIPTION
|
|
35
|
|
36 This interface describes the basic methods needed for a collection of Sequence Features.
|
|
37
|
|
38 =head1 FEEDBACK
|
|
39
|
|
40 =head2 Mailing Lists
|
|
41
|
|
42 User feedback is an integral part of the evolution of this and other
|
|
43 Bioperl modules. Send your comments and suggestions preferably to
|
|
44 the Bioperl mailing list. Your participation is much appreciated.
|
|
45
|
|
46 bioperl-l@bioperl.org - General discussion
|
|
47 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
48
|
|
49 =head2 Reporting Bugs
|
|
50
|
|
51 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
52 of the bugs and their resolution. Bug reports can be submitted via
|
|
53 email or the web:
|
|
54
|
|
55 bioperl-bugs@bioperl.org
|
|
56 http://bugzilla.bioperl.org/
|
|
57
|
|
58 =head1 AUTHOR - Jason Stajich
|
|
59
|
|
60 Email jason@bioperl.org
|
|
61
|
|
62 Describe contact details here
|
|
63
|
|
64 =head1 CONTRIBUTORS
|
|
65
|
|
66 Additional contributors names and emails here
|
|
67
|
|
68 =head1 APPENDIX
|
|
69
|
|
70 The rest of the documentation details each of the object methods.
|
|
71 Internal methods are usually preceded with a _
|
|
72
|
|
73 =cut
|
|
74
|
|
75
|
|
76 # Let the code begin...
|
|
77
|
|
78
|
|
79 package Bio::SeqFeature::CollectionI;
|
|
80 use vars qw(@ISA);
|
|
81 use strict;
|
|
82 use Carp;
|
|
83 use Bio::Root::RootI;
|
|
84
|
|
85 @ISA = qw( Bio::Root::RootI );
|
|
86
|
|
87
|
|
88 =head2 add_features
|
|
89
|
|
90 Title : add_features
|
|
91 Usage : $collection->add_features(\@features);
|
|
92 Function:
|
|
93 Returns : number of features added
|
|
94 Args : arrayref of Bio::SeqFeatureI objects to index
|
|
95
|
|
96 =cut
|
|
97
|
|
98 sub add_features{
|
|
99 shift->throw_not_implemented();
|
|
100 }
|
|
101
|
|
102
|
|
103 =head2 features
|
|
104
|
|
105 Title : features
|
|
106 Usage : my @f = $collection->features(@args);
|
|
107 Returns : a list of Bio::SeqFeatureI objects
|
|
108 Args : see below
|
|
109 Status : public
|
|
110
|
|
111 This routine will retrieve features associated with this collection
|
|
112 object. It can be used to return all features, or a subset based on
|
|
113 their type, location, or attributes.
|
|
114
|
|
115 -types List of feature types to return. Argument is an array
|
|
116 of Bio::Das::FeatureTypeI objects or a set of strings
|
|
117 that can be converted into FeatureTypeI objects.
|
|
118
|
|
119 -callback A callback to invoke on each feature. The subroutine
|
|
120 will be passed to each Bio::SeqFeatureI object in turn.
|
|
121
|
|
122 -attributes A hash reference containing attributes to match.
|
|
123
|
|
124 The -attributes argument is a hashref containing one or more attributes
|
|
125 to match against:
|
|
126
|
|
127 -attributes => { Gene => 'abc-1',
|
|
128 Note => 'confirmed' }
|
|
129
|
|
130 Attribute matching is simple exact string matching, and multiple
|
|
131 attributes are ANDed together. See L<Bio::DB::ConstraintsI> for a
|
|
132 more sophisticated take on this.
|
|
133
|
|
134 If one provides a callback, it will be invoked on each feature in
|
|
135 turn. If the callback returns a false value, iteration will be
|
|
136 interrupted. When a callback is provided, the method returns undef.
|
|
137
|
|
138 =cut
|
|
139
|
|
140 sub features{
|
|
141 shift->throw_not_implemented();
|
|
142 }
|
|
143
|
|
144 1;
|