BaseAlignFeatureAdaptor.pm 3.53 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_by_Contig_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
  Example    : @feats = $adaptor->fetch_by_Contig_and_pid($contig, 50.0);
66
67
68
69
70
71
72
73
74
75
  Description: Returns a list of features created from the database which are 
               are on the contig defined by $cid 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. 
  Returntype : list of Bio::EnsEMBL::*AlignFeature in contig coordinates
  Exceptions : thrown if $pid is not defined
  Caller     : general

=cut

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

  my $constraint;

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

  my @features = 
86
    $self->fetch_by_Contig_constraint($contig, $constraint, $logic_name);
87
88
89
90
91
  
  return @features;
}


92
93
94
95
=head2 fetch_by_Slice_and_pid

  Arg [1]    : Bio::EnsEMBL::Slice $slice
               The slice from which to obtain align features.
96
  Arg [2]    : (optional) float $pid 
97
98
99
100
101
102
103
104
105
106
107
108
109
110
               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
  Example    : @feats = $adaptor->fetch_by_Slice_and_pid($slice, 50.0);
  Description: Returns a list of features created from the database which are 
               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. 
  Returntype : list of Bio::EnsEMBL::*AlignFeature in Slice coordinates
  Exceptions : thrown if pid is not defined
  Caller     : general

=cut

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

115
  if(defined $pid){
116
117
118
119
120
121
122
123
    $constraint = "perc_ident > $pid";
  }

  return $self->fetch_by_Slice_constraint($slice, $constraint, $logic_name);
}  



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


1;