diff --git a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm index f9f9add7d1ebb696552c8a13f283ae8e251b7545..deca2aabcd0fe9730a505ed41595a6dccf401d19 100644 --- a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm @@ -15,6 +15,7 @@ my $add_xref_sth = undef; my $add_direct_xref_sth = undef; my $add_dependent_xref_sth = undef; my $get_xref_sth = undef; +my $add_synonym_sth = undef; my $dbi; my %dependent_sources; @@ -826,6 +827,21 @@ sub add_to_xrefs{ } +sub add_to_syn{ + my ($self, $acc, $source_id, $syn) = @_; + + if(!defined($add_synonym_sth)){ + $add_synonym_sth = $dbi->prepare("INSERT INTO synonym VALUES(?,?)"); + } + my $xref_id = get_xref($acc, $source_id); + if(defined($xref_id)){ + $add_synonym_sth->execute($xref_id, $syn) || die "$dbi->errstr \n $xref_id\n $syn\n"; + } + else{ + die "Could not find acc $acc in xref table source = $source_id\n"; + } +} + # -------------------------------------------------------------------------------- # Add a single record to the direct_xref table. # Note that an xref must already have been added to the xref table (xref_id passed as 1st arg)