EnsEMBL/DBSQL/PredictionTranscriptAdaptor.pm untested

filter: Statementstmt 0.0% 0 / 243 Branchbran 0.0% 0 / 92 Conditioncond 0.0% 0 / 59 Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 418 CC 47 SCAR 59.8
CC
47
Cov
0%
_objs_from_sth
812.0
fetch_all_by_Slice
110.0
store
42.0
CRAP 396.6
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor -
34 Performs database interaction related to PredictionTranscripts
35  
36 =head1 SYNOPSIS
37  
38 # get a prediction transcript adaptor from the database
39 $pta = $database_adaptor->get_PredictionTranscriptAdaptor();
40  
41 # get a slice on a region of chromosome 1
42 $sa = $database_adaptor->get_SliceAdaptor();
43  
44 $slice = $sa->fetch_by_region( 'chromosome', 'x', 100000, 200000 );
45  
46 # get all the prediction transcripts from the slice region
47 $prediction_transcripts = @{ $pta->fetch_all_by_Slice($slice) };
48  
49 =head1 METHODS
50  
51 =cut
52  
53 package Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor;
54 $Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor::VERSION = '114.0.0_50'; # TRIAL
55 $Bio::EnsEMBL::DBSQL::PredictionTranscriptAdaptor::VERSION = '114.0.050';
56 use vars qw( @ISA );
57 use strict;
58  
59 use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor;
60 use Bio::EnsEMBL::DBSQL::AnalysisAdaptor;
61 use Bio::EnsEMBL::PredictionTranscript;
62 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
63  
64 @ISA = qw( Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor );
65  
66  
67 # _tables
68 #
69 # Arg [1] : none
70 # Example : none
71 # Description: Implements abstract superclass method to define the table used
72 # to retrieve prediction transcripts from the database
73 # Returntype : string
74 # Exceptions : none
75 # Caller : generic_fetch
76  
77 sub _tables {
78 my $self = shift;
79  
80 return ['prediction_transcript', 'pt'];
81 }
82  
83  
84 # _columns
85  
86 # Arg [1] : none
87 # Example : none
88 # Description: Implements abstract superclass method to define the columns
89 # retrieved in database queries used to create prediction
90 # transcripts.
91 # Returntype : list of strings
92 # Exceptions : none
93 # Caller : generic_fetch
94 #
95  
96 sub _columns {
97 my $self = shift;
98  
99 return qw( pt.prediction_transcript_id
100 pt.seq_region_id
101 pt.seq_region_start
102 pt.seq_region_end
103 pt.seq_region_strand
104 pt.analysis_id
105 pt.display_label);
106 }
107  
108  
109 =head2 fetch_by_stable_id
110  
111 Arg [1] : string $stable_id
112 The stable id of the transcript to retrieve
113 Example : $trans = $trans_adptr->fetch_by_stable_id('GENSCAN00000001234');
114 Description: Retrieves a prediction transcript via its display_label.
115 This method is called fetch_by_stable_id for polymorphism with
116 the TranscriptAdaptor. Prediction transcript display_labels are
117 not necessarily stable in that the same identifier may be reused
118 for a completely different prediction transcript in a subsequent
119 database release.
120 Returntype : Bio::EnsEMBL::PredictionTranscript
121 Caller : general
122 Status : Stable
123  
124 =cut
125  
126 sub fetch_by_stable_id {
127 my $self = shift;
128 my $stable_id = shift;
129  
130 throw('Stable_id argument expected') if(!$stable_id);
131  
132 my $syn = $self->_tables()->[1];
133  
134 $self->bind_param_generic_fetch($stable_id,SQL_VARCHAR);
135 my $pts = $self->generic_fetch("$syn.display_label = ?");
136  
137 return (@$pts) ? $pts->[0] : undef;
138 }
139  
140  
141  
142 =head2 fetch_all_by_Slice
143  
144 Arg [1] : Bio::EnsEMBL::Slice $slice
145 The slice to fetch transcripts on.
146 Arg [3] : (optional) boolean $load_exons
147 if true, exons will be loaded immediately rather than
148 lazy loaded later.
149 Example : $transcripts = $
150 Description: Overrides superclass method to optionally load exons
151 immediately rather than lazy-loading them later. This
152 is more efficient when there are a lot of transcripts whose
153 exons are going to be used.
154 Returntype : reference to list of transcripts
155 Exceptions : thrown if exon cannot be placed on transcript slice
156 Caller : Slice::get_all_Transcripts
157 Status : Stable
158  
159 =cut
160  
161 sub fetch_all_by_Slice {
162 my $self = shift;
163 my $slice = shift;
164 my $logic_name = shift;
165 my $load_exons = shift;
166  
167 my $transcripts = $self->SUPER::fetch_all_by_Slice($slice,$logic_name);
168  
169 # if there are 0 transcripts still do lazy-loading
170 if(!$load_exons || @$transcripts < 1) {
171 return $transcripts;
172 }
173  
174 # preload all of the exons now, instead of lazy loading later
175 # faster than 1 query per transcript
176  
177 # get extent of region spanned by transcripts
178 my ($min_start, $max_end);
179 my $ext_slice;
180  
181 unless ($slice->is_circular()) {
182 foreach my $t (@$transcripts) {
183 if (!defined($min_start) || $t->seq_region_start() < $min_start) {
184 $min_start = $t->seq_region_start();
185 }
186 if (!defined($max_end) || $t->seq_region_end() > $max_end) {
187 $max_end = $t->seq_region_end();
188 }
189 }
190  
191 if ($min_start >= $slice->start() && $max_end <= $slice->end()) {
192 $ext_slice = $slice;
193 } else {
194 my $sa = $self->db()->get_SliceAdaptor();
195 $ext_slice = $sa->fetch_by_region($slice->coord_system->name(), $slice->seq_region_name(), $min_start, $max_end, $slice->strand(), $slice->coord_system->version());
196 }
197  
198 } else {
199 # feature might be crossing the origin of replication (i.e. seq_region_start > seq_region_end)
200 # the computation of min_start|end based on seq_region_start|end is not safe
201 # use feature start/end relative to the slice instead
202 my ($min_start_feature, $max_end_feature);
203 foreach my $t (@$transcripts) {
204 if (!defined($min_start) || ($t->start() >= 0 && $t->start() < $min_start)) {
205 $min_start = $t->start();
206 $min_start_feature = $t;
207 }
208 if (!defined($max_end) || ($t->end() >= 0 && $t->end() > $max_end)) {
209 $max_end = $t->end();
210 $max_end_feature = $t;
211 }
212 }
213
214 # now we can reassign min_start|end to seq_region_start|end of
215 # the feature which spans the largest region
216 $min_start = $min_start_feature->seq_region_start();
217 $max_end = $max_end_feature->seq_region_end();
218  
219 my $sa = $self->db()->get_SliceAdaptor();
220 $ext_slice =
221 $sa->fetch_by_region($slice->coord_system->name(),
222 $slice->seq_region_name(),
223 $min_start,
224 $max_end,
225 $slice->strand(),
226 $slice->coord_system->version());
227 }
228  
229  
230 # associate exon identifiers with transcripts
231  
232 my %tr_hash = map {$_->dbID => $_} @$transcripts;
233  
234 my $tr_id_str = '(' . join(',', keys %tr_hash) . ')';
235  
236 my $sth = $self->prepare
237 ("SELECT prediction_transcript_id, prediction_exon_id, exon_rank " .
238 "FROM prediction_exon " .
239 "WHERE prediction_transcript_id IN $tr_id_str");
240  
241 $sth->execute();
242  
243 my ($ex_id, $tr_id, $rank);
244 $sth->bind_columns(\$tr_id, \$ex_id, \$rank);
245  
246 my %ex_tr_hash;
247  
248 while($sth->fetch()) {
249 $ex_tr_hash{$ex_id} ||= [];
250 push @{$ex_tr_hash{$ex_id}}, [$tr_hash{$tr_id}, $rank];
251 }
252  
253 $sth->finish();
254  
255 my $ea = $self->db()->get_PredictionExonAdaptor();
256 my $exons = $ea->fetch_all_by_Slice($ext_slice);
257  
258 # move exons onto transcript slice, and add them to transcripts
259 foreach my $ex (@$exons) {
260 $ex = $ex->transfer($slice) if($slice != $ext_slice);
261  
262 if(!$ex) {
263 throw("Unexpected. PredictionExon could not be transfered onto " .
264 "PredictionTranscript slice.");
265 }
266  
267 foreach my $row (@{$ex_tr_hash{$ex->dbID()}}) {
268 my ($tr, $rank) = @$row;
269 $tr->add_Exon($ex, $rank);
270 }
271 }
272  
273 return $transcripts;
274 }
275  
276  
277 =head2 fetch_by_prediction_exon_id
278  
279 Arg [1] : Int $prediction_exon_id
280 Unique database identifier for the prediction exon
281 whose prediction transcript should be retrieved.
282 Example : $prediction_transcript = $prediction_transcript_adaptor->fetch_by_exon_id(1241);
283 Description: Retrieves a prediction transcript from the database via the database identifier
284 of one of its exons.
285 Returntype : Bio::EnsEMBL::PredictionTranscript
286 Exceptions : none
287 Caller : general
288 Status : Stable
289  
290 =cut
291  
292 sub fetch_by_prediction_exon_id {
293 my ($self, $prediction_exon_id) = @_;
294  
295 # this is a cheap SQL call
296 my $sth = $self->prepare(
297 qq(
298 SELECT pe.prediction_transcript_id
299 FROM prediction_exon pe
300 WHERE pe.prediction_exon_id = ?
301 ));
302  
303 $sth->bind_param(1, $prediction_exon_id, SQL_INTEGER);
304 $sth->execute();
305  
306 my ($prediction_transcript_id) = $sth->fetchrow_array();
307  
308 $sth->finish();
309  
310 return undef if (!defined $prediction_transcript_id);
311  
312 my $prediction_transcript = $self->fetch_by_dbID($prediction_transcript_id);
313 return $prediction_transcript;
314 }
315  
316  
317  
318  
319  
320 =head2 _objs_from_sth
321  
322 Arg [1] : DBI:st $sth
323 An executed DBI statement handle
324 Arg [2] : (optional) Bio::EnsEMBL::Mapper $mapper
325 An mapper to be used to convert contig coordinates
326 to assembly coordinates.
327 Arg [3] : (optional) Bio::EnsEMBL::Slice $slice
328 A slice to map the prediction transcript to.
329 Example : $p_transcripts = $self->_objs_from_sth($sth);
330 Description: Creates a list of Prediction transcripts from an executed DBI
331 statement handle. The columns retrieved via the statement
332 handle must be in the same order as the columns defined by the
333 _columns method. If the slice argument is provided then the
334 the prediction transcripts will be in returned in the coordinate
335 system of the $slice argument. Otherwise the prediction
336 transcripts will be returned in the RawContig coordinate system.
337 Returntype : reference to a list of Bio::EnsEMBL::PredictionTranscripts
338 Exceptions : none
339 Caller : superclass generic_fetch
340 Status : Stable
341  
342 =cut
343  
344 sub _objs_from_sth {
345 my ($self, $sth, $mapper, $dest_slice) = @_;
346  
347 #
348 # This code is ugly because an attempt has been made to remove as many
349 # function calls as possible for speed purposes. Thus many caches and
350 # a fair bit of gymnastics is used.
351 #
352  
353 my $sa = $self->db()->get_SliceAdaptor();
354 my $aa = $self->db()->get_AnalysisAdaptor();
355  
356 my @ptranscripts;
357 my %analysis_hash;
358 my %slice_hash;
359 my %sr_name_hash;
360 my %sr_cs_hash;
361  
362 my (
363 $prediction_transcript_id, $seq_region_id, $seq_region_start,
364 $seq_region_end, $seq_region_strand, $analysis_id,
365 $display_label);
366  
367 $sth->bind_columns(\(
368 $prediction_transcript_id, $seq_region_id, $seq_region_start,
369 $seq_region_end, $seq_region_strand, $analysis_id,
370 $display_label));
371  
372 my $dest_slice_start;
373 my $dest_slice_end;
374 my $dest_slice_strand;
375 my $dest_slice_length;
376 my $dest_slice_cs;
377 my $dest_slice_sr_name;
378 my $dest_slice_sr_id;
379 my $asma;
380  
381 if ($dest_slice) {
382 $dest_slice_start = $dest_slice->start();
383 $dest_slice_end = $dest_slice->end();
384 $dest_slice_strand = $dest_slice->strand();
385 $dest_slice_length = $dest_slice->length();
386 $dest_slice_cs = $dest_slice->coord_system();
387 $dest_slice_sr_name = $dest_slice->seq_region_name();
388 $dest_slice_sr_id = $dest_slice->get_seq_region_id();
389 $asma = $self->db->get_AssemblyMapperAdaptor();
390 }
391  
392 FEATURE: while($sth->fetch()) {
393  
394 #get the analysis object
395 my $analysis = $analysis_hash{$analysis_id} ||= $aa->fetch_by_dbID($analysis_id);
396 $analysis_hash{$analysis_id} = $analysis;
397  
398 #need to get the internal_seq_region, if present
399 $seq_region_id = $self->get_seq_region_id_internal($seq_region_id);
400 my $slice = $slice_hash{"ID:".$seq_region_id};
401  
402 if (!$slice) {
403 $slice = $sa->fetch_by_seq_region_id($seq_region_id);
404 $slice_hash{"ID:".$seq_region_id} = $slice;
405 $sr_name_hash{$seq_region_id} = $slice->seq_region_name();
406 $sr_cs_hash{$seq_region_id} = $slice->coord_system();
407 }
408  
409 #obtain a mapper if none was defined, but a dest_seq_region was
410 if(!$mapper && $dest_slice && !$dest_slice_cs->equals($slice->coord_system)) {
411 $mapper = $asma->fetch_by_CoordSystems($dest_slice_cs, $slice->coord_system);
412 }
413  
414 my $sr_name = $sr_name_hash{$seq_region_id};
415 my $sr_cs = $sr_cs_hash{$seq_region_id};
416  
417 #
418 # remap the feature coordinates to another coord system
419 # if a mapper was provided
420 #
421  
422 if ($mapper) {
423  
424 if (defined $dest_slice && $mapper->isa('Bio::EnsEMBL::ChainedAssemblyMapper') ) {
425 ($seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand) =
426 $mapper->map($sr_name, $seq_region_start, $seq_region_end, $seq_region_strand, $sr_cs, 1, $dest_slice);
427  
428 } else {
429 ($seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand) =
430 $mapper->fastmap($sr_name, $seq_region_start, $seq_region_end, $seq_region_strand, $sr_cs);
431 }
432  
433 #skip features that map to gaps or coord system boundaries
434 next FEATURE if (!defined($seq_region_id));
435  
436 #get a slice in the coord system we just mapped to
437 $slice = $slice_hash{"ID:".$seq_region_id} ||= $sa->fetch_by_seq_region_id($seq_region_id);
438 }
439  
440 #
441 # If a destination slice was provided convert the coords.
442 #
443 if (defined($dest_slice)) {
444 my $seq_region_len = $dest_slice->seq_region_length();
445  
446 if ( $dest_slice_strand == 1 ) {
447 $seq_region_start = $seq_region_start - $dest_slice_start + 1;
448 $seq_region_end = $seq_region_end - $dest_slice_start + 1;
449  
450 if ( $dest_slice->is_circular ) {
451 # Handle circular chromosomes.
452  
453 if ( $seq_region_start > $seq_region_end ) {
454 # Looking at a feature overlapping the chromosome origin.
455  
456 if ( $seq_region_end > $dest_slice_start ) {
457 # Looking at the region in the beginning of the chromosome
458 $seq_region_start -= $seq_region_len;
459 }
460 if ( $seq_region_end < 0 ) {
461 $seq_region_end += $seq_region_len;
462 }
463 } else {
464 if ($dest_slice_start > $dest_slice_end && $seq_region_end < 0) {
465 # Looking at the region overlapping the chromosome
466 # origin and a feature which is at the beginning of the
467 # chromosome.
468 $seq_region_start += $seq_region_len;
469 $seq_region_end += $seq_region_len;
470 }
471 }
472 }
473 } else {
474  
475 my $start = $dest_slice_end - $seq_region_end + 1;
476 my $end = $dest_slice_end - $seq_region_start + 1;
477  
478 if ($dest_slice->is_circular()) {
479  
480 if ($dest_slice_start > $dest_slice_end) {
481 # slice spans origin or replication
482  
483 if ($seq_region_start >= $dest_slice_start) {
484 $end += $seq_region_len;
485 $start += $seq_region_len if $seq_region_end > $dest_slice_start;
486  
487 } elsif ($seq_region_start <= $dest_slice_end) {
488 # do nothing
489 } elsif ($seq_region_end >= $dest_slice_start) {
490 $start += $seq_region_len;
491 $end += $seq_region_len;
492  
493 } elsif ($seq_region_end <= $dest_slice_end) {
494 $end += $seq_region_len if $end < 0;
495  
496 } elsif ($seq_region_start > $seq_region_end) {
497 $end += $seq_region_len;
498 }
499  
500 } else {
501  
502 if ($seq_region_start <= $dest_slice_end and $seq_region_end >= $dest_slice_start) {
503 # do nothing
504 } elsif ($seq_region_start > $seq_region_end) {
505 if ($seq_region_start <= $dest_slice_end) {
506 $start -= $seq_region_len;
507 } elsif ($seq_region_end >= $dest_slice_start) {
508 $end += $seq_region_len;
509 }
510 }
511 }
512 }
513  
514 $seq_region_start = $start;
515 $seq_region_end = $end;
516 $seq_region_strand *= -1;
517  
518 } ## end else [ if ( $dest_slice_strand...)]
519  
520 # Throw away features off the end of the requested slice or on
521 # different seq_region.
522 if ($seq_region_end < 1
523 || $seq_region_start > $dest_slice_length
524 || ($dest_slice_sr_id != $seq_region_id)) {
525 next FEATURE;
526 }
527 $slice = $dest_slice;
528 }
529  
530 # Finally, create the new PredictionTranscript.
531 push( @ptranscripts,
532 $self->_create_feature('Bio::EnsEMBL::PredictionTranscript', {
533 '-start' => $seq_region_start,
534 '-end' => $seq_region_end,
535 '-strand' => $seq_region_strand,
536 '-adaptor' => $self,
537 '-slice' => $slice,
538 '-analysis' => $analysis,
539 '-dbID' => $prediction_transcript_id,
540 '-display_label' => $display_label
541 } ) );
542  
543 }
544  
545 return \@ptranscripts;
546 }
547  
548  
549  
550 =head2 store
551  
552 Arg [1] : list of Bio::EnsEMBL::PredictionTranscript @pre_transcripts
553 Example : $prediction_transcript_adaptor->store(@pre_transcripts);
554 Description: Stores a list of given prediction transcripts in database.
555 Puts dbID and Adaptor into each object stored object.
556 Returntype : none
557 Exceptions : on wrong argument type
558 Caller : general
559 Status : Stable
560  
561 =cut
562  
563 sub store {
564 my ( $self, @pre_transcripts ) = @_;
565  
566 my $ptstore_sth = $self->prepare
567 (qq{INSERT INTO prediction_transcript (seq_region_id, seq_region_start,
568 seq_region_end, seq_region_strand,
569 analysis_id, display_label)
570 VALUES( ?, ?, ?, ?, ?, ?)});
571  
572 my $ptupdate_sth = $self->prepare
573 (qq{UPDATE prediction_transcript SET display_label = ?
574 WHERE prediction_transcript_id = ?});
575  
576 my $db = $self->db();
577 my $analysis_adaptor = $db->get_AnalysisAdaptor();
578 my $pexon_adaptor = $db->get_PredictionExonAdaptor();
579  
580 FEATURE: foreach my $pt (@pre_transcripts) {
581 if(!ref($pt) || !$pt->isa('Bio::EnsEMBL::PredictionTranscript')) {
582 throw('Expected PredictionTranscript argument not [' . ref($pt).']');
583 }
584  
585 #skip prediction transcripts that have already been stored
586 if($pt->is_stored($db)) {
587 warning('Not storing already stored prediction transcript '. $pt->dbID);
588 next FEATURE;
589 }
590  
591 #get analysis and store it if it is not in the db
592 my $analysis = $pt->analysis();
593 if(!$analysis) {
594 throw('Prediction transcript must have analysis to be stored.');
595 }
596 if(!$analysis->is_stored($db)) {
597 $analysis_adaptor->store($analysis);
598 }
599  
600 #ensure that the transcript coordinates are correct, they may not be,
601 #if somebody has done some exon coordinate juggling and not recalculated
602 #the transcript coords.
603 $pt->recalculate_coordinates();
604  
605 my $original = $pt;
606 my $seq_region_id;
607 ($pt, $seq_region_id) = $self->_pre_store($pt);
608  
609 #store the prediction transcript
610 $ptstore_sth->bind_param(1,$seq_region_id,SQL_INTEGER);
611 $ptstore_sth->bind_param(2,$pt->start,SQL_INTEGER);
612 $ptstore_sth->bind_param(3,$pt->end,SQL_INTEGER);
613 $ptstore_sth->bind_param(4,$pt->strand,SQL_TINYINT);
614 $ptstore_sth->bind_param(5,$analysis->dbID,SQL_INTEGER);
615 $ptstore_sth->bind_param(6,$pt->display_label,SQL_VARCHAR);
616  
617 $ptstore_sth->execute();
618  
619 my $pt_id = $self->last_insert_id('prediction_transcript_id', undef, 'prediction_transcript');
620 $original->dbID($pt_id);
621 $original->adaptor($self);
622  
623 #store the exons
624 my $rank = 1;
625 foreach my $pexon (@{$original->get_all_Exons}) {
626 $pexon_adaptor->store($pexon, $pt_id, $rank++);
627 }
628  
629 # if a display label was not defined autogenerate one
630 if(!defined($pt->display_label())) {
631 my $zeros = '0' x (11 - length($pt_id));
632 my $display_label = uc($analysis->logic_name()) . $zeros . $pt_id;
633 $ptupdate_sth->bind_param(1,$display_label,SQL_VARCHAR);
634 $ptupdate_sth->bind_param(2,$pt_id,SQL_INTEGER);
635 $ptupdate_sth->execute();
636 $original->display_label($display_label);
637 }
638 }
639 }
640  
641  
642  
643 =head2 remove
644  
645 Arg [1] : Bio::EnsEMBL::PredictionTranscript $pt
646 Example : $prediction_transcript_adaptor->remove($pt);
647 Description: removes given prediction transcript $pt from database.
648 Returntype : none
649 Exceptions : throws if argument not a Bio::EnsEMBL::PredictionTranscript
650 Caller : general
651 Status : Stable
652  
653 =cut
654  
655 sub remove {
656 my $self = shift;
657 my $pre_trans = shift;
658  
659 if(!ref($pre_trans)||!$pre_trans->isa('Bio::EnsEMBL::PredictionTranscript')){
660 throw('Expected PredictionTranscript argument.');
661 }
662  
663 if(!$pre_trans->is_stored($self->db())) {
664 warning('PredictionTranscript is not stored in this DB - not removing.');
665 return;
666 }
667  
668 #remove all associated prediction exons
669 my $pexon_adaptor = $self->db()->get_PredictionExonAdaptor();
670 foreach my $pexon (@{$pre_trans->get_all_Exons}) {
671 $pexon_adaptor->remove($pexon);
672 }
673  
674 #remove the prediction transcript
675 my $sth = $self->prepare( "DELETE FROM prediction_transcript
676 WHERE prediction_transcript_id = ?" );
677 $sth->bind_param(1,$pre_trans->dbID,SQL_INTEGER);
678 $sth->execute();
679  
680 #unset the adaptor and internal id
681 $pre_trans->dbID(undef);
682 $pre_trans->adaptor(undef);
683 }
684  
685  
686 =head2 list_dbIDs
687  
688 Arg [1] : none
689 Example : @feature_ids = @{$prediction_transcript_adaptor->list_dbIDs()};
690 Description: Gets an array of internal ids for all prediction transcript
691 features in the current db
692 Arg[1] : <optional> int. not 0 for the ids to be sorted by the seq_region.
693 Returntype : list of ints
694 Exceptions : none
695 Caller : ?
696 Status : Stable
697  
698 =cut
699  
700 sub list_dbIDs {
701 my ($self, $ordered) = @_;
702  
703 return $self->_list_dbIDs("prediction_transcript", undef, $ordered);
704 }
705  
706 1;