Skip to content
Snippets Groups Projects
Commit 1fbe32b4 authored by Laura Clarke's avatar Laura Clarke
Browse files

RepeatFeatureAdaptor - altered sql so score is take from the table too

Slice + RawContigAdaptor added fetch_all repeat, simple, prediction and similarity feature methods, all can accept and optional type whic should be logic_name
parent 4fbe162b
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......@@ -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 );
......
......@@ -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;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment