From: elserj Date: Tue, 16 Dec 2014 23:38:23 +0000 (+0000) Subject: Switch to using DBIFloret X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=9a404610ddb6cf43d0f327941340cf2fa53deeda;p=old-jaiswallab-svn%2F.git Switch to using DBIFloret svn path=/; revision=597 --- diff --git a/interactome_scripts/inparanoid_orthologs.pl b/interactome_scripts/inparanoid_orthologs.pl index 194a427..40228cf 100755 --- a/interactome_scripts/inparanoid_orthologs.pl +++ b/interactome_scripts/inparanoid_orthologs.pl @@ -3,36 +3,21 @@ use warnings; use strict; -use DBI; -use Term::Screen::ReadLine; if ($#ARGV != 0) { print "usage: inparanoid_orthologs.pl output_file\n"; exit; } -open(outfile,">$ARGV[0]") || die "Error: file '$ARGV[0]' can not be opened\n"; +open(OUTFILE,">$ARGV[0]") || die "Error: file '$ARGV[0]' can not be opened\n"; # define the database handle to be used +use lib "$ENV{HOME}/scripts/jaiswallab/interactome_scripts"; -my $screen = Term::Screen::ReadLine->new(); - # clear the screen - $screen->clrscr; - # ask for username - $screen->at(0,0)->puts("Username: "); - my $username = $screen->readline(ROW => 0, COL=>11); +use DbiFloret; - # ask for password, replace character presses with stars - $screen->at(1,0)->puts("Password: "); - my $password = $screen->readline(ROW => 1, COL => 11, PASSWORD => 1); - - $screen->at(2,0); - undef $screen; - -my $dbh = DBI->connect('DBI:mysql:inparanoid_data;host=floret.cgrb.oregonstate.edu', $username, $password, - { RaiseError=> 1, AutoCommit=>1 } - ) or die "Failed to connect to database: $DBI::errstr"; +my $dbh = DbiFloret::dbconnect; -my @species = ("Maize", "Oryza_sativa", "Ath", "Sorghum", "Brachy"); +my @species = ("Arabidopsis_thaliana", "Populus_trichocarpa"); my $num_species = @species; for (my $i=0; $i<$num_species-1; $i++) { @@ -88,12 +73,21 @@ for (my $i=0; $i<$num_species-1; $i++) { foreach my $key (keys %species_1_gene_hash) { if(defined($species_2_gene_hash{$key})) { - print outfile "$species_1_gene_hash{$key}\t$species_2_gene_hash{$key}\n"; + my @species_1_gene_array = split(" ", $species_1_gene_hash{$key}); + my @species_2_gene_array = split(" ", $species_2_gene_hash{$key}); + foreach my $gene_1 (@species_1_gene_array) { + print OUTFILE "$gene_1\t@species_2_gene_array" ."\n"; + } + #foreach my $gene_1 (@species_1_gene_array) { + # foreach my $gene_2 (@species_2_gene_array) { + # print OUTFILE "$gene_1\t$gene_2\n"; + # } + #} } } $sth->finish(); } } -close(outfile); +close(OUTFILE);