-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added extraction page (to search page, because idk)+ modified search_…
…page.php without case-sensitive search + modified Izem Links
- Loading branch information
Showing
5 changed files
with
208 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?php | ||
session_start(); | ||
if (!isset($_SESSION['Email'])) { | ||
header("Location: LoginPage.php"); | ||
} | ||
?> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title> Search </title> | ||
<link rel="stylesheet" type="text/css" href="website.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
<!--CSS for log out button--> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>CALI</h1> | ||
</header> | ||
<div class="topnav"> | ||
<?php require_once 'libphp/Menu.php'; | ||
echo Menu($_SESSION['Status'], "search_page.php") ?> | ||
</div> | ||
|
||
<div class="center"> | ||
<h2>Extract data</h2> | ||
<div class="container"> | ||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> | ||
<?php include_once "Extract_data.php"; ?> | ||
<form> | ||
</div> | ||
</div> | ||
<div class="center"> | ||
<h2> Search </h2> | ||
<div class="container"> | ||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> | ||
<label for="species_name"><b>Species name</b> </label> | ||
<input type="text" name="species_name" id="species_name" placeholder="Species name"><br> | ||
|
||
<label for="strain_name"><b>Strain name</b></label> | ||
<input type="text" name="strain_name" id="strain_name" placeholder="Strain name"><br> | ||
|
||
<label for="genetic_support"><b>Genetic support (chromosome or name of plasmid typically)</b></label> | ||
<input type="text" name="genetic_support" id="genetic_support" placeholder="Genetic support"><br> | ||
|
||
<label for="chr_ID"><b>Chromosome ID</b></label> | ||
<input type="text" id="chr_ID" name="id_genome" placeholder="Chromosome ID"><br> | ||
|
||
<label for="seq_genome"><b>Genome sequence</b></label> | ||
<input type="text" name="genome_seq" id="seq_genome" placeholder="Genome sequence"><br> | ||
|
||
<label for="gene_id"><b>Gene ID</b></label> | ||
<input type="text" id="gene_id" name="gene_id" placeholder="Gene ID"><br> | ||
|
||
<label for="gene_symbol"><b>Gene symbol</b></label> | ||
<input type="text" name="gene_symbol" id="gene_symbol" placeholder="Gene symbol"><br> | ||
|
||
<label for="sequence_nt"><b>Nucleotide sequence or pattern (3 to 950 characters)</b></label> | ||
<input type="text" id="sequence_nt" name="sequence_nt" placeholder="Nucleotide pattern" minlength="3" | ||
maxlength="950"><br> | ||
|
||
<label for="prot_id"><b>Protein ID</b> </label> | ||
<input type="text" id="prot_id" name="id_transcript" placeholder="Protein ID"><br> | ||
|
||
<label for="description"><b>Function</b></label> | ||
<input type="text" id="description" name="description" placeholder="Function"><br> | ||
|
||
<label for="prot_seq"><b>Protein sequence or pattern (3 to 320 characters)</b></label> | ||
<input type="text" id="prot_seq" name="prot_seq" placeholder="Protein pattern" minlength="3" | ||
maxlength="320"><br><br> | ||
|
||
<label for="result_type"><b>Select type of results</b></label> | ||
<select name="result_type" id="result_type"> | ||
<option value="gene_prot"> Gene / Protein</option> | ||
<option value="Genome"> Genome</option> | ||
</select><br><br> | ||
<button class="big_submit_button" name="submit" type="submit" value="Submit"> Submit</button> | ||
</form> | ||
<?php | ||
|
||
include_once 'libphp/db_utils.php'; | ||
connect_db(); | ||
if (isset($_POST["submit"])) { | ||
|
||
$info_formulaire = ["species_name", "strain_name", "genetic_support", "id_genome", "sequence_nt", "id_transcript", "prot_seq", "gene_id", "gene_symbol", "description"]; | ||
$col_table = ["genome.species", "genome.strain", "transcript.genetic_support", "genome.id_genome", | ||
"transcript.sequence_nt", "transcript.id_transcript", "transcript.sequence_p", "annotate.id_gene", "annotate.symbol", "annotate.description"]; | ||
|
||
if ($_POST["result_type"] == "gene_prot") { // Si on veut en résultat des genes ou des proteines | ||
$query_sql = "SELECT distinct(annotate.id_transcript) FROM website.genome,website.transcript, website.annotate WHERE genome.id_genome = transcript.id_genome AND annotate.id_transcript = transcript.id_transcript and validated=1"; | ||
} else if ($_POST["result_type"] == "Genome") { // Si on veut en résultat des génomes | ||
$query_sql = "SELECT distinct(genome.id_genome) FROM website.genome,website.transcript, website.annotate WHERE genome.id_genome = transcript.id_genome AND annotate.id_transcript = transcript.id_transcript and validated=1"; | ||
} | ||
|
||
for ($i = 0; $i <= count($info_formulaire) - 1; $i++) { //Pour chaque champ du formulaire | ||
$ch = $info_formulaire[$i]; // $ch = ensemble des ID du formulaire | ||
$col = $col_table[$i]; // $col = ensemble des attributs des tables SQL | ||
if (!empty($_POST[$ch])) { //Si le champ est rempli | ||
if (isset($query_sql)) { | ||
if (($ch == "sequence_nt") || ($ch == "sequence_p")) { // Si on recherche des motifs (nucleotidique ou proteique), on utilise un " LIKE % " | ||
$query_sql .= "AND " . $col . " LIKE '%" . $_POST[$ch] . "%' "; | ||
} else if (($ch == "id_genome") || ($ch == "id_transcript")) {// Si ce sont des clés primaires, on utilise " = " de façon casse sensible | ||
$query_sql .= "AND " . $col . "='" . $_POST[$ch] . "'"; | ||
} else { //Sinon on utilise "=" en mettant tout en minuscule | ||
$query_sql .= "AND lower(" . $col . ")=lower('" . $_POST[$ch] . "')"; | ||
} | ||
} | ||
} | ||
} | ||
$res = pg_query($db_conn, $query_sql) or die(pg_last_error()); | ||
if (pg_num_rows($res) == 0) { | ||
echo "No results"; | ||
} else { | ||
/*Liens vers fiches*/ | ||
echo "<table>"; | ||
while ($line = pg_fetch_assoc($res)) { | ||
echo "\t<tr>\n"; | ||
foreach ($line as $col_value) { | ||
if ($_POST["result_type"] == "gene_prot") { | ||
echo "\t\t<td> <a href = 'Gene-ProtPage.php?id=$col_value' target='_blank'> $col_value </a></td>\n"; | ||
} else if ($_POST["result_type"] == "Genome") { | ||
echo "\t\t<td> <a href = 'GenomePage.php?id=$col_value' target='_blank'> $col_value </a></td>\n"; | ||
} | ||
} | ||
echo "\t</tr>\n"; | ||
} | ||
echo "</table>\n"; | ||
} | ||
|
||
|
||
// Libère le résultat | ||
pg_free_result($res); | ||
} | ||
|
||
|
||
?> | ||
</div> | ||
</div> | ||
<footer> | ||
<a href="Contact.php">Contact</a><br> | ||
<p>© CALI 2021</p> | ||
</footer> | ||
</body> | ||
</html> |