diff --git a/jass/__main__.py b/jass/__main__.py index 78f40102ef431e7e8fcc862e9a3022ce32f1ac59..743b290525e685bba88ef410b2283158cebfc795 100644 --- a/jass/__main__.py +++ b/jass/__main__.py @@ -32,32 +32,32 @@ def absolute_path_of_the_file(fileName, output_file = False): if (Directory_path_exist == False): # Test the path using the Jass data directory absoluteFilePath = os.path.normpath(os.path.join(config["DATA_DIR"], fileName)) - + Directory_path_exist = os.path.exists(os.path.dirname(absoluteFilePath)) - + if (Directory_path_exist == False): Message = "The directory of the file {} does not exist".format(fileName) raise NameError(Message) else: # Test if the file path exist File_path_exist = os.path.exists(absoluteFilePath) - + if (File_path_exist == False): # Test the path using the Jass data directory absoluteFilePath = os.path.normpath(os.path.join(config["DATA_DIR"], fileName)) File_path_exist = os.path.exists(absoluteFilePath) - + if (File_path_exist == False): Message = "The file {} does not exist".format(fileName) raise NameError(Message) - + # Test if it is realy a file Is_a_file = os.path.isfile(absoluteFilePath) - + if (not Is_a_file) : Message = "{} is not a file".format(fileName) raise NameError(Message) - + return absoluteFilePath @@ -72,17 +72,17 @@ def w_list_phenotypes(args): def compute_worktable(args): - + csv_file_path = args.csv_file_path if (csv_file_path is not None): csv_file_path = absolute_path_of_the_file(csv_file_path, True) init_table_path = absolute_path_of_the_file(args.init_table_path) worktable_path = absolute_path_of_the_file(args.worktable_path, True) selected_phenotypes = args.phenotypes - remove_nan = not (args.keep_nans) + remove_nan = (args.remove_nans) significance_treshold = float(args.significance_treshold) post_filtering = bool(args.post_filtering) - custom_loadings = args.custom_loadings + custom_loadings = args.custom_loadings chromosome = args.chromosome_number pos_Start = args.start_position pos_End = args.end_position @@ -99,10 +99,10 @@ def compute_worktable(args): strategy = args.strategy create_worktable_file( - phenotype_ids = selected_phenotypes, - init_file_path = init_table_path, + phenotype_ids = selected_phenotypes, + init_file_path = init_table_path, project_hdf_path = worktable_path, - remove_nan = remove_nan, + remove_nan = remove_nan, stat = strategy, optim_na = True, csv_file = csv_file_path, @@ -125,8 +125,8 @@ def w_create_project_data(args): manhattan_plot_path = absolute_path_of_the_file(args.manhattan_plot_path, True) quadrant_plot_path = absolute_path_of_the_file(args.quadrant_plot_path, True) create_global_plot(worktable_path, manhattan_plot_path) - create_quadrant_plot(worktable_path, - quadrant_plot_path, + create_quadrant_plot(worktable_path, + quadrant_plot_path, significance_treshold = float(args.significance_treshold)) @@ -136,7 +136,7 @@ def w_create_inittable(args): regions_map_path = absolute_path_of_the_file(args.regions_map_path) description_file_path = absolute_path_of_the_file(args.description_file_path) init_table_path = absolute_path_of_the_file(args.init_table_path, True) - + create_inittable_file( input_data_path, regions_map_path, @@ -155,8 +155,8 @@ def w_plot_quadrant(args): worktable_path = absolute_path_of_the_file(args.worktable_path) plot_path = absolute_path_of_the_file(args.plot_path) significance_treshold = float(args.significance_treshold) - create_quadrant_plot(worktable_path, - plot_path, + create_quadrant_plot(worktable_path, + plot_path, significance_treshold=significance_treshold) @@ -197,7 +197,7 @@ def get_parser(): parser_create_pd.add_argument( "--worktable-path", required=True, help="path to the worktable file to generate" ) - parser_create_pd.add_argument("--keep-nans", action="store_true", default=False) + parser_create_pd.add_argument("--remove-nans", action="store_true", default=False) parser_create_pd.add_argument( "--manhattan-plot-path", required=True, @@ -237,7 +237,7 @@ def get_parser(): required=False, help="path to the results file in csv format" ) - + parser_create_pd.add_argument( "--chromosome-number", required=False, @@ -255,7 +255,7 @@ def get_parser(): required=False, help="option used only for local analysis: end position of the region studied" ) - + strategies = parser_create_pd.add_mutually_exclusive_group() strategies.add_argument("--omnibus", action="store_true", default=True) strategies.add_argument("--sumz", action="store_true", default=False) @@ -336,15 +336,15 @@ def get_parser(): required=False, help="path to the results file in csv format" ) - + parser_create_wt.add_argument( "--chunk-size", required=False, default=50, help="Number of region to load in memory at once", ) - - parser_create_wt.add_argument("--keep-nans", action="store_true", default=False) + + parser_create_wt.add_argument("--remove-nans", action="store_true", default=False) parser_create_wt.add_argument( "--chromosome-number", @@ -363,14 +363,14 @@ def get_parser(): required=False, help="option used only for local analysis: end position of the region studied" ) - + strategies = parser_create_wt.add_mutually_exclusive_group() strategies.add_argument("--omnibus", action="store_true", default=True) strategies.add_argument("--sumz", action="store_true", default=False) strategies.add_argument("--fisher_test", action="store_true", default=False) strategies.add_argument("--meta_analysis", action="store_true", default=False) strategies.add_argument("--strategy") - + parser_create_wt.set_defaults(func=w_create_worktable) # ------- plot-manhattan ------- @@ -385,8 +385,8 @@ def get_parser(): help="path to the worktable file containing the data", ) parser_create_mp.add_argument( - "--plot-path", - required=True, + "--plot-path", + required=True, help="path to the manhattan plot file to generate" ) parser_create_mp.set_defaults(func=w_plot_manhattan) @@ -402,8 +402,8 @@ def get_parser(): help="path to the worktable file containing the data", ) parser_create_mp.add_argument( - "--plot-path", - required=True, + "--plot-path", + required=True, help="path to the quadrant plot file to generate" ) parser_create_mp.add_argument( @@ -412,7 +412,7 @@ def get_parser(): help="threshold at which a p-value is considered significant" ) parser_create_mp.set_defaults(func=w_plot_quadrant) - + return parser diff --git a/jass/static/chromo_heatmap_manhattan.html b/jass/static/chromo_heatmap_manhattan.html index a21806c484ab3f76d33304263cb4f4ed04678e04..dbaceaa54e1bfc1dff96f19f0d8fe2633dc6a631 100644 --- a/jass/static/chromo_heatmap_manhattan.html +++ b/jass/static/chromo_heatmap_manhattan.html @@ -28,12 +28,9 @@ <!-- Plotly.js --> - <script src="js/plotly-latest.min.js"></script> <!--https://cdn.plot.ly/plotly-latest.min.js--> - <!--<script src="js/jquery.min.js"></script> http://ajax.googleapis.com/ajax/libs/ - - jquery/1.8.1/jquery.min.js--> + <script src="js/plotly-latest.min.js"></script> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> - <script src="js/jquery-ui.js"></script> <!--https://code.jquery.com/ui/1.12.1/jquery-ui.js--> + <script src="js/jquery-ui.js"></script> <script src="js/snap.svg-min.js"></script> <script src="js/Chromosome.js"></script> @@ -49,7 +46,6 @@ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" ></script> - <!--<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>--> <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script> <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.3.0/js/dataTables.select.min.js"></script> @@ -63,10 +59,6 @@ <script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css"> <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script> - - <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript"></script> - - <!--<script defer language="javascript" src="js/create_genome_full_csv.js" type="text/javascript"> </script>--> <style> diff --git a/jass/static/directLink.html b/jass/static/directLink.html index cb711926e697bf5657ba78376b4a9fd86534eeb3..bad989df75dfc7f8ca6cfcc305296ba306d52d74 100644 --- a/jass/static/directLink.html +++ b/jass/static/directLink.html @@ -1,93 +1,156 @@ -<html> - - <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> -<script src="http://malsup.github.io/jquery.blockUI.js"></script> -<script> -function directLink() { - //var phe = ["z_DIAGRAM_T2D", "z_GLG_HDL", "z_GLG_LDL", "z_GLG_TC", "z_GLG_TG"]; - - - //http://jass.pasteur.fr/directLink.html?z_DIAGRAM_T2D,%20z_GLG_HDL,%20z_GLG_LDL,%20z_GLG_TC,%20z_GLG_TG - - var phes = extractUrlParam(); - //phes ="z_PGC_BIP,z_GIANT_BMI"; - //phes ="z_DIAGRAM_T2D,z_GLG_HDL,z_GLG_LDL,z_GLG_TC,z_GLG_TG"; - - //console.log("!!!!!!!"+phes); - //console.log(phes[0]) - var phe = {}; - phe['phenotypeID'] =phes; - //var phes = extractUrlParams(); - //phes +=""; - //var phenotypes = phes.split(','); - //var phenotypes = ["z_C4D_CHD","z_CARDIOGRAM_CHD","z_ICBP_DBP"]; - //var monobjet_json = JSON.stringify(phenotypes); - //console.log(monobjet_json); - //sessionStorage.setItem("phenotypes",monobjet_json); - //location.href = 'http://hub17.hosting.pasteur.fr/getVar.html'; - - //var test =extractUrlParams(); - //console.log(test); - - //console.log(extractUrlParams()); - //location.href = 'chromo_heatmap_manhattan.html'; - $.blockUI({ css: { - border: 'none', - padding: '15px', - backgroundColor: '#000', - '-webkit-border-radius': '10px', - '-moz-border-radius': '10px', - opacity: .5, - color: '#fff'} }); - - var status="-1"; - var getProjectStatus = function(){ - //$.post( "/api/projects",{'phenotypeID':"z_DIAGRAM_T2D,z_GLG_HDL,z_GLG_LDL,z_GLG_TC,z_GLG_TG"}).done(function( data ) { - $.post( "/api/projects",phe).done(function( data ) { - status = data.status.worktable; - console.log("!! status "+status); - if(status =="READY"){ - $.unblockUI(); - console.log( data ); - sessionStorage.setItem("id",data.id); - console.log(data.phenotypes); - //var monobjet_json = JSON.stringify(data.phenotypes[0]); - var monobjet_json = JSON.stringify(data.phenotypes); - sessionStorage.setItem("phenotypes",monobjet_json); - console.log(data.phenotypes[0]["cohort"]); - //location.href = 'http://hub17.hosting.pasteur.fr/getVar.html'; - location.href = 'chromo_heatmap_manhattan.html'; - } - else if(status =="CREATING"){ - console.log("CREATING"); - setTimeout(getProjectStatus, 10000); - } - }); - - }; - getProjectStatus(); - -} - -function extractUrlParam(){ - var t = location.search.substring(1).split('='); - return t[1]; -} -function extractUrlParams(){ - console.log(location.search); - var t = location.search.substring(1).split('&'); - var f = []; - for (var i=0; i<t.length; i++){ - var x = t[ i ].split('='); - f[x[0]]=x[1]; - } - return f; -} - -</script> - -<body onload="directLink()"> - -</body> - -</html> +<html> + +<style> + div.blockMe { padding: 30px; margin: 30px; border: 10px solid #ccc; background-color: #ffd } + #question { background-color: #ffc; padding: 10px; } + #question input { width: 4em ; } +</style> + +<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> +<script src="https://malsup.github.io/jquery.blockUI.js"></script> + +<script> + function avancement() { + var ava = document.getElementById("avancement"); + var prc = document.getElementById("pourcentage"); + prc.innerHTML = ava.value + "%"; + } + + function modif(val) { + var ava = document.getElementById("avancement"); + if((ava.value+val)<=ava.max && (ava.value+val)>0) { + ava.value += val; + } + avancement(); + } + + function directLink() { + var toApply = 1; + var phe = {}; + var url = new URL(window.location.toString()); + var search_params = new URLSearchParams(url.search); + + if (search_params.has("phenotypes")) { + var phes = search_params.get("phenotypes"); + phe['phenotypeID'] = phes; + if (phes == '') { + selectedNumber = 0; + } + else { + selectedNumber = (phes.split(",")).length; + } + console.log("phes='"+phes+"'"); + console.log("selectedNumber="+selectedNumber); + if (selectedNumber == 0){ + // WARNING: No phenotype is selected ! + var User_Message = "ð–ð€ð‘ððˆðð†: ðð¥ðžðšð¬ðž ðœð¡ð¨ð¨ð¬ðž ðšð§ ðšð«ð«ðšð² ð¨ðŸ ðð¡ðžð§ð¨ðð²ð©ðžð¬..." + alert(User_Message); + toApply = 0; + } + else if (selectedNumber == 1){ + // A confirmation window is displayed + var User_Message = "ð–ð€ð‘ððˆðð†: ð²ð¨ð® ð¡ðšð¯ðž ð¬ðžð¥ðžðœððžð ð¨ð§ð¥ð² ð¨ð§ðž ð©ð¡ðžð§ð¨ðð²ð©ðž!" + + "\nIt isn't the way JASS normally works.\nDo you want to continue?"; + var r = confirm(User_Message); + if (r == true) { // Button OK is selected + toApply = 1; + } else { // Button CANCEL is selected + toApply = 0; + } + } + else if ((selectedNumber > 20) && (selectedNumber <= 64)){ + // A confirmation window is displayed + var User_Message = "ð–ð€ð‘ððˆðð†: ð²ð¨ð® ð¡ðšð¯ðž ð¬ðžð¥ðžðœððžð " + + selectedNumber + + " ð©ð¡ðžð§ð¨ðð²ð©ðžð¬!\nThe computation will be very long. \nDo you want to continue?"; + var g = confirm(User_Message); + if (g == true) { // Button OK is selected + toApply = 1; + } else { // Button CANCEL is selected + toApply = 0; + } + } + else if (selectedNumber > 64) { + // ERROR: More than 64 Phenotypes have been selected ! + var User_Message = "ð„ð‘ð‘ðŽð‘: ð²ð¨ð® ð¡ðšð¯ðž ð¬ðžð¥ðžðœððžð " + + selectedNumber + + " ð©ð¡ðžð§ð¨ðð²ð©ðžð¬!\nThe current implementation of JASS cannot analyze more than 64 phenotypes."; + alert(User_Message); + toApply = 0; + } + } + else { + // WARNING: No phenotype is selected ! + var User_Message = "ð–ð€ð‘ððˆðð†: ðð¥ðžðšð¬ðž ðœð¡ð¨ð¨ð¬ðž ðšð§ ðšð«ð«ðšð² ð¨ðŸ ðð¡ðžð§ð¨ðð²ð©ðžð¬..." + alert(User_Message); + toApply = 0; + } + + if (toApply == 1){ + if (search_params.has("chromosome")) { + var chromosome = search_params.get("chromosome"); + // Local analysis + var User_Message = + "Local analysis is not yet implemented in this version of JASS." + + "\nDo not specify a chromosome number and start and end positions"; + alert(User_Message); + toApply = 0; + // var Page_to_display = "chromo_heatmap_manhattan_by_region.html" + } + else { + // Whole genome analysis + var Page_to_display = "chromo_heatmap_manhattan.html" + } + + if(search_params.has("start")) { + var start = search_params.get("start"); + } + + if(search_params.has("end")) { + var end = search_params.get("end"); + } + } + + if (toApply == 1){ + $.blockUI({ message: $('#question'), css: { width: '275px' }}); + avancement(); //Initialisation + + var status = "-1"; + var JASS_progress = 0; + var Old_progress = 0; + var getProjectStatus = function(){ + $.post( "/api/projects",phe).done(function( data ) { + status = data.status.worktable; + JASS_progress = data.progress; + var deltaProgress = JASS_progress - Old_progress; + Old_progress = JASS_progress; + modif(deltaProgress); + + if(status == "READY"){ + $.unblockUI(); + sessionStorage.setItem("id",data.id); + var monobjet_json = JSON.stringify(data.phenotypes); + sessionStorage.setItem("phenotypes",monobjet_json); + location.href = Page_to_display; + } + else if(status == "CREATING"){ + setTimeout(getProjectStatus, 10000); + } + }); + }; + getProjectStatus(); + } + } + +</script> + +<body onload="directLink()"> + <div id="question" style="display:none; cursor: default"> + <H3>Analysis in progress ...</H3> + <progress id="avancement" value="0" max="100"></progress> + <span id="pourcentage"></span> +</div> + +</body> + +</html> diff --git a/jass/static/export.html b/jass/static/export.html index 23f4666b72eb6bf6d26d8426d51d766dd5402908..969381cf664b7e8eebfdc6e45bbe80641e6f2c1c 100644 --- a/jass/static/export.html +++ b/jass/static/export.html @@ -1,201 +1,171 @@ -<html> - -<head> - <script src="js/jquery.min.js"></script> <!--https://cdn.plot.ly/plotly-latest.min.js--> - <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> <!--https://cdn.plot.ly/plotly-latest.min.js--> - <!--<script src="http://tablesorter.com/addons/pager/jquery.tablesorter.pager.js"></script>--> - <!-- <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css"> --> - - - <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> - <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script> - - - - <!-- datatables buttons pdf csv copy --> - <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> - <script src="js/pdfmake.min.js"></script> - <script src="js/vfs_fonts.js"></script> - <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script> - <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script> - <script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script> - <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css"> - <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script> - - <script src="http://malsup.github.io/jquery.blockUI.js"></script> - <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css"> - <link rel="stylesheet" href="https://research.pasteur.fr/wp-content/themes/biologyx2/style.css" type="text/css" > - <style> - .header { - margin:0 0 30px 0; - padding: 5px 0 0 0 ; - height:50; - background-image: url('/static/img/bkg_part2_wthLabel.jpg'); - background-color: transparent; - background-size:contain; - object-fit: contain; - background-repeat:no-repeat; - } - #image-top {height:80!important} - </style> - - <script> - - - var selected = []; - - //goToURL(); - var typeExport = sessionStorage.getItem("typeExport"); - - var idProject = sessionStorage.getItem("id"); - console.log(idProject); - var selectedRegion = sessionStorage.getItem("selectedRegion"); - var selectedChr = sessionStorage.getItem("selectedChr"); - - console.log(selectedRegion); - console.log(selectedChr); - if(typeExport =="localStat"){ - - Plotly.d3.csv("/api/projects/"+idProject+"/manhattan/"+selectedChr+"/"+selectedRegion, function(data){ processExportJASSPVAL(data) } ); - } - else if (typeExport =="globalStat"){ - Plotly.d3.csv("/api/projects/"+idProject+"/genome", - function(data){ processExportGJASSPVAL(data)}); - } - - else if(typeExport =="heatmap"){ - Plotly.d3.csv("/api/projects/"+idProject+"/heatmap/"+selectedChr+"/"+selectedRegion, - function(data){ processExportHeatmap(data) } ); - } - - function processExportGJASSPVAL(rows) { - console.log("processExportGJASSPVAL rows.length "+rows.length); - console.log(rows[0]); - var columns =["CHR","JOSTmin","MiddlePosition","PVALmin","Region","snp_ids"] - - tabulate(rows,columns); - } - - function processExportHeatmap(rows) { - console.log("processExportHeatmap rows.length "+rows.length); - - var columns =["Region","CHR","position","snp_ids","JASS_PVAL"]; - tabulate(rows,columns); - } - - function processExportJASSPVAL(rows) { - console.log("processExportJASSPVAL rows.length "+rows.length); - - var columns =["Region","CHR","position","snp_ids","JASS_PVAL"]; - tabulate(rows,columns); - } - - - - function tabulate(data, columns) { - console.log(data); - - //var table = document.createElement("table"); - var table = $('#pheTable'); - //table.id="pheTable"; - var thead = document.createElement("thead"); - var tr = document.createElement("tr"); - for (var i=0; i<columns.length; i++) { - if ((columns[i] != "ID")&&(columns[i] != "linkRef")){ - var th = document.createElement("th"); - th.innerHTML =columns[i]; - tr.appendChild(th); - } - } - //var th = document.createElement("th"); - //th.innerHTML ="Select"; - //thead.appendChild(th); - thead.appendChild(tr); - table.append(thead); - - //console.log(table); - //var idCounter=1; - var tbody = document.createElement("tbody"); - for (var i=0; i<data.length; i++) { - //for (var j=0; j<columns.length; j++) { - //console.log(data[i]); - //console.log("id "+data[i]['ID']); - //} - var tr = document.createElement("tr"); - //var val = data[i]['ID']; - //var linkRef = data[i]['linkRef']; - - for (var j=0; j<columns.length; j++) { - var td = document.createElement("td"); - td.innerHTML=data[i][columns[j]]; - tr.append(td); - } - //var td = document.createElement("td"); - //td.innerHTML='-'; - //var val = data[i]['ID']; - // td.innerHTML= "<input id='chk_" + idCounter + "' name ='type' type='checkbox' value='" + val + "' />"; - // idCounter ++; - //tr.append(td); - tbody.appendChild(tr); - } - - table.append(tbody); - - //header1.setAttribute("class", "header1" ); - //return table; - - var tmpArray =new Array(); - for (var j=0; j<columns.length; j++) { - tmpArray.push({}); - } - - var table = $('#pheTable').dataTable( { - - aoColumns: tmpArray, - dom: 'Bfrtip', - buttons: [ - 'copy', 'csv', 'pdf' - ] - - - } ); - - //'copy', 'csv', 'excel', 'pdf' - /*new $.fn.dataTable.Buttons( table, { - buttons: [ - { - text: 'Button 2', - action: function ( e, dt, node, conf ) { - alert( 'Button 2 clicked on' ); - } - }, - { - text: 'Button 3', - action: function ( e, dt, node, conf ) { - alert( 'Button 3 clicked on' ); - } - } - ] - - } );*/ - - } - - - - </script> -</head> - -<body> - -<div class="header" > </div> - -<h2>Data Table Export</h2> - -<div id='divContainer' width ="400px"> - <table id ="pheTable" style="width :500px" class="display dataTable"></table> -</div> -<!-- <button id="btn1">Export</button> --> -</body> - -</html> +<html> + +<head> + <script src="js/jquery.min.js"></script> + <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> + + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> + <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script> + + + + <!-- datatables buttons pdf csv copy --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> + <script src="js/pdfmake.min.js"></script> + <script src="js/vfs_fonts.js"></script> + <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script> + <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script> + <script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script> + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css"> + <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script> + + <script src="https://malsup.github.io/jquery.blockUI.js"></script> + <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css"> + <link rel="stylesheet" href="https://research.pasteur.fr/wp-content/themes/biologyx2/style.css" type="text/css" > + <style> + .header { + margin:0 0 30px 0; + padding: 5px 0 0 0 ; + height:50; + background-image: url('/static/img/bkg_part2_wthLabel.jpg'); + background-color: transparent; + background-size:contain; + object-fit: contain; + background-repeat:no-repeat; + } + #image-top {height:80!important} + </style> + + <script> + + + var selected = []; + + var typeExport = sessionStorage.getItem("typeExport"); + + var idProject = sessionStorage.getItem("id"); + console.log(idProject); + var selectedRegion = sessionStorage.getItem("selectedRegion"); + var selectedChr = sessionStorage.getItem("selectedChr"); + + console.log(selectedRegion); + console.log(selectedChr); + if(typeExport =="localStat"){ + + Plotly.d3.csv("/api/projects/"+idProject+"/manhattan/"+selectedChr+"/"+selectedRegion, function(data){ processExportJASSPVAL(data) } ); + } + else if (typeExport =="globalStat"){ + Plotly.d3.csv("/api/projects/"+idProject+"/genome", + function(data){ processExportGJASSPVAL(data)}); + } + + else if(typeExport =="heatmap"){ + Plotly.d3.csv("/api/projects/"+idProject+"/heatmap/"+selectedChr+"/"+selectedRegion, + function(data){ processExportHeatmap(data) } ); + } + + function processExportGJASSPVAL(rows) { + console.log("processExportGJASSPVAL rows.length "+rows.length); + console.log(rows[0]); + var columns =["CHR","JOSTmin","MiddlePosition","PVALmin","Region","snp_ids"] + + tabulate(rows,columns); + } + + function processExportHeatmap(rows) { + console.log("processExportHeatmap rows.length "+rows.length); + + var columns =["Region","CHR","position","snp_ids","JASS_PVAL"]; + tabulate(rows,columns); + } + + function processExportJASSPVAL(rows) { + console.log("processExportJASSPVAL rows.length "+rows.length); + + var columns =["Region","CHR","position","snp_ids","JASS_PVAL"]; + tabulate(rows,columns); + } + + + + function tabulate(data, columns) { + console.log(data); + + var table = $('#pheTable'); + var thead = document.createElement("thead"); + var tr = document.createElement("tr"); + for (var i=0; i<columns.length; i++) { + if ((columns[i] != "ID")&&(columns[i] != "linkRef")){ + var th = document.createElement("th"); + th.innerHTML =columns[i]; + tr.appendChild(th); + } + } + + thead.appendChild(tr); + table.append(thead); + + var tbody = document.createElement("tbody"); + for (var i=0; i<data.length; i++) { + + var tr = document.createElement("tr"); + + for (var j=0; j<columns.length; j++) { + var td = document.createElement("td"); + td.innerHTML=data[i][columns[j]]; + tr.append(td); + } + + tbody.appendChild(tr); + } + + table.append(tbody); + + + var tmpArray =new Array(); + for (var j=0; j<columns.length; j++) { + tmpArray.push({}); + } + + var table = $('#pheTable').dataTable( { + + aoColumns: tmpArray, + dom: 'Bfrtip', + buttons: [ { + extend: 'csv', + + text : 'Export to CSV', + + filename: function(){ + + var d = new Date(); + + var n = d.getTime(); + + return 'Data_Table'; + + }, + }] + + } ); + + } + + + + </script> +</head> + +<body> + +<div class="header" > </div> + +<h2>Data Table Export</h2> + +<div id='divContainer' width ="400px"> + <table id ="pheTable" style="width :500px" class="display dataTable"></table> +</div> + +</body> + +</html> diff --git a/jass/static/index.html b/jass/static/index.html index 9f514a80e06a7bdf2aadcbef436a30d13ac534a9..07cbf37ca6e3dac44636de1216733aa87d97efe0 100644 --- a/jass/static/index.html +++ b/jass/static/index.html @@ -55,15 +55,15 @@ <div id="tabs-3"> <p><b>JASS: command line and web interface for the joint analysis of GWAS results</b><br /> Hanna Julienne, Pierre Lechat, Vincent Guillemot, Carla Lasry, Chunzi Yao, Robinson Araud, Vincent Laville, Bjarni Vilhjalmsson, Hervé Ménager, Hugues Aschard<br /> - in: NAR Genomics and Bioinformatics, Volume 2, Issue 1, March 2020, lqaa003, <a href="https://doi.org/10.1093/nargab/lqaa003"> <FONT color=#0000FF>https://doi.org/10.1093/nargab/lqaa003</FONT></a></p> + in: NAR Genomics and Bioinformatics, Volume 2, Issue 1, March 2020, lqaa003, <a href="https://urldefense.com/v3/__https://doi.org/10.1093/nargab/lqaa003__;!!JFdNOqOXpB6UZW0!75infPACk5lQWcBTD-rE5FQb6Yk4WckKROxH7a5qa4ERTDyiliWfWLGe8-HIgjvh3Gk$"> <FONT color=#0000FF>https://doi.org/10.1093/nargab/lqaa003</FONT></a></p> <p><b>Multitrait genetic-phenotype associations to connect disease variants and biological mechanisms</b><br /> Hanna Julienne, Vincent Laville, Zachary R. McCaw, Zihuai He, Vincent Guillemot, Carla Lasry, Andrey Ziyatdinov, Amaury Vaysse, Pierre Lechat, Hervé Ménager, Wilfried Le Goff, Marie-Pierre Dube, Peter Kraft, Iuliana Ionita-Laza, Bjarni J. Vilhjálmsson, Hugues Aschard<br /> - preprint in: biorxiv, <a href=https://www.biorxiv.org/content/10.1101/2020.06.26.172999v1.full> <FONT color=#0000FF>https://www.biorxiv.org/content/10.1101/2020.06.26.172999v1.full</FONT></a></p> + preprint in: biorxiv, <a href="https://urldefense.com/v3/__https://www.biorxiv.org/content/10.1101/2020.06.26.172999v1.full__;!!JFdNOqOXpB6UZW0!75infPACk5lQWcBTD-rE5FQb6Yk4WckKROxH7a5qa4ERTDyiliWfWLGe8-HIV8Z7Cco$"> <FONT color=#0000FF>https://www.biorxiv.org/content/10.1101/2020.06.26.172999v1.full</FONT></a></p> </div> </div> </body> <footer id="colophon" class="site-footer" role="contentinfo"> -<a href="http://www.pasteur.fr/en" target="_blank"><div id="footlogo"></div></a> +<a href="https://www.pasteur.fr/en" target="_blank"><div id="footlogo"></div></a> </footer> </html> diff --git a/jass/static/selectPhenotypes.html b/jass/static/selectPhenotypes.html index a49e381e85e5cca9b2f540591b1c3794aa740116..397172271037e33d282caee59a2668c261ea44a9 100644 --- a/jass/static/selectPhenotypes.html +++ b/jass/static/selectPhenotypes.html @@ -7,7 +7,7 @@ <link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.min.css"> <script type="text/javascript" charset="utf8" src="/js/jquery.dataTables.js"></script> <script src="/js/jquery.blockUI.js"></script> - <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css"> + <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css"> <link rel="stylesheet" href="https://research.pasteur.fr/wp-content/themes/biologyx2/style.css" type="text/css" > <style> .header { @@ -180,11 +180,9 @@ console.log( data ); sessionStorage.setItem("id",data.id); console.log(data.phenotypes); - //var monobjet_json = JSON.stringify(data.phenotypes[0]); - var monobjet_json = JSON.stringify(data.phenotypes); + var monobjet_json = JSON.stringify(data.phenotypes); sessionStorage.setItem("phenotypes",monobjet_json); console.log(data.phenotypes[0]["cohort"]); - //location.href = 'http://hub17.hosting.pasteur.fr/getVar.html'; location.href = 'chromo_heatmap_manhattan.html'; } else if(status =="CREATING"){ diff --git a/requirements.txt b/requirements.txt index 4d1144be057841f4254e45ba33590528b14d5f21..25400d93c0388519cea98149d04e2cacbade82a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -git+https://github.com/hmenager/connexion.git#egg=connexion[swagger-ui] +git+https://github.com/hmenager/connexion.git@master#egg=connexion[swagger-ui] aiohttp python_dateutil setuptools diff --git a/setup.py b/setup.py index 42e05c541211ed485a6e57202e84206b1bc85da4..19675e52aa5d51210c488a360066df4de0043581 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,18 @@ SETUP_DIR = os.path.dirname(__file__) README = os.path.join(SETUP_DIR, 'README.md') readme = open(README).read() -REQUIRES = ["connexion", "python_dateutil", "setuptools", "pandas", "tables", "scipy", "matplotlib", "celery", "h5py", "aiohttp", "numpy"] +REQUIRES = [ + "connexion[swagger-ui] @ git+https://github.com/hmenager/connexion.git@master#egg=connexion[swagger-ui]", + "aiohttp", + "python_dateutil", + "setuptools", + "numpy", + "pandas", + "tables", + "scipy", + "matplotlib", + "celery", +] setup( name=NAME,