diff --git a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm index daa9b97142624e4640b843f748ef3f7e6551b033..19e12072e652d44e283609ea2a83fdea74ee795e 100644 --- a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm @@ -1141,6 +1141,8 @@ sub store_alt_alleles { The gene to store in the database Arg [2] : ignore_release in xrefs [default 1] set to 0 to use release info in external database references + Arg [3] : prevent coordinate recalculation if you are persisting + transcripts with this gene Example : $gene_adaptor->store($gene); Description: Stores a gene in the database. Returntype : the database identifier (dbID) of the newly stored gene @@ -1152,7 +1154,7 @@ sub store_alt_alleles { =cut sub store { - my ($self, $gene, $ignore_release) = @_; + my ($self, $gene, $ignore_release, $skip_recalculating_coordinates) = @_; if (!ref $gene || !$gene->isa('Bio::EnsEMBL::Gene')) { throw("Must store a gene object, not a $gene"); @@ -1281,7 +1283,7 @@ sub store { my $new = $transcripts->[$i]; my $old = $original_transcripts->[$i]; - $transcript_adaptor->store($new, $gene_dbID, $analysis_id); + $transcript_adaptor->store($new, $gene_dbID, $analysis_id, $skip_recalculating_coordinates); if (!defined($new_canonical_transcript_id) && $new->is_canonical()) diff --git a/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm index 799e73cff4def6f5b43d63862d820570163b02ee..933d491abbc7d05c9f6beec9c6e5cfd14e099f3d 100644 --- a/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm @@ -749,6 +749,8 @@ sub fetch_all_by_biotype { backward compatibility only and used to fall back to the gene analysis_id if no analysis object is attached to the transcript (which you should do for new code). + Arg [4] : prevent coordinate recalculation if you are persisting + transcripts with this gene Example : $transID = $tr_adaptor->store($transcript, $gene->dbID); Description: Stores a transcript in the database and returns the new internal identifier for the stored transcript. @@ -760,7 +762,7 @@ sub fetch_all_by_biotype { =cut sub store { - my ( $self, $transcript, $gene_dbID, $analysis_id ) = @_; + my ( $self, $transcript, $gene_dbID, $analysis_id, $skip_recalculating_coordinates ) = @_; if ( !ref($transcript) || !$transcript->isa('Bio::EnsEMBL::Transcript') ) @@ -775,7 +777,12 @@ sub store { } # Force lazy-loading of exons and ensure coords are correct. - $transcript->recalculate_coordinates(); + # If we have been told not to do this then skip doing this + # and we assume the user knows what they are doing. You have been + # warned + if(! $skip_recalculating_coordinates) { + $transcript->recalculate_coordinates(); + } my $is_current = ( defined( $transcript->is_current() ) ? $transcript->is_current()