Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Program to query inparanoid database and retrieve orthologs and paralogs
authorelserj <elserj@localhost>
Wed, 14 Apr 2010 20:20:04 +0000 (20:20 +0000)
committerelserj <elserj@localhost>
Wed, 14 Apr 2010 20:20:04 +0000 (20:20 +0000)
svn path=/; revision=15

interactome_scripts/find_ortho_inpara.pl [new file with mode: 0755]

diff --git a/interactome_scripts/find_ortho_inpara.pl b/interactome_scripts/find_ortho_inpara.pl
new file mode 100755 (executable)
index 0000000..51d9504
--- /dev/null
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+#####################################################################
+#    Written by Justin Elser 4/14/10                                #
+#                                                                   #
+#    This program takes an input file with a list of genes and      #
+#      finds the orthologs (and paralogs if the score in sth_get_ortho #
+#      is changed).                                                 #
+#                                                                   #
+#####################################################################
+
+use strict;
+use warnings;
+
+use lib "$ENV{HOME}/scripts/jaiswallab/interactome_scripts";
+
+use DbiFloret;
+
+my $dbh = DbiFloret::dbconnect;
+
+#my @species_array = ("Ath", "Oryza_sativa", "Sorghum", "Maize", "Glycine");
+my @species_array = ("Ath", "Maize");
+my $spec_array_size = @species_array;
+
+# read in list of genes from csv file given as argument
+my $in_file = $ARGV[0];
+
+open (in_file, "$in_file");
+
+my @in_gene_array;
+
+while(<in_file>) {
+       my $in_gene = $_;
+       chomp $in_gene; 
+       $in_gene .= ".1"; # add the suffix back so that the gene matches the db
+       push(@in_gene_array, $in_gene);
+       
+}
+close(in_file);
+
+open(out_file, ">flower_ortho.txt");
+
+for (my $i = 1; $i<$spec_array_size; $i++) {
+       
+       my $table = $species_array[0] . "_" . $species_array[$i];
+       print out_file "$species_array[$i]\t$table\n";
+       
+       # set up the db query statement
+       my $sth_get_id = $dbh->prepare("select id from $table where gene = ?");
+       
+       # set up db query statement to get the orthologs using the cluster id
+       my $sth_get_ortho = $dbh->prepare("select gene from $table where id = ? and species = '$species_array[$i]' and score = '1'");
+       
+       foreach my $gene (@in_gene_array) {
+               
+               my $rv1 = $sth_get_id->execute($gene);
+               if (!$rv1) {
+                       next;
+               }
+               
+               while (my $id = $sth_get_id->fetchrow_array()) {
+                       my $rv2 = $sth_get_ortho->execute($id);
+                       if (!$rv2) {
+                               next;
+                       }
+                       
+                       while (my $ortho = $sth_get_ortho->fetchrow_array()) {
+                               print out_file "$gene\t$ortho\n";
+                       }
+               }
+       }
+}
+
+close(out_file);