BaseAlignFeatureAdaptor.pm 3.56 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#
# BioPerl module for Bio::EnsEMBL::DBSQL::BaseAlignFeatureAdaptor
#
# Cared for by Ewan Birney <birney@ebi.ac.uk>
#
# Copyright Ewan Birney
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::EnsEMBL::DBSQL::BaseAlignFeatureAdaptor - Abstract Base class for 
                                               AlignFeatureAdaptors

=head1 SYNOPSIS

19
Abstract class - should not be instantiated.  Implementation of
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
abstract methods must be performed by subclasses.

=head1 DESCRIPTION

This is a base adaptor for align adaptors.  Since DnaAlignFeatureAdaptor and
PepAlignFeatureAdaptor had almost the same functionality it made sense to 
streamline by creating this superclass.

=head1 AUTHOR - Ewan Birney

Email birney@ebi.ac.uk

Describe contact details here

=head1 APPENDIX

36
37
The rest of the documentation details each of the object methods. Internal 
methods are usually preceded with a _
38
39
40
41
42
43
44
45
46
47
48

=cut


# Let the code begin...


package Bio::EnsEMBL::DBSQL::BaseAlignFeatureAdaptor;
use vars qw(@ISA);
use strict;

49
#Object preamble - inherits from Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor
50

51
use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor;
52

53
@ISA = qw(Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor);
54

55
56


57
=head2 fetch_all_by_RawContig_and_pid
58

59
60
  Arg [1]    : Bio::EnsEMBL::RawContig
               the contig to obtain align features from
61
62
63
64
  Arg [2]    : float $pid 
               a lower bound for the percentage identifier of feats to obtain
  Arg [3]    : (optional) string $logic_name
               the logic name of the type of features to obtain
65
66
67
  Example    : $fts = $adaptor->fetch_all_by_RawContig_and_pid($contig, 50.0);
  Description: Returns a listref of features created from the database which
               are on the contig defined by $contig and with a percentage id 
68
69
               greater than $pid.  If logic name is defined, only features
               with an analysis of type $logic_name will be returned. 
70
  Returntype : listref of Bio::EnsEMBL::BaseAlignFeature in contig coordinates
71
72
73
74
75
  Exceptions : thrown if $pid is not defined
  Caller     : general

=cut

76
sub fetch_all_by_Contig_and_pid {
77
  my($self, $contig, $pid, $logic_name) = @_;
78
79
80

  my $constraint;

81
  if(defined $pid) {
82
83
84
    $constraint = "perc_ident > $pid";
  }

85
86
  return $self->fetch_all_by_Contig_constraint($contig, 
					       $constraint, $logic_name);
87
88
89
}


90
91
92


=head2 fetch_all_by_Slice_and_pid
93
94
95

  Arg [1]    : Bio::EnsEMBL::Slice $slice
               The slice from which to obtain align features.
96
  Arg [2]    : (optional) float $pid 
97
98
99
               a lower bound for the percentage identifier of feats to obtain
  Arg [3]    : (optional) string $logic_name
               the logic name of the type of features to obtain
100
101
  Example    : @feats = $adaptor->fetch_all_by_Slice_and_pid($slice, 50.0);
  Description: Returns a listref of features created from the database which 
102
103
104
               are on the Slice $slice and with a percentage id 
               greater than $pid.  If logic name is defined, only features
               with an analysis of type $logic_name will be returned. 
Graham McVicker's avatar
Graham McVicker committed
105
  Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures in Slice coordinates
106
107
108
109
110
  Exceptions : thrown if pid is not defined
  Caller     : general

=cut

111
sub fetch_all_by_Slice_and_pid {
112
113
114
  my ($self,$slice,$pid, $logic_name) = @_;
  my $constraint;

115
  if(defined $pid){
116
117
118
    $constraint = "perc_ident > $pid";
  }

119
120
  return $self->fetch_all_by_Slice_constraint($slice, $constraint, 
					      $logic_name);
121
122
123
124
}  



125
126
127
128
129
##implemented by subclasses:
# store
# _tablename
# _columns
# _obj_from_hashref
130
131


132

133
1;