#!/usr/local/bin/oldperl # # EXDDisplayEDS: This program is invoked from the 'Welcome to the ExpressDB' page # by hotlinks in the table giving brief descriptions of each EDS. # # It does a select on the detail EDS information and presents it. # # Copyright (c) 1998, 1999 by John Aach and the President and Fellows of Harvard University # Created 12/04/98-12/09/98 by John Aach # modified: 12/15/98 to show DisplayLevel # modified: 01/05/98 to use $DIRECTORY global variable in HREFs and ACTIONs. # modified: 01/07/99: use HTMLString on displayed data # modified: 02/15/99: show PrivateInd # modified: 03/11/99: show LastModUserid and LastModReason $MODULE = "EXDDisplayEDS"; use Sybase::DBlib; $SUCCEED = 1; $FAIL = 0; use FileHandle; autoflush STDOUT 1; # Set up STDOUT for autoflush use EXDutilities; use EXDGetSession; # Get variables into %CGI hash. EDSNo has the record for which we must # select details. EXDutilities->GetVariables(); # Put out header. As part of this, write out an EDSNo cookie just in case # the user decides to select this dataset by means of the hotlink on # the Number of Measures. print <<_HTML0 Content-type: text/html ExpressDB Yeast Expression Dataset Description _HTML0 ; print "\n"; print ""; # Get Sybase session $dbh = EXDGetSession->Get("ExpressDBGuest","ExpressDBGuest", "ExpressDB"); # Do a select on the EDS record to get detail data: this is returned in the %eds hash. GetEDSDetails($dbh,$CGI{EDSNo},\%eds); # set up some variables for the page being sent $lastmoddate = $eds{LastModDate}; if ($lastmoddate eq "") { $lastmoddate = "NONE"; } $shortdescrip = EXDutilities->HTMLString($eds{ShortDescrip}); # 01/07/99 if ($shortdescrip eq "") { $shortdescrip = "NONE"; } $longdescrip = EXDutilities->HTMLString($eds{LongDescrip}); # 01/07/99 if ($longdescrip eq "") { $longdescrip = "NONE"; } $reference = EXDutilities->HTMLString($eds{Reference}); # 01/07/99 if ($reference eq "") { $reference = "NONE"; } $strain = EXDutilities->HTMLString($eds{Strain}); # 01/07/99 if ($strain eq "") { $strain = "NONE"; } $conditions = EXDutilities->HTMLString($eds{Conditions}); # 01/07/99 if ($conditions eq "") { $conditions = "NONE"; } if ($eds{URL} ne "") { $url = "$eds{URL}"; } else { $url = "NONE"; } if ($eds{DisplayLevel} == 1) { # 12/15/98 $displaylevelmsg = "(always include in selection lists)"; } elsif ($eds{DisplayLevel} == 2) { $displaylevelmsg = "(include in unabridged selection lists)"; } else { $displaylevelmsg = ""; } $meascount = GetMeasureCount($dbh,$CGI{EDSNo}); if ($eds{PrivateInd} == 0) { # 02/15/99 $securitystatus = "public"; # 02/15/99 } # 02/15/99 else { # 02/15/99 $securitystatus = "private"; # 02/15/99 } # 02/15/99 if ($eds{LastModUserid} ne "") { # 03/11/99 $lastmoduser = $eds{LastModUserid}; # 03/11/99 } # 03/11/99 else { # 03/11/99 $lastmoduser = "NONE"; # 03/11/99 } # 03/11/99 if ($eds{LastModReason} ne "") { # 03/11/99 $lastmodreason = EXDutilities->HTMLString($eds{LastModReason}); # 03/11/99 } # 03/11/99 else { # 03/11/99 $lastmodreason = "NONE"; # 03/11/99 } # 03/11/99 print <<_HTML1

Expression Data Set details

Information Item Value
Dataset Name $eds{EDSName}
Dataset Number $eds{EDSNo}
Short Description $shortdescrip
Source URL $url
Reference $reference
Strains $strain
Conditions $conditions
Date Entered on ExpressDB $eds{DateEntered}
Last date modified on EDS $lastmoddate
Last modification userid $lastmoduser
Last modification reason $lastmodreason
Number of Measures on ExpressDB $meascount (here to select dataset and view measure details)
Long Description $longdescrip
Display Level $eds{DisplayLevel} $displaylevelmsg
Data Security Status $securitystatus
_HTML1 ; EXDutilities->EndPage(); sub GetEDSDetails { my $dbh=$_[0]; my $edsno = $_[1]; my $eds_ref = $_[2]; my $sqlcmd; my @data; my $status; my $colname; $sqlcmd = "select * from EDS where EDSNo = $edsno and IsDeletedInd = 0"; $status = $dbh->dbcmd($sqlcmd); if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetEDSDetails: Return code from dbcmd = $status\n"); } $status = $dbh->dbsqlexec; if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetEDSDetails: Return code from dbsqlexec = $status\n"); } $status = $dbh->dbresults; if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetEDSDetails: Return code from dbresults = $status\n"); } $status = $dbh->DBROWS; if ($status == $SUCCEED) { while (@data = $dbh->dbnextrow) { if (exists $eds{EDSNo}) { # Error if we go through this loop more than one time. EXDutilities->TakeExit("\nERROR: $MODULE->GetEDSDetails: Multiple EDS records exist ". "with EDSNo = $eds{EDSNo}.\n"); } for ($i=0;$i<@data;++$i) { $colname = $dbh->dbcolname($i+1); $eds{$colname} = $data[$i]; } } } else { EXDutilities->TakeExit("\nERROR: $MODULE->GetEDSDetails: Return code from DBROWS = $status\n"); } } sub GetMeasureCount { my $dbh=$_[0]; my $edsno = $_[1]; my $sqlcmd; my @data; my $status; my $measure_count; $sqlcmd = "select count(*) from Measure where EDSNo = $edsno and IsDeletedInd = 0 "; $status = $dbh->dbcmd($sqlcmd); if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetMeasureCount: Return code from dbcmd = $status\n"); } $status = $dbh->dbsqlexec; if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetMeasureCount: Return code from dbsqlexec = $status\n"); } $status = $dbh->dbresults; if ($status != $SUCCEED) { EXDutilities->TakeExit("\nERROR: $MODULE->GetMeasureCount: Return code from dbresults = $status\n"); } $status = $dbh->DBROWS; if ($status == $SUCCEED) { @data = $dbh->dbnextrow; $measure_count = $data[0]; } else { EXDutilities->TakeExit("\nERROR: $MODULE->GetMeasureCount: Return code from DBROWS = $status\n"); } if ($measure_count == "") { $measure_count = 0; } return $measure_count; }