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");
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];
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) {