Commit 3c26c675 authored by Graham McVicker's avatar Graham McVicker
Browse files

Genscan Transcripts now draw using new main trunk

parent 4bd60370
......@@ -165,7 +165,14 @@ sub fetch_by_Slice{
my $constraint = undef;
if($logic_name){
my $analysis = $self->db->get_AnalysisAdaptor->fetch_by_logic_name($logic_name);
my $analysis =
$self->db->get_AnalysisAdaptor->fetch_by_logic_name($logic_name);
unless($analysis->dbID()) {
$self->warn("PredictionTranscriptAdaptor->fetch_by_slice: " .
"no analysis with logic name $logic_name exists\n");
return ();
}
$constraint = " analysis_id = ".$analysis->dbID;
}
......@@ -198,7 +205,6 @@ sub fetch_by_Slice{
push(@out, $pred_t);
}
return @out;
}
......
......@@ -132,18 +132,7 @@ sub fetch_all_simple_features{
}
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{
......@@ -475,3 +464,22 @@ sub fetch_Slice_by_gene{
}
#
# Deprecated, Just use the slice method get_all_PredictionTranscripts instead
#
sub fetch_all_prediction_transcripts{
my($self, $slice, $logic_name) = @_;
$self->throw("SliceAdaptor->fetch_all_predication_transcripts deprecated");
return ();
# 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;
}
......@@ -43,7 +43,7 @@ use strict;
# Object preamble - inheriets from Bio::SeqFeature::Generic
use Bio::EnsEMBL::Root;
use Bio::EnsEMBL::Transcript;
use Bio::EnsEMBL::TranscriptI;
use Bio::DBLinkContainerI;
use Bio::Annotation::DBLink;
use Bio::EnsEMBL::DBEntry;
......@@ -492,8 +492,8 @@ sub type {
sub add_Transcript{
my ($self,$trans) = @_;
if( !ref $trans || ! $trans->isa("Bio::EnsEMBL::Transcript") ) {
$self->throw("$trans is not a Bio::EnsEMBL::Transcript!");
if( !ref $trans || ! $trans->isa("Bio::EnsEMBL::TranscriptI") ) {
$self->throw("$trans is not a Bio::EnsEMBL::TranscriptI!");
}
# at the moment, use the SeqFeature sub hash. But in the future,
......
......@@ -28,6 +28,7 @@ package Bio::EnsEMBL::Lite::GeneAdaptor;
use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Transcript;
use Bio::EnsEMBL::Gene;
......@@ -161,7 +162,6 @@ sub fetch_by_Slice {
$transcript->external_name( $hr->{'external_name'} );
$transcript->external_db( $hr->{'external_db' } );
# Add the exons
if( $hr->{'chr_strand'} != 1 ) {
@exons = reverse( @exons );
......@@ -183,12 +183,6 @@ sub fetch_by_Slice {
# we need start and end Exon
# hope they are lazy loaded ... nope they are not!!!
#Right now, just add the first exon as the start, and last exon
# as the end...
# if(scalar @exons) {
# $translation->start_exon(@exons[0]);
# $translation->end_exon( $exons[$#exons]);
# }
}
my @out = values( %gene_cache );
......
......@@ -61,9 +61,10 @@ use strict;
use Bio::EnsEMBL::Root;
use Bio::EnsEMBL::Exon;
use Bio::Seq;
use Bio::EnsEMBL::TranscriptI;
@ISA = qw(Bio::EnsEMBL::Root);
@ISA = qw(Bio::EnsEMBL::Root Bio::EnsEMBL::TranscriptI);
=head2 new
......@@ -92,18 +93,118 @@ sub new {
# set stuff in self from @args
foreach my $a (@optional_exons) {
foreach my $exon (@optional_exons) {
if( ! defined $self->{'exons'} ) {
$self->{'exons'} = [];
}
$self->add_Exon($exon);
}
return $self;
}
=head2 coding_start
Arg [1] : The new coding start of this prediction transcript in slice
coords.
Function : Getter/Setter for the coding start of this transcript.
Implemented to satisfy requirements of TranscriptI interface
and so that it can be drawn as a Transcript.
Returntype: scalar int
Exceptions: none
Caller : GlyphSet_transcript
=cut
sub coding_start {
my ($self, $arg) = @_;
$self->add_Exon($a);
if(defined $arg) {
$self->{'coding_start'} = $arg;
} elsif(!defined $self->{'coding_start'}) {
#if the coding start is not defined, use the start of the transcript
return $self->start();
}
return $self->{'coding_start'};
}
return $self;
=head2 coding_end
Arg [1] : (optional) The new coding end of this prediction transcript
in slice coords.
Function : Getter/Setter for the coding end of this transcript.
Implemented to satisfy requirements of TranscriptI interface
and so that it can be drawn as a Transcript.
Returntype: scalar int
Exceptions: none
Caller : GlyphSet_transcript
=cut
sub coding_end {
my ($self, $arg) = @_;
if(defined $arg) {
$self->{'coding_end'} = $arg;
} elsif(!defined $self->{'coding_end'}) {
#if the coding end is not defined, use the end of the transcript
return $self->end();
}
return $self->{'coding_end'};
}
=head2 start
Arg [1] : The new start of this prediction transcript in slice
coords.
Function : Getter/Setter for the start of this transcript.
Implemented to satisfy requirements of TranscriptI interface
and so that it can be drawn as a Transcript.
Returntype: scalar int
Exceptions: none
Caller : GlyphSet_transcript
=cut
sub start {
my ($self, $arg) = @_;
if(defined $arg) {
$self->{'start'} = $arg;
}
return $self->{'start'};
}
=head2 end
Arg [1] : The new end of this prediction transcript in slice coords.
Function : Getter/Setter for the end of this transcript.
Implemented to satisfy requirements of TranscriptI interface
and so that it can be drawn as a Transcript.
Returntype: scalar int
Exceptions: none
Caller : GlyphSet_transcript
=cut
sub end {
my ($self, $arg) = @_;
if(defined $arg) {
$self->{'end'} = $arg;
}
return $self->{'end'};
}
## Attribute section ##
......@@ -162,6 +263,15 @@ sub add_Exon {
} else {
push( @{$self->{'exons'}}, $exon );
}
if(defined $exon && (!defined $self->{'start'} ||
$exon->start() < $self->{'start'})) {
$self->start($exon->start());
}
if(defined $exon && (!defined $self->{'exon'} ||
$exon->end() > $self->{'end'})) {
$self->end($exon->end());
}
}
......@@ -271,6 +381,8 @@ sub flush_Exon{
my ($self,@args) = @_;
$self->{'exons'} = [];
$self->{'start'} = undef;
$self->{'end'} = undef;
}
......
......@@ -142,15 +142,15 @@ sub get_all_SimilarityFeatures_above_score {
$self->warn("Call to Slice->get_all_SimilarityFeatures_above_score.");
my @prot_feats =
$self->get_ProteinAlignFeatures_above_score($logic_name, $score);
$self->get_all_ProteinAlignFeatures_above_score($logic_name, $score);
my @dna_feats =
$self->get_DnaAlignFeatures_above_score($logic_name, $score);
$self->get_all_DnaAlignFeatures_above_score($logic_name, $score);
return (@prot_feats, @dna_feats);
}
=head2 get_DnaAlignFeatures_above_score
=head2 get_all_DnaAlignFeatures_above_score
Args : $logic_name, $score
Function : returns all DnaAlignFeatures of type logic_name and above score
......@@ -160,7 +160,7 @@ sub get_all_SimilarityFeatures_above_score {
=cut
sub get_DnaAlignFeatures_above_score{
sub get_all_DnaAlignFeatures_above_score{
my ($self,$logic_name, $score) = @_;
$self->warn("Slice: get_all_SimilarityFeatures_above_score\n");
......@@ -174,7 +174,7 @@ sub get_DnaAlignFeatures_above_score{
return $dafa->fetch_by_Slice_and_score($self,$score, $logic_name);
}
=head2 get_ProteinAlignFeatures_above_score
=head2 get_all_ProteinAlignFeatures_above_score
Args : $logic_name, $score
Function : getss all ProteinAlignFeatures of type logic_name and above score
......@@ -184,7 +184,7 @@ sub get_DnaAlignFeatures_above_score{
=cut
sub get_ProteinAlignFeatures_above_score {
sub get_all_ProteinAlignFeatures_above_score {
my ($self, $logic_name, $score) = @_;
my $pafa = $self->adaptor->db->get_ProteinAlignFeatureAdaptor();
......@@ -295,26 +295,24 @@ sub get_all_RepeatFeatures{
=head2 get_all_PredictionFeatures
=head2 get_all_PredictionTranscripts
Title : get_all_PredictionFeatures
Usage : $obj->get_all_PredictionFeatures
Function: Use to derive a list of prediction features specific to the analysis type specified by the logic name.
Example : my @pred_rm_feat = $obj->get_all_PredictionFeatures('RepeatMasker');
Title : get_all_PredictionTranscripts
Usage : $obj->get_all_PredictionTranscripts
Function: Use to derive a list of prediction transcripts specific to the analysis type specified by the logic name.
Example : my @pred_rm_trans = $obj->get_all_PredictionTranscripts('RepeatMasker');
Returns : a list of Bio::EnsEMBL::PredictionTranscript objects
Args : a logic name - the name of the analysis that created or returned the prediction feature.
=cut
sub get_all_PredictionFeatures{
my ($self,@args) = @_;
sub get_all_PredictionTranscripts{
my ($self,$logic_name) = @_;
$self->warn("Slice: get_all_PredictionFeatures");
my @pred_feat = $self->adaptor->fetch_all_prediction_transcripts($self);
return @pred_feat;
my $pta = $self->adaptor()->db()->get_PredictionTranscriptAdaptor();
return $pta->fetch_by_Slice($self, $logic_name);
}
......
......@@ -58,10 +58,11 @@ use Bio::EnsEMBL::Root;
use Bio::EnsEMBL::Exon;
use Bio::EnsEMBL::Intron;
use Bio::EnsEMBL::Translation;
use Bio::EnsEMBL::TranscriptI;
use Bio::DBLinkContainerI;
@ISA = qw(Bio::EnsEMBL::Root Bio::DBLinkContainerI);
@ISA = qw(Bio::EnsEMBL::TranscriptI Bio::EnsEMBL::Root Bio::DBLinkContainerI );
# new() is inherited from Bio::Root::Object
# _initialize is where the heavy stuff will happen when new is called
......@@ -358,6 +359,7 @@ sub coding_start {
my $strand;
my $start;
if( defined $arg ) {
$self->{'coding_start'} = $arg;
......@@ -373,7 +375,7 @@ sub coding_start {
}
$self->{'coding_start'} = $start;
}
return $self->{'coding_start'};
}
......@@ -829,8 +831,6 @@ sub split_Transcript_to_Partial {
@exons = $self->get_all_Exons;
}
print STDERR "Got ",scalar(@exons)," from translateable exons\n";
# one exon genes - easy to handle. (unless of course they have UTRs ...)
if (@exons == 1) {
# can't just return self - spliced UTR exons should not be returned or they'll be translated ...
......
Markdown is supported
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