From a9f80e01acd4f4c758366ddb31640c9c8b95db95 Mon Sep 17 00:00:00 2001 From: Alessandro Vullo <avullo@ebi.ac.uk> Date: Mon, 29 Jul 2013 13:31:05 +0000 Subject: [PATCH] Correct substringing CDS string --- modules/Bio/EnsEMBL/Utils/IO/GTFSerializer.pm | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/Bio/EnsEMBL/Utils/IO/GTFSerializer.pm b/modules/Bio/EnsEMBL/Utils/IO/GTFSerializer.pm index fadb1e5158..a450ff773b 100644 --- a/modules/Bio/EnsEMBL/Utils/IO/GTFSerializer.pm +++ b/modules/Bio/EnsEMBL/Utils/IO/GTFSerializer.pm @@ -393,32 +393,29 @@ sub _check_start_and_stop { return (0,0) unless defined $trans->translation; my $tln = $trans->translation; + my $cds_seq = uc($trans->translateable_seq); - my $coding_start = $trans->cdna_coding_start; - my $coding_end = $trans->cdna_coding_end; - my $cds_seq = uc($trans->translateable_seq); # uc($trans->spliced_seq); - - my $startseq = substr($cds_seq,$coding_start-1,3); - my $endseq = substr($cds_seq,$coding_end-3,3); + my $startseq = substr($cds_seq, 0, 3); + my $endseq = substr($cds_seq, -3); my $has_start = 1; my $has_end = 1; # reimplemented because verterbrate specific - # $has_start = 0 if ($startseq ne "ATG"); - # $has_end = 0 if ($endseq ne "TAG" && $endseq ne "TGA" && $endseq ne "TAA"); + $has_start = 0 if ($startseq ne "ATG"); + $has_end = 0 if ($endseq ne "TAG" && $endseq ne "TGA" && $endseq ne "TAA"); - my ($attrib) = @{ $trans->slice()->get_all_Attributes('codon_table') }; + # my ($attrib) = @{ $trans->slice()->get_all_Attributes('codon_table') }; - my $codon_table_id; - $codon_table_id = $attrib->value() - if defined $attrib; - $codon_table_id ||= 1; # default vertebrate codon table + # my $codon_table_id; + # $codon_table_id = $attrib->value() + # if defined $attrib; + # $codon_table_id ||= 1; # default vertebrate codon table - my $codon_table = Bio::Tools::CodonTable->new( -id => $codon_table_id ); + # my $codon_table = Bio::Tools::CodonTable->new( -id => $codon_table_id ); - $has_start = 0 unless $codon_table->is_start_codon($startseq); - $has_end = 0 unless $codon_table->is_ter_codon($endseq); + # $has_start = 0 unless $codon_table->is_start_codon($startseq); + # $has_end = 0 unless $codon_table->is_ter_codon($endseq); return ($has_start, $has_end); -- GitLab