fix bp selenium test and brapi add program
[sgn.git] / cgi-bin / content / library_info.pl
blobfda810ef4a3f1721ed59afc967cd80acbdce0f2b
1 use CXGN::Page;
3 use strict;
4 use CXGN::DB::Connection;
6 library_info_main();
8 sub library_info_main {
10 our $page = CXGN::Page->new( "SGN Library Info", "Lukas");
12 my ($library) = $page -> get_arguments("library");
13 my $db = CXGN::DB::Connection->new();
15 my $query = "SELECT organism.organism_name, types.comment as type, library_name, library_shortname, development_stage, treatment_conditions, tissue, cultivar, accession,cloning_host, comments, authors, contact_information, cloning_kit, rs1, rs2, library.library_id
16 FROM library, organism, types
17 WHERE library.organism_id=organism.organism_id and library.type=types.type_id and library_shortname=?";
18 my $sth = $db -> prepare($query);
19 $sth -> execute($library);
21 my $libraries ="";
22 my $lib =$sth-> fetchrow_hashref();
26 if (!exists($$lib{library_shortname})) {
28 $page -> header();
30 my $temp_value = "<h4>Library Detail Page</h4> Library \n";
32 if ($library) {
33 $temp_value = $temp_value."\"<b>$library</b>\" \n";
36 $temp_value = $temp_value."unknown. Sorry! Please try again.<br /><br /><br /><br /><br />\n";
38 print $temp_value;
40 $page -> footer();
41 return;
44 my $query2 = "SELECT count(*) from clone, seqread, est WHERE clone.clone_id=seqread.clone_id and seqread.read_id=est.read_id and clone.library_id=? and est.status=0 and est.flags=0";
46 my $sth2 = $db->prepare($query2);
47 $sth2->execute($lib->{library_id});
48 my ($seq_count) = $sth2->fetchrow_array();
50 my $query3 = "SELECT count(*) from clone WHERE clone.library_id=?";
51 my $sth3 = $db -> prepare($query3);
52 $sth3 -> execute($lib->{library_id});
53 my ($clone_count) = $sth3 -> fetchrow_array();
55 my $query4 = "SELECT avg(hqi_length), stddev(hqi_length) FROM clone, seqread, est, qc_report where clone.library_id=? and clone.clone_id=seqread.clone_id and seqread.read_id=est.read_id and est.est_id=qc_report.est_id and est.flags=0 and est.status=0 group by clone.library_id";
56 my $sth4 = $db -> prepare($query4);
57 $sth4 -> execute($lib->{library_id});
58 my ($average_seqlen, $std_dev) = $sth4 -> fetchrow_array();
59 $average_seqlen = sprintf "%4.1f", $average_seqlen;
60 $std_dev = sprintf "%4.1f", $std_dev;
62 $page -> header();
64 print <<HTML;
66 <h4>Library Detail Page for $library</h4>
67 <table>
68 <tr><td width="180">Short Name:</td><td>$$lib{library_shortname}</td></tr>
69 <tr><td>Organism:</td><td>$$lib{organism_name}</td></tr>
70 <tr><td>Library Name: </td><td>$$lib{library_name}</td></tr>
71 <tr><td>Total Sequences: </td><td>$seq_count sequences from $clone_count clones</td></tr>
72 <tr><td>Average Sequence Length:</td><td>$average_seqlen (Standard deviation $std_dev)</td></tr>
73 <tr><td>Type:</td><td>$$lib{type}</td></tr>
74 <tr><td>Tissue:</td><td>$$lib{tissue}</td></tr>
75 <tr><td>Development Stage:</td><td>$$lib{development_stage}</td></tr>
76 <tr><td valign="top">Treatment Conditions:</td><td>$$lib{treatment_conditions}</td></tr>
77 <tr><td>Cloning Host:</td><td>$$lib{cloning_host}</td></tr>
78 <tr><td>Cloning Kit: </td><td>$$lib{cloning_kit}</td></tr>
79 <tr><td valign="top">Comments</td><td>$$lib{comments}</td></tr>
80 <tr><td valign="top">Authors</td><td>$$lib{authors}</td></tr>
81 <tr><td valign="top">Contact Information</td><td>$$lib{contact_information}</td></tr>
82 </table>
83 <br /><br /><br /><br /><br />
85 HTML
87 $page -> footer();