-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.html
211 lines (197 loc) · 8.82 KB
/
search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
% if ($short or $accession or $query or $hgnc_name) {
<%perl>
my $query_statement;
my $entries;
my $question = '';
my $species;
if ($short or $accession or $hgnc_name) {
if ($accession) {
$species = $db->MySelect(statement => "SELECT species FROM gene_info WHERE accession = ?", type => 'single', vars => [$accession]);
$query_statement = qq"SELECT * FROM genome WHERE accession = ?";
$question = $accession;
} elsif ($hgnc_name) {
$hgnc_name =~ s/^\s+//g;
$query_statement = qq"SELECT * FROM gene_info WHERE hgnc_name = ?";
$question = $hgnc_name;
}
} else {
$query_statement = qq"SELECT * FROM gene_info WHERE ";
if ($search_species_limit ne 'all') {
$query_statement .= qq"species = '$search_species_limit' AND ";
}
my $mode = undef;
if (defined($mode)) { ## SOME SNP STUFF
$query_statement .= qq"";
} else {
$query_statement .= qq"match(comment) against(? in boolean mode)";
$question = $query;
}
}
$entries = $db->MySelect(statement => $query_statement, type => 'hash', descriptor => 1, vars => [$question]);
my @entries_keys = ();
my $entries_count = 0;
foreach my $c (keys %{$entries}) {
push(@entries_keys, $c);
$entries_count++;
$species = $db->MySelect(statement => "SELECT species FROM gene_info WHERE accession = ?", type => 'single', vars => [$entries->{$c}->{accession}]);
my $mt = "mfe_$species";
$mt = 'mfe_virus' if ($mt =~ /virus/);
my $slip_stmt = qq"SELECT count(distinct(start)), count(distinct(id)) FROM $mt WHERE accession = ?";
my $slipsite_structure_count = $db->MySelect(statement => $slip_stmt, vars => [$entries->{$c}->{accession}], type => 'row',);
$entries->{$c}->{slipsite_count} = $slipsite_structure_count->[0];
$entries->{$c}->{structure_count} = $slipsite_structure_count->[1];
} ## End foreach
</%perl>
% if ($entries_count == 0) {
% my $term = '';
% if ($query) {
% $term .= $query;
% } if ($accession) {
% $term .= $accession;
% } if ($short) {
% $term .= $short;
% } if ($hgnc_name) {
% $term .= $hgnc_name;
% }
<p>No entry was found for the search term: '<% $term %>'.</p><br>
% } elsif ($entries_count == 1) {
% my $long_species = HTMLMisc::Make_Species($species);
% my $genename = $entries->{$entries_keys[0]}->{genename};
% my $accession = $entries->{$entries_keys[0]}->{accession};
% my $comment = $entries->{$entries_keys[0]}->{comment};
% my $omim_id = $entries->{$entries_keys[0]}->{omim_id};
% my $orf_start = $entries->{$entries_keys[0]}->{orf_start};
% my $orf_stop = $entries->{$entries_keys[0]}->{orf_stop};
<& gene_summary.html, accession => $accession, genename => $genename, accession => $accession, long_species => $long_species, species => $species, comment => $comment, omim_id => $omim_id, hgnc_name => $hgnc_name &>
<& list_slipsites.html, accession => $accession, species => $species, comment => $comment, omim_id => $omim_id, orf_start => $orf_start, orf_stop => $orf_stop &>
<& print_gene.html, accession => $accession, translate => $translate &>
% } else { ### If there is not 0 nor 1 hit, then there are multiple.
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.tablesorter.js"></script>
<script type="text/javascript" id="tablesearch">
$(document).ready(function()
{
$("#search")
.tablesorter({widthFixed: true, widgets: ['zebra'],})
$("#search").bind("sortStart",function() {
$("#overlay").show();
}).bind("sortEnd",function() {
$("#overlay").hide();
});
$("#search").tablesorter({widthFixed: true, widgets: ['zebra'],})
})
</script>
<table id="search" class="tablesorter">
<thead>
<tr>
<th></th>
<th width="35%" nowrap><div align="left"><strong><font color="#FFFFFF">Gene Name</font></strong></div></th>
<th nowrap width="10%"><div align="left"><strong><font color="#FFFFFF">Accession</font></strong></div></th>
<th nowrap width="15%"><div align="left"><strong><font color="#FFFFFF">Species</font></strong></div></th>
<th nowrap width="5%"><div align="center"><strong><font color="#FFFFFF">#Slips</font></strong></div></th>
<th nowrap width="35%"><div align="left"><strong><font color="#FFFFFF">Comments</font></strong></div></th>
</tr>
</thead>
<tbody>
% foreach my $entry (sort keys %{$entries}) {
% my $species = $entries->{$entry}->{species};
% my $long_species = HTMLMisc::Make_Species($species);
% $entries->{$entry}->{long_species} = $long_species;
% my $mt = "mfe_$species";
% $mt = 'mfe_virus' if ($mt =~ /virus/);
% my $slip_stmt = qq"SELECT count(distinct(start)), count(distinct(id)) FROM $mt WHERE accession = ?";
% my $slipsite_structure_count = $db->MySelect(statement => $slip_stmt, vars => [$entries->{$entry}->{accession}], type => 'row');
% $entries->{$entry}->{slipsite_count} = $slipsite_structure_count->[0];
% } ## End foreach my $entry
% foreach my $id (sort { $entries->{$b}->{slipsite_count} <=> $entries->{$a}->{slipsite_count} } keys %{$entries}) {
% my $hgnc_name = $entries->{$id}->{hgnc_name};
% my $genename = $entries->{$id}->{genename};
% my $accession = $entries->{$id}->{accession};
% my $species = $entries->{$id}->{species};
% my $comment = $entries->{$id}->{comment};
% my $omim_id = $entries->{$id}->{omim_id};
% my $slipsite_count = $entries->{$id}->{slipsite_count};
<tr>
<td valign="top"><a href="/search.html?short=1&accession=<% $accession %>&species=<% $species %>" rel="external" target="_blank"><img src="/html/external.png" border="0"></a></td>
<td><div align="left"><a href="/search.html?short=1&accession=<% $accession %>&species=<% $species %>" rel="external" target="_blank"><% $genename %></a><& link_out.html, accession => $accession &></td>
<td valign="top" width="10%"><div align="left"><a href="/search.html?short=1&accession=<% $accession %>&species=<% $species %>" rel="external" target="_blank"><strong><% $accession %></strong></a></div></td>
<td valign="top" width="15%"><div align="left"><i><% HTMLMisc::Make_Species($species) %></i></div></td>
<td valign="top" width="5%"><div align="center"><strong><% $slipsite_count %></strong></div></td>
<td valign="top" width="35%"><div align="left"><% $comment %></div></td>
</tr>
% } ## End foreach entry in entries
</tbody>
</table>
<style>
#overlay {
top: 100px;
left: 50%;
position: absolute;
margin-left: -100px;
width: 200px;
text-align: center;
display: none;
margin-top: -10px;
background: #000;
color: #FFF;
}
</style>
<div id="overlay">
Please wait...
</div>
<!-----
<div id="pager">
<form>
<img src="/images/first.gif" class="first"/>
<img src="/images/previous.gif" class="prev"/>
<input type="text" class="pagedisplay"/>
<img src="/images/next.gif" class="next"/>
<img src="/images/last.gif" class="last"/>
<select class="pagesize">
<option selected="selected" value="10">10</option>
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</form>
</div>
------------->
% } ## End the else there are multiple hits
% } else { ## If you haven't filled out any of the form, then provide it.
<FORM action="search.html" enctype="multipart/form-data" method="POST">
<center>
To begin browsing the PRFdb, please enter your search terms below.<br>
<input type="text" name="query" size="20">
<& species_selector.html, select_name => "search_species_limit" &>
<br>
Or choose a particular accession: <input type="text" name="accession" size="20"><br>
Or an <a href="http://www.genenames.org/" title="Example HGNC gene names may be found here." rel="external" target="_blank">HGNC</a> gene name (in humans only): <input type="text" name="hgnc_name" size="10"><br>
<input type="submit" name="search submit" value="Search"><a href="help/search_suggestions.html" title="Try 'RPL'.">Searching Suggestions</a></form>
</center>
The sequences of the PRFdb come from the yeast genome project and the NCBI nucleotide database.<br>
They are available here: <a href="http://yeastgenome.org" title="at the yeast genome project." rel="external" target="_blank">Yeast Genome</a><br>
and: <a href="http://ncbi.nih.nlm.gov/nucleotide" title="at the NCBI nucleotide database." rel="external" target="_blank">NCBI</a>.
<hr>
<form method="post" action="search_blast.html" enctype="application/x-www-form-urlencoded">
Search the <select name="location">
<option value="local">PRFdb</option>
<option value="remote">NCBI</option>
</select> for an arbitrary sequence using <select name="blast_type">
<option value="blastn">nucleotide</option>
<option value="tblastn">protein</option>
</select> BLAST.<br>
<textarea name="search_string" rows=12 cols=100 wrap="physical"></textarea>
<br>
<input type="submit" name="blastsearch" value="Perform Blast Search"></form></tr>
% }
<%init>
</%init>
<%args>
$short => 0
$accession => undef
$hgnc_name => undef
$query => undef
$search_species_limit => 'all'
$blastsearch => undef
$translate => undef
</%args>