From: elserj Date: Fri, 28 Jun 2013 23:08:13 +0000 (+0000) Subject: Fixed to use dbifloret (generalizes the script so it doesn't have to be modfied by... X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=02eda5125b13e62f0a06d936bd7238a22c934806;p=old-jaiswallab-svn%2F.git Fixed to use dbifloret (generalizes the script so it doesn't have to be modfied by hand for each database) svn path=/; revision=489 --- diff --git a/interactome_scripts/inparanoid_output_parse.pl b/interactome_scripts/inparanoid_output_parse.pl index f02373e..92d3a7a 100755 --- a/interactome_scripts/inparanoid_output_parse.pl +++ b/interactome_scripts/inparanoid_output_parse.pl @@ -19,11 +19,25 @@ use strict; use warnings; use DBI; -use Term::Screen::ReadLine; use Getopt::Long; my $new = ''; -GetOptions ('new' => \$new); +my $strip = ''; +GetOptions ('new' => \$new, 'strip' => \$strip); + + +# set up the database connection +use lib "$ENV{HOME}/scripts/jaiswallab/interactome_scripts"; + +use DbiFloret; + +my $dbh = DbiFloret::dbconnect; + +if($new) { + $database = $dbh->selectrow_array("select DATABASE()"); + $dbh->do("drop database if exists $database"); + $dbh->do("create database $database"); +} if(-e "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl") { @@ -36,35 +50,7 @@ if(-e "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl") { my @files = glob("sqltable*"); -# define the database handle to be used - -my $database; - -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); - - # 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; - if($new) { - $database = ""; - my $dbh_temp = DBI->connect("DBI:mysql:$database;host=floret.cgrb.oregonstate.edu", $username, $password, - { RaiseError=> 1, AutoCommit=>1 } - ) or die "Failed to connect to database: $DBI::errstr"; - $dbh_temp->do("drop database inparanoid_data"); - $dbh_temp->do("create database inparanoid_data"); - $dbh_temp->disconnect; - } - 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 $clust_table = "clusters"; @@ -149,17 +135,27 @@ foreach my $input_file (@files) { $species = find_species($species); # the next line is no longer neccessary, future inparanoid runs will fix the gene headers before running #my $gene = find_gene($gene_header,$species); - # skip isomers that are not .1 - next if ($gene =~ /\.[2-9]$/); - next if ($gene =~ /\.1[0-9]$/); - next if ($gene =~ /\.2[0-9]$/); - next if ($gene =~ /\.3[0-9]$/); - next if ($gene =~ /\.4[0-9]$/); - next if ($gene =~ /\.5[0-9]$/); - next if ($gene =~ /\.6[0-9]$/); - next if ($gene =~ /\.7[0-9]$/); - next if ($gene =~ /\.8[0-9]$/); - next if ($gene =~ /\.9[0-9]$/); + # skip isomers that are not .1 if asked + if ($strip) { + if($species ne "Jatropha_curcas") { #Jatropha gene ids are .10, .20, .30, etc... + next if ($gene =~ /\.[2-9]$/); + next if ($gene =~ /\.1[0-9]$/); + next if ($gene =~ /\.2[0-9]$/); + next if ($gene =~ /\.3[0-9]$/); + next if ($gene =~ /\.4[0-9]$/); + next if ($gene =~ /\.5[0-9]$/); + next if ($gene =~ /\.6[0-9]$/); + next if ($gene =~ /\.7[0-9]$/); + next if ($gene =~ /\.8[0-9]$/); + next if ($gene =~ /\.9[0-9]$/); + } + + # skip Maize genes that are not the first transcript + if($species eq "Zea_mays") { + next if ($gene =~ /\_T0[2-9]$/); + next if ($gene =~ /\_T1[0-9]$/); + } + } if(!defined($id_hash{$clust_id})) { if ($clust_id ne $clust_id_prev) {