Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Input species order no longer matters. Added extra argument to make it detect which...
authorelserj <elserj@localhost>
Thu, 10 Mar 2016 21:42:40 +0000 (21:42 +0000)
committerelserj <elserj@localhost>
Thu, 10 Mar 2016 21:42:40 +0000 (21:42 +0000)
svn path=/; revision=643

interactome_scripts/find_ortho_inpara.pl

index 600cd2740f8c3b338d7f426e27d800563dc030c4..748d7a5cc8df42336e2f9ecc646b0ce217d0fdd3 100755 (executable)
 use strict;
 use warnings;
 
-if($#ARGV != 3) {
-       print "usage: find_ortho_inpara.pl species_1 species_2 input_gene_list output_file\n";
+if($#ARGV != 4) {
+       print "usage: find_ortho_inpara.pl species_1 species_2  input_species input_gene_list output_file\n";
        exit;
 }
 
 use lib "$ENV{HOME}/scripts/jaiswallab/interactome_scripts";
 
+
+my @temp_array = ($ARGV[0], $ARGV[1]);
+my @species_array = sort @temp_array;
+my $spec_array_size = @species_array;
+
+
 use DbiFloret;
 
 my $dbh = DbiFloret::dbconnect;
 
-my @species_array = ($ARGV[0], $ARGV[1]);
-#my @species_array = ("Arabidopsis_thaliana", "Zea_mays");
-#my @species_array = ("Ath", "Maize");
-my $spec_array_size = @species_array;
-
 # similarity score to determine if we should keep the paralogs.
 #  0.0 would keep all paralogs, 1.0 would restrict to strict orthologs
 my $sim_score = 0.1;
 
+# input species, needed to fix sth_get_ortho species_array index to the opposite
+my $in_species = $ARGV[2];
+my $species_index;
+if($in_species eq $species_array[0]) {
+               $species_index = 1;
+}elsif($in_species eq $species_array[1]) {
+               $species_index = 0;
+}else{
+               print "input_species doesn't match!!!/n";
+               die;
+}
+
 # read in list of genes from csv file given as argument
-my $in_file = $ARGV[2];
+my $in_file = $ARGV[3];
 
 open (in_file, "$in_file");
 
@@ -56,7 +69,7 @@ my %ortho_hash;
 
 for (my $i = 1; $i<$spec_array_size; $i++) {
        
-       my $out_file = $ARGV[3]; # . "_$species_array[3].txt";
+       my $out_file = $ARGV[4]; # . "_$species_array[3].txt";
        open(out_file, ">$out_file");
        
        my $table = $species_array[0] . "_" . $species_array[$i];
@@ -68,7 +81,7 @@ for (my $i = 1; $i<$spec_array_size; $i++) {
        my $sth_get_id = $dbh->prepare("select id from $safe_table where gene like ?");
        
        # set up db query statement to get the orthologs using the cluster id
-       my $sth_get_ortho = $dbh->prepare("select gene, score from $safe_table where id = ? and species = '$species_array[1]' and score >= '$sim_score'");
+       my $sth_get_ortho = $dbh->prepare("select gene, score from $safe_table where id = ? and species = '$species_array[$species_index]' and score >= '$sim_score'");
        
        foreach my $gene (@in_gene_array) {