#!/usr/bin/perl -w
#use strict;
-
+use Switch;
use DBI;
use Config::IniFiles;
-use Switch;
+
require "interactionPath.pl";
{
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";
#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')";
$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"
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();
}
# 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);
$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`,
# 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);
#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' ";
}
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);
$optionId = $ARGV[0];
$fileName = $ARGV[1];
$curatorId = "";
-$labName = "";
-$userName = "";
-$dbh = setUpDBConnection();
+
switch($optionId){
#import gene information - accession id, synonym etc
case "1"