Skip to content
Snippets Groups Projects
Commit 2130a4de authored by Arne Stabenau's avatar Arne Stabenau
Browse files

translateable exons were screwed on -1 strand, should have tested better sigh

parent 9a10b330
No related branches found
No related tags found
No related merge requests found
...@@ -1550,12 +1550,13 @@ sub adjust_start_end { ...@@ -1550,12 +1550,13 @@ sub adjust_start_end {
my $new_exon = Bio::EnsEMBL::Exon->new(); my $new_exon = Bio::EnsEMBL::Exon->new();
%{$new_exon} = %{$self}; %{$new_exon} = %{$self};
if( $self->strand() == 1 ) { if( $self->strand() == 1 ) {
$new_exon->start( $self->start() + $start_adjust ); $new_exon->start( $self->start() + $start_adjust );
$new_exon->end( $self->end() + $end_adjust ) $new_exon->end( $self->end() + $end_adjust )
} else { } else {
$new_exon->start( $self->end() - $start_adjust ); $new_exon->start( $self->start() - $end_adjust );
$new_exon->end( $self->start() - $end_adjust ) $new_exon->end( $self->end() - $start_adjust )
} }
return $new_exon; return $new_exon;
......
...@@ -51,7 +51,9 @@ package Bio::EnsEMBL::Protein; ...@@ -51,7 +51,9 @@ package Bio::EnsEMBL::Protein;
use vars qw(@ISA); use vars qw(@ISA);
use strict; use strict;
use Bio::Root::Object;
use Bio::EnsEMBL::Root;
use Bio::SeqI; use Bio::SeqI;
use Bio::EnsEMBL::Transcript; use Bio::EnsEMBL::Transcript;
use Bio::DBLinkContainerI; use Bio::DBLinkContainerI;
...@@ -60,34 +62,13 @@ use Bio::Tools::SeqStats; ...@@ -60,34 +62,13 @@ use Bio::Tools::SeqStats;
# Object preamble - inheriets from Bio::Root::Object # Object preamble - inheriets from Bio::Root::Object
@ISA = qw(Bio::PrimarySeq Bio::SeqI); @ISA = qw( Bio::PrimarySeq Bio::SeqI);
=head2 SeqI interface features =head2 SeqI interface features
=cut =cut
#=head2 add_date
# Title : add_date
# Usage : $self->add_date($ref)
# Function: adds a date
# Example :
# Returns :
# Args :
#=cut
#sub add_date {
# my ($self) = shift;
# foreach my $dt ( @_ ) {
# push(@{$self->{'date'}},$dt);
# }
#}
=head2 adaptor =head2 adaptor
Title : adaptor Title : adaptor
...@@ -109,31 +90,6 @@ sub adaptor { ...@@ -109,31 +90,6 @@ sub adaptor {
} }
#=head2 get_dates
# Title : get_dates
# Usage : foreach $dt ( $self->get_dates() )
# Function: gets an array of dates
# Example :
# Returns :
# Args :
#=cut
#sub get_dates {
# my ($self) = @_;
# $self->warn("In giving back dates, have not sorted out how stable id system works with proteins");
# return ();
# return @{$self->{'date'}};
#}
#sub each_date {
# my ($self) = @_;
# return $self->get_dates;
#}
=head2 species =head2 species
...@@ -441,7 +397,7 @@ sub get_all_ProfileFeatures{ ...@@ -441,7 +397,7 @@ sub get_all_ProfileFeatures{
} }
} }
return $self->{'_profile'}; return ( $self->{'_profile'} || [] );
} }
=head2 add_Profile =head2 add_Profile
...@@ -494,7 +450,7 @@ sub get_all_blastpFeatures{ ...@@ -494,7 +450,7 @@ sub get_all_blastpFeatures{
} }
} }
return $self->{'_blastp'}; return ( $self->{'_blastp'} || [] );
} }
=head2 add_blastp =head2 add_blastp
...@@ -543,7 +499,7 @@ sub get_all_PrintsFeatures{ ...@@ -543,7 +499,7 @@ sub get_all_PrintsFeatures{
$self->add_Prints($in); $self->add_Prints($in);
} }
} }
return $self->{'_prints'}; return ( $self->{'_prints'} || [] );
} }
=head2 add_Prints =head2 add_Prints
...@@ -594,7 +550,7 @@ sub get_all_PfamFeatures{ ...@@ -594,7 +550,7 @@ sub get_all_PfamFeatures{
$self->add_Pfam($in); $self->add_Pfam($in);
} }
} }
return $self->{'_pfam'}; return ( $self->{'_pfam'} || [] );
} }
=head2 add_Pfam =head2 add_Pfam
...@@ -643,7 +599,7 @@ sub get_all_PrositeFeatures{ ...@@ -643,7 +599,7 @@ sub get_all_PrositeFeatures{
$self->add_Prosite($in); $self->add_Prosite($in);
} }
} }
return $self->{'_prosite'}; return ( $self->{'_prosite'} || [] );
} }
=head2 add_Prosite =head2 add_Prosite
...@@ -692,7 +648,7 @@ sub get_all_SigpFeatures{ ...@@ -692,7 +648,7 @@ sub get_all_SigpFeatures{
$self->add_Sigp($in); $self->add_Sigp($in);
} }
} }
return $self->{'_sigp'}; return ( $self->{'_sigp'} || [] );
} }
=head2 add_Sigp =head2 add_Sigp
...@@ -743,7 +699,7 @@ sub get_all_TransmembraneFeatures{ ...@@ -743,7 +699,7 @@ sub get_all_TransmembraneFeatures{
} }
} }
return $self->{'_transmembrane'}; return ( $self->{'_transmembrane'} || [] );
} }
...@@ -794,7 +750,7 @@ sub get_all_CoilsFeatures{ ...@@ -794,7 +750,7 @@ sub get_all_CoilsFeatures{
$self->add_Coils($in); $self->add_Coils($in);
} }
} }
return $self->{'_coils'}; return ( $self->{'_coils'} || [] );
} }
=head2 add_Coils =head2 add_Coils
...@@ -841,7 +797,7 @@ sub get_all_LowcomplFeatures{ ...@@ -841,7 +797,7 @@ sub get_all_LowcomplFeatures{
$self->add_Lowcompl($in); $self->add_Lowcompl($in);
} }
} }
return $self->{'_lowcompl'}; return ( $self->{'_lowcompl'} || [] );
} }
=head2 add_LowCompl =head2 add_LowCompl
...@@ -891,7 +847,7 @@ sub get_all_SuperfamilyFeatures{ ...@@ -891,7 +847,7 @@ sub get_all_SuperfamilyFeatures{
$self->add_Superfamily($in); $self->add_Superfamily($in);
} }
} }
return $self->{'_superfamily'}; return ( $self->{'_superfamily'} || [] );
} }
=head2 add_Superfamily =head2 add_Superfamily
...@@ -917,129 +873,6 @@ sub add_Superfamily{ ...@@ -917,129 +873,6 @@ sub add_Superfamily{
} }
#=head2 add_intron
# Title : add_intron
# Usage :
# Function:
# Example :
# Returns :
# Args :
#=cut
#sub add_intron{
# my ($self,$value) = @_;
# if ((!defined $value) || (!$value->isa('Bio::EnsEMBL::ProteinFeature'))) {
# $self->throw("The Protein Feature added is not defined or is not a protein feature object");
# }
# push(@{$self->{'_intron'}},$value);
#}
#=head2 get_all_IntronFeatures
# Title : get_all_IntronFeatures
# Usage :my @introns_feature = $protein->get_all_IntronFeatures($proteinid)
# Function:Get all of the introns as ProteinFeatures for a given peptide and add them to protein features
# Example :
# Returns : Nothing
# Args :Peptide ID
#=cut
#sub get_all_IntronFeatures{
# my ($self) = @_;
# if (defined ($self->{'_intron'})) {
# return @{$self->{'_intron'}};
# }
# else {
# my $proteinid = $self->id();
# my $pa = $self->adaptor()->db()->get_ProteinAdaptor();
# my @array_introns = $pa->get_Introns($proteinid);
# foreach my $in (@array_introns) {
# $self->add_intron($in);
# }
# return @array_introns;
# }
#}
#=head2 add_snps
# Title : add_snps
# Usage :
# Function:
# Example :
# Returns :
# Args :
#=cut
#sub add_snps{
# my ($self,$value) = @_;
# if ((!defined $value)) {
# $self->throw("Value is not defined");
# }
# push(@{$self->{'_snp'}},$value);
#}
#=head2 get_all_SnpsFeatures
# Title : get_all_SnpsFeatures
# Usage :
# Function:
# Example :
# Returns :
# Args :
#=cut
#sub get_all_SnpsFeatures{
# my ($self) = @_;
# if (defined ($self->{'_snp'})) {
# return @{$self->{'_snp'}};
# }
# else {
# my $gbdb = $self->gbrowser_adaptor();
# my $snpdb = $self->snp_adaptor();
# my @snps_array = $self->adaptor->get_snps($self,$snpdb,$gbdb);
# foreach my $sn (@snps_array) {
# $self->add_snps($sn);
# }
# return @snps_array;
# }
#}
#Title : add_ProteinFeature (formerly add_Protein_feature)
# Usage :
# Function:
# Example :
# Returns :
# Args :
#=cut
#sub add_ProteinFeature{
# my ($self,$value) = @_;
# if ((!defined $value) || (!$value->isa('Bio::EnsEMBL::ProteinFeature'))) {
# $self->throw("[$value] is not a protein feature object");
# }
# push(@{$self->{'_prot_feat'}},$value);
# }
=head2 length =head2 length
...@@ -1093,81 +926,6 @@ sub get_all_DBLinks{ ...@@ -1093,81 +926,6 @@ sub get_all_DBLinks{
return $self->{'_dblinks'}; return $self->{'_dblinks'};
} }
#=head2 molecular_weight
# Title : molecular_weight
# Usage :
# Function: This method has been placed here for convenience function. This gets and return the molecular weight of the protein
# Example : my $mw = $protein->molecular_weight
# Returns : Moleculat weight of the peptide
# Args :
#=cut
#sub molecular_weight{
# my ($self) = @_;
# my $mw = ${Bio::Tools::SeqStats->get_mol_wt($self)}[0];
# return $mw;
#}
#=head2 checksum
# Title : checksum
# Usage : my $checksum = $protein->checksum()
# Function: Get the crc64 for the sequence of the protein (this method has been copied from _crc64 method which is in swiss.pm in Bioperl and have been placed here for convenience function
# Example :
# Returns : CRC64
# Args : Nothing
#=cut
#sub checksum{
# my ($self) = @_;
# my $sequence = \$self->seq();
# my $POLY64REVh = 0xd8000000;
# my @CRCTableh = 256;
# my @CRCTablel = 256;
# my $initialized;
# my $seq = $$sequence;
# my $crcl = 0;
# my $crch = 0;
# if (!$initialized) {
# $initialized = 1;
# for (my $i=0; $i<256; $i++) {
# my $partl = $i;
# my $parth = 0;
# for (my $j=0; $j<8; $j++) {
# my $rflag = $partl & 1;
# $partl >>= 1;
# $partl |= (1 << 31) if $parth & 1;
# $parth >>= 1;
# $parth ^= $POLY64REVh if $rflag;
# }
# $CRCTableh[$i] = $parth;
# $CRCTablel[$i] = $partl;
# }
# }
# foreach (split '', $seq) {
# my $shr = ($crch & 0xFF) << 24;
# my $temp1h = $crch >> 8;
# my $temp1l = ($crcl >> 8) | $shr;
# my $tableindex = ($crcl ^ (unpack "C", $_)) & 0xFF;
# $crch = $temp1h ^ $CRCTableh[$tableindex];
# $crcl = $temp1l ^ $CRCTablel[$tableindex];
# }
# my $crc64 = sprintf("%08X%08X", $crch, $crcl);
# return $crc64;
#}
......
...@@ -722,30 +722,21 @@ sub get_all_translateable_Exons { ...@@ -722,30 +722,21 @@ sub get_all_translateable_Exons {
my( @translateable ); my( @translateable );
foreach my $ex (@{$self->get_all_Exons}) { foreach my $ex (@{$self->get_all_Exons}) {
my $ex_id = $ex->dbID;
if ($ex ne $start_exon and ! @translateable) { if ($ex ne $start_exon and ! @translateable) {
next; # Not yet in translated region next; # Not yet in translated region
} }
my $start = $ex->start;
my $end = $ex->end;
my $length = $ex->length; my $length = $ex->length;
my $strand = $ex->strand;
my $trunc_start = $start;
my $trunc_end = $end;
my $adjust_start = 0;
my $adjust_end = 0;
# Adjust to translation start if this is the start exon # Adjust to translation start if this is the start exon
if ($ex == $start_exon ) { if ($ex == $start_exon ) {
if ($t_start < 1 or $t_start > $length) { if ($t_start < 1 or $t_start > $length) {
$self->throw("Translation start '$t_start' is outside exon $ex length=$length"); $self->throw("Translation start '$t_start' is outside exon $ex length=$length");
} }
if ($strand == 1) { $adjust_start = $t_start - 1;
$trunc_start = $start + $t_start - 1;
}
else {
$trunc_end = $end - $t_start + 1;
}
} }
# Adjust to translation end if this is the end exon # Adjust to translation end if this is the end exon
...@@ -753,22 +744,15 @@ sub get_all_translateable_Exons { ...@@ -753,22 +744,15 @@ sub get_all_translateable_Exons {
if ($t_end < 1 or $t_end > $length) { if ($t_end < 1 or $t_end > $length) {
$self->throw("Translation end '$t_end' is outside exon $ex length=$length"); $self->throw("Translation end '$t_end' is outside exon $ex length=$length");
} }
if ($strand == 1) { $adjust_end = $t_end - $length;
$trunc_end = $end - $length + $t_end;
}
else {
$trunc_start = $start + $length - $t_end;
}
} }
# Make a truncated exon if the translation start or # Make a truncated exon if the translation start or
# end causes the coordinates to be altered. # end causes the coordinates to be altered.
if ($trunc_start != $start or $trunc_end != $end) { if ($adjust_end || $adjust_start) {
my ( $adjust_start, $adjust_end ); my $newex = $ex->adjust_start_end( $adjust_start, $adjust_end );
$adjust_start = $trunc_start - $start;
$adjust_end = $trunc_end - $end;
push( @translateable, $ex->adjust_start_end( $adjust_start, $adjust_end )); push( @translateable, $newex );
} else { } else {
push(@translateable, $ex); push(@translateable, $ex);
} }
......
...@@ -26,6 +26,8 @@ if($opt_l) { ...@@ -26,6 +26,8 @@ if($opt_l) {
} }
#run all of the specified tests #run all of the specified tests
$ENV{'RUNTEST_ACTIVE'} = 1;
runtests(@{&get_all_tests('.', \@ARGV)}); runtests(@{&get_all_tests('.', \@ARGV)});
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
'user' => 'ensadmin', 'user' => 'ensadmin',
'pass' => 'ensembl', 'pass' => 'ensembl',
'host' => 'ecs1c', 'host' => 'ecs1c',
'zip' => 'multidb.zip', 'zip' => 'test_genome.zip',
#add a line with the dbname and module #add a line with the dbname and module
'databases' => { 'core' => 'Bio::EnsEMBL::DBSQL::DBAdaptor', 'databases' => { 'core' => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
......
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