diff --git a/modules/Bio/EnsEMBL/DBSQL/RawContigAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/RawContigAdaptor.pm index b060949f1ef86d5cf8fe70f2053b8abeee1326c9..85f4a05062e19354a6e3e573645caf17bbaed947 100644 --- a/modules/Bio/EnsEMBL/DBSQL/RawContigAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/RawContigAdaptor.pm @@ -318,5 +318,107 @@ sub _insertSequence{ } +sub fetch_all_repeat_features{ + my($self, $contig, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all repeat features if con't have a contig to fetch them for\n"); + } + + my @repeats = $self->db->get_RepeatFeatureAdaptor->fetch_by_contig_id($contig->dbID, $logic_name); + + return @repeats; + +} + +sub fetch_all_simple_features{ + my($self, $contig, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all simple features if con't have a contig to fetch them for\n"); + } + + my @simple = $self->db->get_SimpleFeatureAdaptor->fetch_by_contig_id($contig->dbID, $logic_name); + + return @simple; + +} + +sub fetch_all_prediction_transcripts{ + my($self, $contig, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all simple features if con't have a contig to fetch them for\n"); + } + + my @prediction = $self->db->get_PredictionTranscriptAdaptor->fetch_by_contig_id($contig->dbID, $logic_name); + + return @prediction; + +} + + + + + +sub fetch_all_similarity_features{ + my($self, $contig, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all simple features if con't have a contig to fetch them for\n"); + } + + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_contig_id($contig->dbID, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_contig_id($contig->dbID, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +} + +sub fetch_all_similarity_features_above_score{ + my($self, $contig, $score, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all simple features if con't have a contig to fetch them for\n"); + } + if(!$score){ + $self->throw("need score even if it 0\n"); + } + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_contig_id_and_score($contig->dbID, $score, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_contig_id_and_score($contig->dbID, $score, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +} + + +sub fetch_all_similarity_features_above_pid{ + my($self, $contig, $pid, $logic_name) = @_; + + if(!$contig){ + $self->throw("can't fetch all simple features if con't have a contig to fetch them for\n"); + } + if(!$pid){ + $self->throw("need percent_id even if it 0\n"); + } + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_contig_id_and_pid($contig->dbID, $pid, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_contig_id_and_pid($contig->dbID, $pid, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +} + 1; diff --git a/modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm index d3aa2803612c6377b718ba25565c024014eb177f..2570d020e7fbdfe5e75bd4e5346f9e7fa990adc8 100644 --- a/modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm @@ -58,18 +58,20 @@ sub _generic_fetch { $repeat_start, $repeat_end, $analysis_id, + $score ); my $sth = $self->prepare(qq{ - SELECT repeat_feature_id - , contig_id - , contig_start - , contig_end - , contig_strand - , repeat_id - , repeat_start - , repeat_end - , analysis_id + SELECT repeat_feature_id + , contig_id + , contig_start + , contig_end + , contig_strand + , repeat_id + , repeat_start + , repeat_end + , analysis_id + , score FROM repeat_feature f WHERE }. $where_clause); @@ -84,6 +86,7 @@ sub _generic_fetch { \$repeat_start, \$repeat_end, \$analysis_id, + \$score ); my $rca = $self->db->get_RepeatConsensusAdaptor; @@ -99,7 +102,7 @@ sub _generic_fetch { $analysis_cache{$analysis_id} = $ana_obj; } - my $r = $self->_new_repeat($contig_start, $contig_end, $contig_strand, $repeat_start, $repeat_end, $ana_obj, $contig_id, $repeat_id, $rca, $repeat_feature_id); + my $r = $self->_new_repeat($contig_start, $contig_end, $contig_strand, $repeat_start, $repeat_end, $score, $ana_obj, $contig_id, $repeat_id, $rca, $repeat_feature_id); push(@repeats, $r); } return( @repeats ); @@ -143,7 +146,7 @@ sub fetch_by_Slice{ my $start = ($r->start - ($slice->chr_start - 1)); my $end = ($r->end - ($slice->chr_start - 1)); - my $repeat = $self->_new_repeat($start, $end, $r->strand, $r->hstart, $r->hend, $r->analysis, $r->contig_id, $r->repeat_id, $r->repeat_consensus_adaptor, $r->dbID); + my $repeat = $self->_new_repeat($start, $end, $r->strand, $r->hstart, $r->hend, $r->score, $r->analysis, $r->contig_id, $r->repeat_id, $r->repeat_consensus_adaptor, $r->dbID); push(@out, $repeat); } @@ -192,7 +195,7 @@ sub fetch_by_assembly_location_constraint{ next; } - my $repeat = $self->_new_repeat($coord_list[0]->start, $coord_list[0]->end, $coord_list[0]->strand, $r->hstart, $r->hend, $r->analysis, $r->contig_id, $r->repeat_id, $r->repeat_consensus_adaptor, $r->dbID); + my $repeat = $self->_new_repeat($coord_list[0]->start, $coord_list[0]->end, $coord_list[0]->strand, $r->hstart, $r->hend, $r->score, $r->analysis, $r->contig_id, $r->repeat_id, $r->repeat_consensus_adaptor, $r->dbID); push(@out, $repeat); @@ -294,7 +297,7 @@ sub store { sub _new_repeat{ - my($self, $start, $end, $strand, $hstart, $hend, $analysis, $contig_id, $repeat_id, $rca, $dbID) = @_; + my($self, $start, $end, $strand, $hstart, $hend, $score, $analysis, $contig_id, $repeat_id, $rca, $dbID) = @_; my $r = Bio::EnsEMBL::RepeatFeature->new; $r->dbID($dbID); @@ -309,6 +312,7 @@ sub _new_repeat{ if($strand == -0){ $strand = 0; } + $r->score($score); $r->strand ( $strand ); $r->hstart ( $hstart ); $r->hend ( $hend ); diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm index ed549fd9e069204450bcc88244e602e0554bc09a..2162cd8b92e46f140cb950d2848bff784d7fd189 100644 --- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm @@ -102,3 +102,106 @@ sub new_web_slice{ die "Not implemented new slice yet"; } + + +sub fetch_all_repeat_features{ + my($self, $slice, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all repeat features if con't have a slice to fetch them for\n"); + } + + my @repeats = $self->db->get_RepeatFeatureAdaptor->fetch_by_Slice($slice, $logic_name); + + return @repeats; + +} + +sub fetch_all_simple_features{ + my($self, $slice, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all simple features if con't have a slice to fetch them for\n"); + } + + my @simple = $self->db->get_SimpleFeatureAdaptor->fetch_by_Slice($slice, $logic_name); + + return @simple; + +} + +sub fetch_all_prediction_transcripts{ + my($self, $slice, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all simple features if con't have a slice to fetch them for\n"); + } + + my @prediction = $self->db->get_PredictionTranscriptAdaptor->fetch_by_Slice($slice, $logic_name); + + return @prediction; + +} + + + + + +sub fetch_all_similarity_features{ + my($self, $slice, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all simple features if con't have a slice to fetch them for\n"); + } + + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_Slice($slice, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_Slice($slice, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +} + +sub fetch_all_similarity_features_above_score{ + my($self, $slice, $score, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all simple features if con't have a slice to fetch them for\n"); + } + if(!$score){ + $self->throw("need score even if it 0\n"); + } + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_Slice_and_score($slice, $score, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_Slice_and_score($slice, $score, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +} + + +sub fetch_all_similarity_features_above_pid{ + my($self, $slice, $pid, $logic_name) = @_; + + if(!$slice){ + $self->throw("can't fetch all simple features if con't have a slice to fetch them for\n"); + } + if(!$pid){ + $self->throw("need percent_id even if it 0\n"); + } + my @out; + + my @dnaalign = $self->db->get_DnaAlignFeatureAdaptor->fetch_by_Slice_and_pid($slice, $pid, $logic_name); + my @pepalign = $self->db->get_ProteinAlignFeatureAdaptor->fetch_by_Slice_and_pid($slice, $pid, $logic_name); + + push(@out, @dnaalign); + push(@out, @pepalign); + + return @out; +}