| 1 | # $Id: TFBS.pm,v 1.11 2006/08/12 11:00:03 sendu Exp $ | ||||||||||||||||||||
| 2 | # | ||||||||||||||||||||
| 3 | # BioPerl module for Bio::DB::TFBS | ||||||||||||||||||||
| 4 | # | ||||||||||||||||||||
| 5 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||
| 6 | # | ||||||||||||||||||||
| 7 | # Cared for by Sendu Bala <bix@sendu.me.uk> | ||||||||||||||||||||
| 8 | # | ||||||||||||||||||||
| 9 | # Copyright Sendu Bala | ||||||||||||||||||||
| 10 | # | ||||||||||||||||||||
| 11 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | # POD documentation - main docs before the code | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | Bio::DB::TFBS - Access to a Transcription Factor Binding Site database | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | use Bio::DB::TFBS; | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | my $db = Bio::DB::TFBS->new(-source => 'transfac'); | ||||||||||||||||||||
| 24 | my ($factor_id) = $db->get_factor_ids('PPAR-gamma1'); | ||||||||||||||||||||
| 25 | my ($matrix_id) = $db->get_matrix_ids('PPAR-gamma1'); | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | # get a Bio::Map::TranscriptionFactor with all the positions of a given factor | ||||||||||||||||||||
| 28 | my $factor = $db->get_factor(-factor_id => $factor_id); | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | # get a Bio::Map::GeneMap containing all the factors that bind near a given gene | ||||||||||||||||||||
| 31 | my $gene_map = $db->get_gene_map(-gene_name => 'AQP 7'); | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | # get a PSM (Bio::Matrix::PSM) of a given matrix | ||||||||||||||||||||
| 34 | my $psm = $db->get_matrix(-matrix_id => $matrix_id); | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | # get the aligned sequences (Bio::SimpleAlign) that were used to build a given | ||||||||||||||||||||
| 37 | # matrix | ||||||||||||||||||||
| 38 | my $align = $db->get_alignment(-matrix_id => $matrix_id); | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | # get a specific instance sequence (Bio::LocatableSeq) | ||||||||||||||||||||
| 41 | my $seq = $db->get_seq($id); | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | =head1 DESCRIPTION | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | This is a front end module for access to a Transcription Factor Binding Site | ||||||||||||||||||||
| 46 | database. | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head1 FEEDBACK | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | =head2 Mailing Lists | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||
| 53 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||
| 54 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||
| 57 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =head2 Support | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||
| 66 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||
| 67 | address it. Please include a thorough description of the problem | ||||||||||||||||||||
| 68 | with code and data examples if at all possible. | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | =head2 Reporting Bugs | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||
| 73 | of the bugs and their resolution. Bug reports can be submitted via | ||||||||||||||||||||
| 74 | the web: | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | =head1 AUTHOR - Sendu Bala | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | Email bix@sendu.me.uk | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | =head1 CONTRIBUTORS | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | Based on Bio::DB::Taxonomy by Jason Stajich | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | =head1 APPENDIX | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||
| 89 | Internal methods are usually preceded with a _ | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | # Let the code begin... | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | package Bio::DB::TFBS; | ||||||||||||||||||||
| 96 | 1 | $Bio::DB::TFBS::VERSION = '1.7.3'; | |||||||||||||||||||
| 97 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | 1 | ▶ | use base qw(Bio::Root::Root); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 1 | our $DefaultSource = 'transfac'; | |||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | =head2 new | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | Title : new | ||||||||||||||||||||
| 108 | Usage : my $obj = Bio::DB::TFBS->new(-source => 'transfac'); | ||||||||||||||||||||
| 109 | Function: Builds a new Bio::DB::TFBS object. | ||||||||||||||||||||
| 110 | Returns : an instance of Bio::DB::TFBS | ||||||||||||||||||||
| 111 | Args : -source => which database source: currently only 'transfac_pro' | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | =cut | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 116 | 0 | my ($class, @args) = @_; | |||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 0 | ▶ | if ($class =~ /Bio::DB::TFBS::(\S+)/) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 119 | 0 | my ($self) = $class->SUPER::new(@args); | |||||||||||||||||||
| 120 | 0 | $self->_initialize(@args); | |||||||||||||||||||
| 121 | 0 | return $self; | |||||||||||||||||||
| 122 | } | ||||||||||||||||||||
| 123 | else { | ||||||||||||||||||||
| 124 | 0 | my %param = @args; | |||||||||||||||||||
| 125 | 0 | @param{ map { lc $_ } keys %param } = values %param; # lowercase keys | |||||||||||||||||||
| 126 | 0 | ▶ | my $source = $param{'-source'} || $DefaultSource; | ||||||||||||||||||
|
Condition0%0/3
$param{'-source'} || $Bio::DB::TFBS::DefaultSource
MC/DC0%0/2
$param{'-source'} || $Bio::DB::TFBS::DefaultSource
$param{'-source'}
$Bio::DB::TFBS::DefaultSource
Truth table0%0/3
A || B
A= $param{'-source'}B= $Bio::DB::TFBS::DefaultSource
| |||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | 0 | $source = "\L$source"; # normalize capitalization to lower case | |||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | # normalize capitalization | ||||||||||||||||||||
| 131 | 0 | ▶ | return unless( $class->_load_tax_module($source) ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 132 | 0 | return "Bio::DB::TFBS::$source"->new(@args); | |||||||||||||||||||
| 133 | } | ||||||||||||||||||||
| 134 | } | ||||||||||||||||||||
| 135 | |||||||||||||||||||||
| 136 | # empty for now | ||||||||||||||||||||
| 137 | 0 | ▶ | sub _initialize { } | ||||||||||||||||||
|
Subroutine
_initialize: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | =head2 _load_tax_module | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | Title : _load_tax_module | ||||||||||||||||||||
| 142 | Usage : *INTERNAL Bio::DB::TFBS stuff* | ||||||||||||||||||||
| 143 | Function: Loads up (like use) a module at run time on demand | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | =cut | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 0 | ▶ | sub _load_tax_module { | ||||||||||||||||||
|
Subroutine
_load_tax_module: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 148 | 0 | my ($self, $source) = @_; | |||||||||||||||||||
| 149 | 0 | my $module = "Bio::DB::TFBS::" . $source; | |||||||||||||||||||
| 150 | 0 | my $ok; | |||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | 0 | eval { $ok = $self->_load_module($module) }; | |||||||||||||||||||
| 153 | 0 | ▶ | if ( $@ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 154 | 0 | print STDERR $@; | |||||||||||||||||||
| 155 | 0 | print STDERR <<END; | |||||||||||||||||||
| 156 | $self: $source cannot be found | ||||||||||||||||||||
| 157 | Exception $@ | ||||||||||||||||||||
| 158 | For more information about the Bio::DB::TFBS system please see | ||||||||||||||||||||
| 159 | the Bio::DB::TFBS docs. This includes ways of checking for | ||||||||||||||||||||
| 160 | formats at compile time, not run time. | ||||||||||||||||||||
| 161 | END | ||||||||||||||||||||
| 162 | ; | ||||||||||||||||||||
| 163 | } | ||||||||||||||||||||
| 164 | 0 | return $ok; | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 1 | 1; | |||||||||||||||||||