...
 
Commits (4)
......@@ -1590,7 +1590,8 @@ sub update {
my $update_gene_sql = qq(
UPDATE gene
SET biotype = ?,
SET stable_id = ?,
biotype = ?,
analysis_id = ?,
display_xref_id = ?,
description = ?,
......@@ -1611,19 +1612,20 @@ sub update {
my $sth = $self->prepare($update_gene_sql);
$sth->bind_param(1, $gene->get_Biotype->name, SQL_VARCHAR);
$sth->bind_param(2, $gene->analysis->dbID(), SQL_INTEGER);
$sth->bind_param(3, $display_xref_id, SQL_INTEGER);
$sth->bind_param(4, $gene->description(), SQL_VARCHAR);
$sth->bind_param(5, $gene->is_current(), SQL_TINYINT);
$sth->bind_param(1, $gene->stable_id(), SQL_VARCHAR);
$sth->bind_param(2, $gene->get_Biotype->name, SQL_VARCHAR);
$sth->bind_param(3, $gene->analysis->dbID(), SQL_INTEGER);
$sth->bind_param(4, $display_xref_id, SQL_INTEGER);
$sth->bind_param(5, $gene->description(), SQL_VARCHAR);
$sth->bind_param(6, $gene->is_current(), SQL_TINYINT);
if (defined($gene->canonical_transcript())) {
$sth->bind_param(6, $gene->canonical_transcript()->dbID(), SQL_INTEGER);
$sth->bind_param(7, $gene->canonical_transcript()->dbID(), SQL_INTEGER);
} else {
$sth->bind_param(6, 0, SQL_INTEGER);
$sth->bind_param(7, 1, SQL_INTEGER);
}
$sth->bind_param(7, $gene->version(), SQL_TINYINT);
$sth->bind_param(8, $gene->dbID(), SQL_INTEGER);
$sth->bind_param(8, $gene->version(), SQL_TINYINT);
$sth->bind_param(9, $gene->dbID(), SQL_INTEGER);
$sth->execute();
......
......@@ -1696,7 +1696,7 @@ sub update {
}
my $update_transcript_sql =
sprintf "UPDATE transcript SET analysis_id = ?, display_xref_id = ?, description = ?,%s biotype = ?, is_current = ?, canonical_translation_id = ?, version = ? WHERE transcript_id = ?", ($self->schema_version > 74)?" source = ?,":'';
sprintf "UPDATE transcript SET stable_id = ?, analysis_id = ?, display_xref_id = ?, description = ?,%s biotype = ?, is_current = ?, canonical_translation_id = ? WHERE transcript_id = ?", ($self->schema_version > 74)?" source = ?,":'';
my $display_xref = $transcript->display_xref();
my $display_xref_id;
......@@ -1709,6 +1709,7 @@ sub update {
my $sth = $self->prepare($update_transcript_sql);
my $i = 0;
$sth->bind_param( ++$i, $transcript->stable_id(), SQL_VARCHAR );
$sth->bind_param( ++$i, $transcript->analysis()->dbID(), SQL_INTEGER );
$sth->bind_param( ++$i, $display_xref_id, SQL_INTEGER );
$sth->bind_param( ++$i, $transcript->description(), SQL_LONGVARCHAR );
......
......@@ -590,6 +590,13 @@ sub remove {
my $attrib_adp = $self->db->get_AttributeAdaptor;
$attrib_adp->remove_from_Translation($translation);
#remove all transcripts links to translation
my $sth = $self->prepare
("UPDATE transcript SET canonical_translation_id = NULL WHERE canonical_translation_id = ?");
$sth->bind_param(1,$translation->dbID,SQL_INTEGER);
$sth->execute();
$sth->finish();
# remove all xref associations to this translation
my $dbe_adaptor = $self->db()->get_DBEntryAdaptor();
foreach my $dbe (@{$translation->get_all_DBEntries()}) {
......
......@@ -460,10 +460,12 @@ $gene->is_current(0);
$gene->canonical_transcript_id(2018226);
$gene->version(5);
$gene->analysis_id(8355);
$gene->stable_id('ENSGTEST00000171456');
$ga->update($gene);
$newgene = $ga->fetch_by_stable_id("ENSG00000171456");
$newgene = $ga->fetch_by_stable_id("ENSGTEST00000171456");
ok($newgene);
ok($newgene->display_xref->dbID() == 614);
ok($newgene->biotype eq 'dummy');
ok($newgene->description eq 'dummy');
......
......@@ -876,8 +876,10 @@ my $t1 = $ta->fetch_by_stable_id('ENST00000355555');
ok(!$t1); # 150
$tr->is_current(1);
$tr->stable_id('ENSTEST0000035555');
$ta->update($tr);
$tr = $ta->fetch_by_stable_id('ENST00000355555');
$tr = $ta->fetch_by_stable_id('ENSTEST0000035555');
ok($tr);
is($tr->is_current, 1, 'Transcript is now current'); # 151
my $null_versions = 0;
......
......@@ -192,6 +192,9 @@ my $pfeat_minus = @{$translation->get_all_ProteinFeatures()};
$ta->remove($translation);
my $transcript_after_remove = $tra->fetch_by_translation_id($translation->dbID);
ok(!$transcript_after_remove);
ok(!defined($translation->dbID));
ok(!defined($translation->adaptor()));
......