#!/usr/bin/perl -w use strict; use DBI; use CGI; use CGI::Carp('fatalsToBrowser'); my $query = new CGI; print $query->header(); my $my_database = "TrypSnoDB"; my $localhost = "localhost"; my $dsn = "DBI:mysql:$my_database:$localhost"; my $db_user_name = "adrian"; my $db_password = "temp_pass"; my $dbh = DBI->connect("DBI:mysql:database=TrypSnoDB;host=localhost;mysql_socket=/private/software/mysql/mysql.sock","adrian","temp_pass", {'RaiseError' => 1}); print "\n"; print "\n"; print "Welcome to the T. Brucei snoRNA Database\n"; print "\n"; print "\n"; print "\n"; print "

Trypanosomatid snoRNA Database

\n"; print "\n"; print "\n"; print "\n"; if ($query->param('submit1')){ my $orig_sno = $query->param('snorna1'); my $family = $query->param('family1'); my $query_type = $query->param('target_option1'); my $target = $query->param('target_name1'); if ($orig_sno eq "Trypanosoma brucei") { $orig_sno = 1; } elsif ($orig_sno eq "Leishmania major") { $orig_sno = 7; } elsif ($orig_sno eq "ALL") { $orig_sno = "1 or ST.org_id=7"; } if ($family eq "ALL") { $family = "'C/D' or ST.family='H/ACA'"; } else { $family = "'$family'"; } if ($target ne "ALL") { $family = "$family and T.target_name='$target'"; } my($db_query,$common_tar,$exp_ver_sno,$exp_ver_tar,$total); $db_query = "SELECT ST.sno_name,T.target_name,T.location,T.base_pair,SM.annotated_seq FROM sno_Table ST,sno_Modifications SM,Targets T WHERE ST.sno_id=SM.sno_id and SM.mod_id=T.target_id and (ST.org_id=$orig_sno) and (ST.family=$family)"; $common_tar="and T.target_id in(SELECT T.target_id FROM sno_Table ST,sno_Modifications SM,Targets T WHERE ST.sno_id=SM.sno_id and SM.mod_id=T.target_id group by T.target_id having count(*)=2) order by T.location desc"; $exp_ver_sno="and ST.exper_ver='Y'"; $exp_ver_tar = "and T.exp_ver='Y'"; if ($query_type eq "snoRNAs with common targets") { $db_query=$db_query.$common_tar; } elsif ($query_type eq "Experimentally verified snoRNAs") { $db_query=$db_query.$exp_ver_sno; } elsif ($query_type eq "snoRNAs with experimentally verified targets") { $db_query=$db_query.$exp_ver_tar; } elsif ($query_type eq "ALL"){ $db_query=$db_query; } my $sth = $dbh->prepare($db_query); $sth->execute(); my$total = $sth->rows; print "\n \n \n \n \n \n \n"; while (my@row = $sth->fetchrow_array()){ my$sno_name = $row[0]; my$tar_name = $row[1]; my$tar_loc = $row[2]; my$tar_bp = $row[3]; my$annotated_seq = $row[4]; print "\n\n"; } print "\n \n \n"; print "
snoRNATarget NameTarget LocationTarget Base PairAnnotated Sequence
$sno_name$tar_name$tar_loc$tar_bp$annotated_seq
TOTAL$total
"; }