From: athreyab Date: Tue, 31 Jan 2012 22:56:55 +0000 (+0000) Subject: allow sif file to be a source of gene information X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=d170f6e8008585e97a112faf47531cda52c1fe7f;p=old-jaiswallab-svn%2F.git allow sif file to be a source of gene information svn path=/; revision=290 --- diff --git a/Personnel/athreyab/interactions/interactionPathsFromSif.pl b/Personnel/athreyab/interactions/interactionPathsFromSif.pl index 9e5b5bb..eb93e75 100644 --- a/Personnel/athreyab/interactions/interactionPathsFromSif.pl +++ b/Personnel/athreyab/interactions/interactionPathsFromSif.pl @@ -165,25 +165,32 @@ sub importSifData # strip off newline characters chomp $entry; $entry =~ s/\r//g; - $entry =~ s/\n//g; - - # split the columns into separate variables - my ($accession_left,$interaction_type,$accession_right) = split("\t", $entry); - - # skip if any of the variables are empty - next if(isEmpty($accession_left)); + $entry =~ s/\n//g; + + # split the columns into separate variables + my ($accession_left,$interaction_type,$accession_right) = split("\t", $entry); + + # skip if any of the variables are empty + next if(isEmpty($accession_left)); next if(isEmpty($interaction_type)); next if(isEmpty($accession_right)); - #get object_id for object in the first column + #get object_id for object in the first column $accession_left_id = getObjectIdFromAccession($accession_left); - - #get interaction_type_id for object in the first column - $interaction_type_id = getInteractionTypeForSifFormat($interaction_type); + if(isEmpty($accession_left_id)){ + $query = "INSERT INTO Object(`object_accession`, `species_id`) VALUES ('$accession_left', '$speciesIdForSif')"; + executeDbQuery($query); + $accession_left_id = getObjectIdFromAccession($accession_left); + } #get object_id for object in the second column $accession_right_id = getObjectIdFromAccession($accession_right); - + if(isEmpty($accession_right_id)){ + $query = "INSERT INTO Object(`object_accession`, `species_id`) VALUES ('$accession_right', '$speciesIdForSif')"; + executeDbQuery($query); + $accession_right_id = getObjectIdFromAccession($accession_right); + } + $interaction_type_id=getInteractionTypeForSifFormat($interaction_type); next if(isEmpty($accession_left_id) || isEmpty($accession_right_id) || isEmpty($interaction_type_id)); #check if the interaction is already recorded. Write to database only if it doesn't exist already.e