Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
addressed a few review comments from Justin
authorathreyab <athreyab@localhost>
Thu, 26 Jan 2012 01:50:36 +0000 (01:50 +0000)
committerathreyab <athreyab@localhost>
Thu, 26 Jan 2012 01:50:36 +0000 (01:50 +0000)
svn path=/; revision=279

Personnel/athreyab/interactions/interactionPathsFromSif.pl
Personnel/athreyab/interactions/interactionPathsFromTsv.pl

index 3a32d0ac809584115c9213cb0f3a2488df1045ac..da35aac2191ba10af3efc74e1e2594c7604e0771 100644 (file)
@@ -1,10 +1,10 @@
 #!/usr/bin/perl -w
 
 #use strict;
-
+use Switch;
 use DBI;
 use Config::IniFiles;
-use Switch;
+
 require "interactionPath.pl";
 
 
@@ -40,7 +40,7 @@ sub getInteractionTypeForSifFormat
        {
                if($key eq $abbreviated_interaction_type){
                        $interaction_type = $value;
-                       break;
+                       last;
                }
        }
        $interaction_type ne "" || die "$abbreviated_interaction_type may not be present in the db";
@@ -191,8 +191,7 @@ sub importSifData
                        #a. interaction has not been recorded previously
                        #b. interaction is already recorded, but by a different curator - this is not something that we need right now
                                #but in the future, we may allow people other than the devs to upload the data themselves.
-               $interactionId = getInteractionId($accession_left_id,$interaction_type_id,$accession_right_id,$curator_id);
-               print "interaction id is: $interactionId\n";
+               $interactionId = getInteractionId($accession_left_id,$interaction_type_id,$accession_right_id,$curatorId);
                if(isEmpty($interactionId)){
                        $query = "INSERT INTO Interaction(`object_id_left`,`object_id_right`,`interaction_type_id`,`curator_id`)
                         VALUES('$accession_left_id','$accession_right_id','$interaction_type_id','$curatorId')";
@@ -215,14 +214,14 @@ $speciesId1ForOrtholog="";
 $speciesId2ForOrtholog="";
 $curatorId = "";
 %interaction_types=(pp=>"protein-protein binding",up=>"up regulation",down=>"down regulation");
-$dbh = setUpDBConnection();
+
 
 
 switch($optionId){
        #add a new species to our database.
        case "0"
        {
-               $speciesId = addNewSpecies(getSpeciesProperties(1));
+               addNewSpecies(getSpeciesProperties(1));
        }
        #import ortholog information
        case "1"
@@ -231,12 +230,13 @@ switch($optionId){
 
                print "Species - 1. Species to which gene ids in the first column belong to";
                $speciesId1ForOrtholog = getSpeciesId(getSpeciesProperties(0));
-               $speciesId1ForOrtholog ne "" || die "species not found in our tables.\n";
-
+               #$speciesId1ForOrtholog ne "" || die "species not found in our tables.\n";
+               !isEmpty($speciesId1ForOrtholog) || die "";
                print "\nSpecies - 2. Species to which gene ids in the second column belong to";
                $speciesId2ForOrtholog = getSpeciesId(getSpeciesProperties(0));
-               $speciesId2ForOrtholog ne "" || die "species not found in our tables.\n";
+               !isEmpty($speciesId2ForOrtholog) || die "";
 
+               $speciesId1ForOrtholog ne $speciesId2ForOrtholog || die "species have to be different\n";
                print "$speciesId1ForOrtholog"."\t"."$speciesId2ForOrtholog"."\n";
                importOrthologData();
        }
index 99ea7a5a792c0e0a4abb49cc14ce4419009a4b5b..bf0b1740db31a316dab59bd07df3e38ef6ce9157 100644 (file)
@@ -40,10 +40,8 @@ sub importSeedInteractionData(){
       # split the columns into separate variables
       my ($obj_abbr_left,$int_type_left,$mode_of_action,$obj_abbr_right,$int_type_right,$interaction_type,$evidence,$evidence_code,$experiment,$comments) = split("\t", $entry);
       
-      #we need all the 3 values before we can insert data into the interaction table.
-      next if(isEmpty($obj_abbr_left));
-      next if(isEmpty($obj_abbr_right));
-               next if(isEmpty($interaction_type));
+      #skip
+       next if(isEmpty($obj_abbr_left));
       
       #get ids(primary keys) from other tables
       $obj_id_left = getObjectIdFromAbbreviation($obj_abbr_left);
@@ -73,8 +71,8 @@ sub importSeedInteractionData(){
       $experiment_id = getExperimentId($experiment);
       
       #get interaction_id to see if already exists
-       $interaction_id = getInteractionId($obj_id_left,$interaction_type_id,$obj_id_right,$curator_id)
-       
+       $interaction_id = getInteractionId($obj_id_left,$interaction_type_id,$obj_id_right,$curator_id);
+       print "interaction_id:$interaction_id\n";
        #if not, insert data into to the database
        if(isEmpty($interaction_id)){
        $query = "INSERT INTO Interaction(`object_id_left`,`object_id_right`,`interaction_type_id`,`mode_of_action_id`,
@@ -95,7 +93,7 @@ sub importGeneInformation(){
                # strip off newline characters
                chomp $entry;
                $entry =~ s/\r//g;
-      $entry =~ s/\n//g;
+    $entry =~ s/\n//g;
       
       my ($accession, $is_gene,$is_metabolite,$symbol,$full_name,$synonym,$species_name,$ncbi_id) = split("\t", $entry);
       
@@ -123,6 +121,7 @@ sub importGeneInformation(){
                
                #gets synonym_id. The function returns the id if exists already. else, inserts synonym and returns the id.
                $synonym_id = getSynonymId($synonym);
+               print "synonym_id:$synonym_id\t";
                
                #construct the query and insert object information to the table.
                $query = "INSERT INTO Object(`object_accession`,`species_id`,`object_full_name`,`object_abbreviation`,`object_type_id`) VALUES('$accession','$species_id','$full_name','$symbol','$object_type') ON DUPLICATE KEY UPDATE object_accession='$accession' ";
@@ -137,7 +136,7 @@ sub importGeneInformation(){
                }
                executeDbQuery($query);
                $object_id = getObjectIdFromAccession($accession);
-       
+               print "object id: $object_id\n";
                #next, insert object_id and synonym_id into object_synonym table.
                $query = "INSERT INTO Object_synonym(`object_id`,`synonym_id`) VALUES ('$object_id','$synonym_id')";
                executeDbQuery($query);
@@ -155,9 +154,7 @@ if($#ARGV != 1){
 $optionId = $ARGV[0];
 $fileName = $ARGV[1];
 $curatorId = "";
-$labName = "";
-$userName = "";
-$dbh = setUpDBConnection();
+
 switch($optionId){
        #import gene information - accession id, synonym etc
    case "1"