Skip to content
Snippets Groups Projects
Commit 242ddc32 authored by Hernandez-Courbevoie Yohan's avatar Hernandez-Courbevoie Yohan
Browse files

Add "retrieve results" tab

Add a tab to search results of passed analysis by their run ID.
Scripts are made from scratch, maybe functions already existing can do
this job instead.
parent 689d3c00
Branches
No related tags found
No related merge requests found
stages:
- build
build-job:
stage: build
script:
- echo "passed"
tags:
- bws
# stages:
# - build
# - test
......
......@@ -13,17 +13,17 @@ DATA_PAMPA_DIR = os.path.join(HTML_PATH, "data_pampa/")
# TODO /!\ Remplacer les tables de peptides des Birds Fishes et Reptiles par les vraies tables
# La table des mammifères sert à combler le manque de données en attendant.
PEPTIDES_MAMMALS_FILE = DATA_PAMPA_DIR + "table_mammals_with_deamidation.tsv"
PEPTIDES_BIRDS_FILE = DATA_PAMPA_DIR + "table_mammals_with_deamidation.tsv"
PEPTIDES_FISHES_FILE = DATA_PAMPA_DIR + "table_mammals_with_deamidation.tsv"
PEPTIDES_REPTILES_FILE = DATA_PAMPA_DIR + "table_mammals_with_deamidation.tsv"
PEPTIDES_BIRDS_FILE = DATA_PAMPA_DIR + ".tsv"
PEPTIDES_FISHES_FILE = DATA_PAMPA_DIR + ".tsv"
PEPTIDES_REPTILES_FILE = DATA_PAMPA_DIR + ".tsv"
TAXONOMY_ALL_FILE = DATA_PAMPA_DIR + "taxonomy_all.tsv"
TAXONOMY_REDUCED_FILE = DATA_PAMPA_DIR + "taxonomy_reduced.tsv"
SPECTRA_EXAMPLE_1 = DATA_PAMPA_DIR + "example_1.zip"
#Renvoie le pwd pour le dossier tmp/
def tmp_dir(run_id):
tmpdir = os.path.join(TEMP_DIR, run_id)
......
......@@ -174,6 +174,7 @@ def write_details_page(spectrum_name, run_id, job_name=None):
# Insert HTML header and page head
html += (open(f"{common.HTML_PATH}/header.php", "r").read())
html += '<script> console.log(performance.navigation.type) </script>'
html += '<div class="frametitle"><h1 id="title">Pampa</h1></div><div id="center_sup"><div class="theme-border" style="display:none;"></div><div id="link_home" style="display:inline-block"><a href="/" class="text_onglet"><img src="/Style/icon/home_w.png" alt="home_general"/></a></div><div class="tabs" id="menu_central" style="display:inline-block">'
html += open(f"{common.HTML_PATH}/menu_central.txt", 'r').read()
html += '</div></div><div id="main"><div id="center">'
......@@ -352,6 +353,8 @@ def write_details_page(spectrum_name, run_id, job_name=None):
html += ('<br>')
html += ('<br>')
html += ('</div>')
html += '<script> console.log("details loaded")</script>'
html += '<script> if (performance.navigation.type == 2 || performance.navigation.type == 0) {location.reload(true);}</script>'
# Insert page footer
html += '</div></div></body>'
......
......@@ -147,6 +147,12 @@ def write_main_page(run_id, taxo_used, job_name=None):
html += (results_output(run_id, job_name=job_name))
html += ('<br>')
# Come back later
html += '<h3>You want to come back later ?</h3>'
html += '<p>Your result stay available for at least one month.</p>'
html += f'<p>To access it, you can either save the url or <a id="copy" data-copy="{run_id}">copy</a> the ID {run_id}.</p>'
html += ('<br>')
# Insert page footer
html += '</div></div></body>'
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Modules import
import cgitb; cgitb.enable()
import os
import cgi
import common
import sys
import json
from html_utils import *
from render_sub_assignment import *
# Functions definition
def extract_request(form):
error = 0
error_messages = []
url_result = ""
if "run_id" in form:
run_id = form["run_id"].value
else:
error = 1
error_messages.append("The script need the parameter 'run_id'.")
run_id = ""
if error == 0:
if os.path.exists(f'{common.RESULT_DIR}{run_id}/results.php'):
url_result = f'result/{run_id}/results.php'
else:
url_result = 'fail_retrieve.php'
return error, error_messages, url_result, run_id
# Main
def main():
form = cgi.FieldStorage()
error, error_messages, url_result, run_id = extract_request(form)
sys.stdout.write("Content-Type: application/json")
sys.stdout.write("\n")
sys.stdout.write("\n")
result={}
if error == 0:
result['success'] = True
result['url_result'] = url_result
result['comment'] = f'{common.RESULT_DIR}{run_id}/result.php'
else:
result['success'] = False
result['error_messages'] = error_messages
sys.stdout.write(json.dumps(result, indent=1))
sys.stdout.write("\n")
main()
<?php include('header.php') ?>
<body>
<div class="frametitle">
<h1 id="title">Pampa</h1>
</div>
<div id="center_sup">
<div class="theme-border" style="display:none"></div>
<div id="link_home" style="display:inline-block"><a href="/" class="text_onglet"><img src="/Style/icon/home_w.png" alt="home_general"/></a></div>
<div class="tabs" id="menu_central" style="display:inline-block"><?php include("menu_central.txt")?></div>
</div>
<div id="main">
<div id="center">
<h2>Query failed</h2>
<p>Unfortunately, your request was not successful. No results were found for this ID.</p>
<p>The ID may have been incorrectly copied, or the results may have been deleted from our system.</p>
<br>
<a href="/pampa/result.php" class="aLoad" >Back to search</a>
</div><!-- center -->
</div><!-- main-->
<!-- appel du fichier lib.inc contenant des fonctions php -->
<?php require("../lib.inc")?>
<!-- appel de la fonction footer qui permet d'afficher au bas de la page (nom du logiciel, un lien vers le mail, la date de modif -->
<!-- Modifier le nom Example_web_server par le nom de votre logiciel -->
<?php footer("Pampa","Pampa", "areski.flissi@univ-lille.fr","2024"); ?>
</div>
</body>
</html>
......@@ -14,7 +14,7 @@
<!--modifier le nom du dossier ci dessous -->
<script type="text/javascript" src="/pampa/js/script.js"></script>
<script type="text/javascript" src="/pampa/js/pampa.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.4.1.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"></script>
<script type="text/javascript">Bokeh.set_log_level("info");</script>
<title>Bonsai :: Bioinformatics Software Server</title>
<script type="text/javascript">
......
......@@ -47,6 +47,36 @@ $(document).on("click", ".link_img", function() {
});
});
document.addEventListener('DOMContentLoaded', function() {
if (window.location.pathname.includes("details_")) {
if (performance.navigation.type == 2 || performance.navigation.type == 0) {
location.reload(true);
}
}
});
$(document).on("click", "#search", function(){
var formData = new FormData(document.querySelector("#retrieve"));
$.ajax({
url: "/cgi-bin/pampa/retrieve_results.py",
type: "POST",
data: formData,
dataType: "json",
contentType: false,
cache: false,
processData:false,
success: function(response){
setTimeout(function() {
url_result = response.url_result;
$('#main').load(url_result+" #center");
}, 200);
},
error: function(request, status, error){
$("#main").html(request.responseText);
}
});
});
$(document).on("click", "#add_organism", function() {
var $rows = $("#table_organism");
var i = $("#table_organism tr:last-child input").data("i") + 1;
......@@ -84,3 +114,9 @@ $(document).on("click", "#back_to_normal", function() {
function open_taxo_tree(name) {
window.open(name, 'Taxonomy', 'menubar=no, scrollbars=no, location=no, titlebar=no, status=no, width=800, height=800');
}
$(document).on("click", "a#copy", function () {
var copyText = $(this).data("copy");
navigator.clipboard.writeText(copyText);
alert("Copied the ID: " + copyText);
});
\ No newline at end of file
......@@ -4,6 +4,9 @@
</li>
<li class="onglet">
<a href="/pampa/form.php" class="mc aLoad" >Pampa web</a>
</li>
<li class="onglet">
<a href="/pampa/result.php" class="mc aLoad" >Results</a>
</li>
<li class="onglet onglet_right">
<a href="/pampa/help.php" class="mc aLoad" >Help</a>
......
<?php include('header.php') ?>
<body>
<div class="frametitle">
<h1 id="title">Pampa</h1>
</div>
<div id="center_sup">
<div class="theme-border" style="display:none"></div>
<div id="link_home" style="display:inline-block"><a href="/" class="text_onglet"><img src="/Style/icon/home_w.png" alt="home_general"/></a></div>
<div class="tabs" id="menu_central" style="display:inline-block"><?php include("menu_central.txt")?></div>
</div>
<div id="main">
<div id="center">
<br>
<!--Partie à modifier-->
<!--h2>Understand the results</h2>
<p>
The results are composed of 3 files.
</p>
<p>
More details in the <a>help</a> section.
</p-->
<h2>Retrieve analysis results</h2>
<p>Results are saved for a minimum of one month.</p>
<p>They can be accessed directly via their link if it have been saved. Otherwise, you can enter your run ID in the field below.</p>
<form id="retrieve" method="post" enctype="multipart/form-data">
<table class="vide pampa-choice">
<tr>
<td>
<input type="text" name="run_id" maxlength="26" style="width: 300px;"/>
</td>
<td>
<input type="button" id="search" name="button" value="Search"/>
</td>
</tr>
</table>
</form>
</div><!-- center -->
</div><!-- main-->
<!-- appel du fichier lib.inc contenant des fonctions php -->
<?php require("../lib.inc")?>
<!-- appel de la fonction footer qui permet d'afficher au bas de la page (nom du logiciel, un lien vers le mail, la date de modif -->
<!-- Modifier le nom Example_web_server par le nom de votre logiciel -->
<?php footer("Pampa","Pampa", "areski.flissi@univ-lille.fr","2024"); ?>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment