diff --git a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm index 30e6ebd6fed8ce9ce381bd60dd4fe939ac48d2ec..69bc80a771aff10fa8bd9070fd9d31269ffd9aa8 100644 --- a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm +++ b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm @@ -613,13 +613,13 @@ SEQ # my $sql =(<<'LRG'); -SELECT ox.ensembl_id, gsi.gene_id - FROM xref x, object_xref ox, external_db e, gene_stable_id gsi +SELECT ox.ensembl_id, g.gene_id + FROM xref x, object_xref ox, external_db e, gene g WHERE x.xref_id = ox.xref_id AND e.external_db_id = x.external_db_id AND e.db_name like "Ens_Hs_gene" AND ox.ensembl_object_type = "Gene" AND - x.display_label = gsi.stable_id + x.display_label = g.stable_id LRG $sth = $self->core->dbc->prepare($sql); diff --git a/misc-scripts/xref_mapping/XrefMapper/CoreInfo.pm b/misc-scripts/xref_mapping/XrefMapper/CoreInfo.pm index 171bf6860e209dd76b13ffddff6b098019e547b3..fbcde51443e761c606f598ebdcbff57ba299d547 100644 --- a/misc-scripts/xref_mapping/XrefMapper/CoreInfo.pm +++ b/misc-scripts/xref_mapping/XrefMapper/CoreInfo.pm @@ -123,7 +123,7 @@ sub load_stable_ids{ my ($id, $stable_id); foreach my $table (qw(gene transcript translation)){ - my $sth = $self->core->dbc->prepare("select ".$table."_id, stable_id from ".$table."_stable_id"); + my $sth = $self->core->dbc->prepare("select ".$table."_id, stable_id from ".$table); my $ins_sth = $self->xref->dbc->prepare("insert into ".$table."_stable_id (internal_id, stable_id) values(?, ?)"); $sth->execute(); $sth->bind_columns(\$id, \$stable_id); diff --git a/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm b/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm index 7b67eedfc7fcdc12c02624d3224b661db205b259..37f9a389225dd64a6a942a7a6a324c2d7af710df 100644 --- a/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm +++ b/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm @@ -186,10 +186,10 @@ sub genes_and_transcripts_attributes_set{ # Special removal of LRG transcript display xref, xref and object_xrefs; - my $sth_lrg = $self->core->dbc->prepare('DELETE ox, x FROM object_xref ox, xref x, transcript t, transcript_stable_id tsi WHERE ox.xref_id = x.xref_id and tsi.transcript_id = t.transcript_id and t.display_xref_id = x.xref_id and tsi.stable_id like "LRG%"'); + my $sth_lrg = $self->core->dbc->prepare('DELETE ox, x FROM object_xref ox, xref x, transcript t WHERE ox.xref_id = x.xref_id and t.display_xref_id = x.xref_id and t.stable_id like "LRG%"'); $sth_lrg->execute; - $sth_lrg = $self->core->dbc->prepare('UPDATE transcript t, transcript_stable_id tsi SET t.display_xref_id = null WHERE tsi.stable_id like "LRG%" and tsi.transcript_id = t.transcript_id'); + $sth_lrg = $self->core->dbc->prepare('UPDATE transcript SET display_xref_id = null WHERE stable_id like "LRG%" '); $sth_lrg->execute; #End of Special diff --git a/misc-scripts/xref_mapping/XrefMapper/caenorhabditis_elegans.pm b/misc-scripts/xref_mapping/XrefMapper/caenorhabditis_elegans.pm index cd39c05b5ef0aa09ed0746d572083d06c8c6779c..d7cdb1540234ad396db5e567a96e05daa257048f 100644 --- a/misc-scripts/xref_mapping/XrefMapper/caenorhabditis_elegans.pm +++ b/misc-scripts/xref_mapping/XrefMapper/caenorhabditis_elegans.pm @@ -27,7 +27,7 @@ sub build_display_xrefs { print "Setting $type display_xrefs from $type stable IDs\n"; my $dir = $self->core()->dir(); - my $sql = "UPDATE $type t, ${type}_stable_id s, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.${type}_id=s.${type}_id AND s.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; + my $sql = "UPDATE $type t, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; open (SQL, ">$dir/${type}_display_xref.sql"); diff --git a/misc-scripts/xref_mapping/XrefMapper/saccharomyces_cerevisiae.pm b/misc-scripts/xref_mapping/XrefMapper/saccharomyces_cerevisiae.pm index eda28d742708fa407314bb5c0d1d274165acf8f2..deb9a063b9cbe773da45700add4e4ee79078f4f3 100644 --- a/misc-scripts/xref_mapping/XrefMapper/saccharomyces_cerevisiae.pm +++ b/misc-scripts/xref_mapping/XrefMapper/saccharomyces_cerevisiae.pm @@ -27,7 +27,7 @@ sub build_display_xrefs { print "Setting $type display_xrefs from $type stable IDs\n"; my $dir = $self->core()->dir(); - my $sql = "UPDATE $type t, ${type}_stable_id s, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.${type}_id=s.${type}_id AND s.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; + my $sql = "UPDATE $type t, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; open (SQL, ">$dir/${type}_display_xref.sql"); diff --git a/misc-scripts/xref_mapping/XrefMapper/schizosaccharomyces_pombe.pm b/misc-scripts/xref_mapping/XrefMapper/schizosaccharomyces_pombe.pm index 7d81e950014a953aa0bf3cdbdf1ed78acde582d3..971f14ab46e6fd6a987b97064eb2ba0d2421d224 100644 --- a/misc-scripts/xref_mapping/XrefMapper/schizosaccharomyces_pombe.pm +++ b/misc-scripts/xref_mapping/XrefMapper/schizosaccharomyces_pombe.pm @@ -26,7 +26,7 @@ sub build_display_xrefs { print "Setting $type display_xrefs from $type stable IDs\n"; my $dir = $self->core()->dir(); - my $sql = "UPDATE $type t, ${type}_stable_id s, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.${type}_id=s.${type}_id AND s.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; + my $sql = "UPDATE $type t, xref x, external_db e SET t.display_xref_id=x.xref_id WHERE t.stable_id=x.dbprimary_acc AND e.external_db_id=x.external_db_id AND e.db_name=\'${external_db}\'\n"; open (SQL, ">$dir/${type}_display_xref.sql"); diff --git a/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm b/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm index fef1ae29799cb9acc0f48a21802530d92899ba88..3d2075e3b2640977f7abf469142bc296314cfc71 100644 --- a/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/CCDSParser.pm @@ -60,11 +60,11 @@ sub run_script { my $xref_count = 0; my $sql =(<<'SCD'); -SELECT tsi.stable_id, x.dbprimary_acc - FROM xref x, object_xref ox, transcript_stable_id tsi, external_db e +SELECT t.stable_id, x.dbprimary_acc + FROM xref x, object_xref ox, transcript t, external_db e WHERE x.xref_id=ox.xref_id AND ox.ensembl_object_type = "Transcript" AND - ox.ensembl_id = tsi.transcript_id AND + ox.ensembl_id = t.transcript_id AND e.external_db_id = x.external_db_id AND e.db_name like "Ens_%_transcript" SCD diff --git a/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm b/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm index 923f22e8ff24377d4b4b1d02924f62c810df7dc4..46654cb75cbac95ba3c0e280bdde0f0709ecf89a 100644 --- a/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/OTTTParser.pm @@ -44,11 +44,11 @@ sub run_script { my $sql =(<<'SQL'); -SELECT tsi.stable_id, x.display_label - FROM xref x, object_xref ox , transcript_stable_id tsi, external_db e +SELECT t.stable_id, x.display_label + FROM xref x, object_xref ox , transcript t, external_db e WHERE e.external_db_id = x.external_db_id AND x.xref_id = ox.xref_id AND - tsi.transcript_id = ox.ensembl_id AND + t.transcript_id = ox.ensembl_id AND e.db_name like ? SQL diff --git a/misc-scripts/xref_mapping/XrefParser/VegaOfficialNameParser.pm b/misc-scripts/xref_mapping/XrefParser/VegaOfficialNameParser.pm index 00d771f1d7a69720c8bacccb064bd4d27df2f2ab..a94bb18ccff10e290602c1f2e885f732bd493741 100644 --- a/misc-scripts/xref_mapping/XrefParser/VegaOfficialNameParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/VegaOfficialNameParser.pm @@ -162,23 +162,21 @@ sub run_script { my $sql =(<<SQL); -SELECT tsi.stable_id, x.display_label - FROM analysis a, xref x, object_xref ox , transcript_stable_id tsi, external_db e , transcript t +SELECT t.stable_id, x.display_label + FROM analysis a, xref x, object_xref ox , transcript t, external_db e WHERE a.analysis_id = t.analysis_id and - t.transcript_id = tsi.transcript_id and e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and - tsi.transcript_id = ox.ensembl_id and + t.transcript_id = ox.ensembl_id and a.logic_name like "%havana%" and e.db_name like ? SQL my $ext_sql =(<<EXT); -SELECT tsi.stable_id, x.dbprimary_acc - FROM xref x, object_xref ox , transcript_stable_id tsi, gene g, external_db e, transcript t +SELECT t.stable_id, x.dbprimary_acc + FROM xref x, object_xref ox , transcript t, gene g, external_db e WHERE t.gene_id = g.gene_id and g.gene_id = ox.ensembl_id and - tsi.transcript_id = t.transcript_id and e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and ox.ensembl_object_type = "Gene" and diff --git a/misc-scripts/xref_mapping/XrefParser/WormbaseDatabaseStableIDParser.pm b/misc-scripts/xref_mapping/XrefParser/WormbaseDatabaseStableIDParser.pm index 125cec3fe368cc45f82a46c61bbcc34b3f5832f2..c38fd700e8bfe286465059a68df42d7d7c4407d3 100644 --- a/misc-scripts/xref_mapping/XrefParser/WormbaseDatabaseStableIDParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/WormbaseDatabaseStableIDParser.pm @@ -39,7 +39,7 @@ sub run { my $wb_source_id = $self->get_source_id_for_source_name("wormbase_$type"); - my $sth = $db->prepare( "SELECT stable_id FROM ${type}_stable_id" ); + my $sth = $db->prepare( "SELECT stable_id FROM ${type}" ); $sth->execute(); while(my @row = $sth->fetchrow_array()) { diff --git a/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm b/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm index 68dd9ad2ae7c568c5e5e5726de0ff44670be353f..c3600ca9572093ea86b2cc3d179e2a05e51dc840 100644 --- a/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/curated_transcriptParser.pm @@ -156,9 +156,9 @@ sub run_script { print "source id is $source_id, curated_source_id is $curated_source_id\n"; - my $sql = 'select tsi.stable_id, x.display_label, t.status from analysis a, xref x, object_xref ox , transcript_stable_id tsi, external_db e, transcript t where t.analysis_id = a.analysis_id and a.logic_name like "%havana%" and e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and tsi.transcript_id = ox.ensembl_id and t.transcript_id = tsi.transcript_id and e.db_name like ?'; + my $sql = 'select t.stable_id, x.display_label, t.status from analysis a, xref x, object_xref ox , external_db e, transcript t where t.analysis_id = a.analysis_id and a.logic_name like "%havana%" and e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and t.transcript_id = ox.ensembl_id and e.db_name like ?'; - my $sql_vega = 'select tsi.stable_id, x.display_label, t.status from xref x, object_xref ox , transcript_stable_id tsi, external_db e, transcript t where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and tsi.transcript_id = ox.ensembl_id and t.transcript_id = tsi.transcript_id and tsi.stable_id <> x.display_label and e.db_name like ?'; + my $sql_vega = 'select t.stable_id, x.display_label, t.status from xref x, object_xref ox , external_db e, transcript t where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and t.transcript_id = ox.ensembl_id and t.stable_id <> x.display_label and e.db_name like ?'; my %ott_to_vega_name; @@ -220,7 +220,7 @@ sub run_script { # need to add gene info to havana_status table - $sql = 'select gsi.stable_id, x.display_label from xref x, object_xref ox , gene_stable_id gsi, external_db e, gene g where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and gsi.gene_id = ox.ensembl_id and g.gene_id = gsi.gene_id and e.db_name like "OTTG"'; + $sql = 'select g.stable_id, x.display_label from xref x, object_xref ox , external_db e, gene g where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and g.gene_id = ox.ensembl_id and e.db_name like "OTTG"'; $sth = $core_dbc->prepare($sql) || die "Could not prepare for core $sql\n"; $sth->execute() or croak( $core_dbc->errstr()); @@ -229,7 +229,7 @@ sub run_script { $ottg_to_ensg{$row[1]} = $row[0]; } - $sth = $vega_dbc->prepare("select gsi.stable_id, g.status from gene g, gene_stable_id gsi where g.gene_id = gsi.gene_id"); + $sth = $vega_dbc->prepare("select stable_id, status from gene"); $sth->execute() or croak( $core_dbc->errstr()); while ( my @row = $sth->fetchrow_array() ) { if(defined($ottg_to_ensg{$row[0]}) and defined($row[1])){ diff --git a/misc-scripts/xref_mapping/compare_xrefs_by_source.pl b/misc-scripts/xref_mapping/compare_xrefs_by_source.pl index 83e87ea72df519890de510fc9b430eed5afa386e..41ead1f851a664f73daed38b0334ecf0f1efeafe 100644 --- a/misc-scripts/xref_mapping/compare_xrefs_by_source.pl +++ b/misc-scripts/xref_mapping/compare_xrefs_by_source.pl @@ -64,7 +64,7 @@ sub compare { #print "Caching old gene stable ID - $source display_xref mappings from $old_dbname\n"; - my $sql = "SELECT gsi.stable_id, x.dbprimary_acc FROM xref x, gene_stable_id gsi, gene g, external_db e WHERE gsi.gene_id=g.gene_id AND g.display_xref_id=x.xref_id AND e.external_db_id=x.external_db_id AND e.db_name='" . $source . "'"; + my $sql = "SELECT g.stable_id, x.dbprimary_acc FROM xref x, gene g, external_db e WHERE g.display_xref_id=x.xref_id AND e.external_db_id=x.external_db_id AND e.db_name='" . $source . "'"; #print "\n\n$sql\n\n"; my $old_sth = $old_dbi->prepare($sql); diff --git a/misc-scripts/xref_mapping/core_vega_link_check.pl b/misc-scripts/xref_mapping/core_vega_link_check.pl index 15606ef8b6d3f53ce34a9caf42b9df8eaa6d54d7..e0ed13c69c7074598a20abc01cf8863a3829e519 100644 --- a/misc-scripts/xref_mapping/core_vega_link_check.pl +++ b/misc-scripts/xref_mapping/core_vega_link_check.pl @@ -29,7 +29,7 @@ if(!defined($vega_sa)){ } -my $sql = 'select tsi.stable_id, x.display_label from xref x, object_xref ox , transcript_stable_id tsi, external_db e where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and tsi.transcript_id = ox.ensembl_id and e.db_name like ?'; +my $sql = 'select t.stable_id, x.display_label from xref x, object_xref ox , transcript t, external_db e where e.external_db_id = x.external_db_id and x.xref_id = ox.xref_id and t.transcript_id = ox.ensembl_id and e.db_name like ?';