Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Fix broken synonyms inserts
authorelserj <elserj@localhost>
Tue, 27 Mar 2018 22:02:10 +0000 (22:02 +0000)
committerelserj <elserj@localhost>
Tue, 27 Mar 2018 22:02:10 +0000 (22:02 +0000)
svn path=/; revision=656

interactome_scripts/load_species_db.pl

index bdfce67ebaa1d8eca3eb7400978c53a5446b74fd..014f2c46e2281f6119a8c2f5fe936241b654324a 100755 (executable)
@@ -79,7 +79,8 @@ foreach my $file (@files) {
        $dbh->do("CREATE TABLE if NOT EXISTS  $safe_syn_table(
                        `gene_id` VARCHAR( 255 ) NOT NULL ,
                        `species` VARCHAR( 255 ) NOT NULL ,
-                       `synonyms` TEXT
+                       `synonyms` TEXT ,
+                       UNIQUE KEY `gene_species_idx` (`gene_id`, `species`)
                        ) TYPE = MYISAM");
 
        # and the statement handler to do the inserts
@@ -103,6 +104,10 @@ foreach my $file (@files) {
                        if(defined($gene)) {
                                $seq_hash{$gene}->{'sequence'} = $seq;
                                $seq_hash{$gene}->{'gene_header'} = $gene_header;
+                               if($defined($synonyms)) {
+                                               $seq_hash{$gene}->{'synonyms'} = $synonyms;
+                                               undef $synonyms;
+                               }
                        }
                        $gene_header = $line;
                        $gene_header =~ s/^>//;
@@ -118,12 +123,15 @@ foreach my $file (@files) {
        # add the last gene to the hash
        $seq_hash{$gene}->{'sequence'} = $seq;
        $seq_hash{$gene}->{'gene_header'} = $gene_header;
+       if(defined($synonyms)) {
+                       $seq_hash{$gene}->{'synonyms'} = $synonyms;
+       }
 
        foreach my $key (keys %seq_hash) {
                $insert_sth->execute($key,$seq_hash{$key}->{'gene_header'},$seq_hash{$key}->{'sequence'});
 
-               if($synonyms ne "null") {
-                               $insert_syn_sth->execute($key,$species,$synonyms);
+               if($seq_hash{$key}->{'synonyms'} ne "null") {
+                               $insert_syn_sth->execute($key,$species,$seq_hash{$key}->{'synonyms'});
                }
        }
 }