aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/templates/wgcna_setup.html37
-rw-r--r--wqflask/wqflask/wgcna/gn3_wgcna.py10
2 files changed, 12 insertions, 35 deletions
diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html
index 86d9fa10..d7acd5f2 100644
--- a/wqflask/wqflask/templates/wgcna_setup.html
+++ b/wqflask/wqflask/templates/wgcna_setup.html
@@ -9,7 +9,8 @@
}
</style>
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@4.14.1/css/xterm.css">
+
+<link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='xterm/xterm.min.css') }}" />
<div class="container">
<div class="col-md-5">
@@ -80,19 +81,12 @@
</div>
</div>
-<script src="https://cdn.socket.io/4.2.0/socket.io.min.js" integrity="sha384-PiBR5S00EtOj2Lto9Uu81cmoyZqR57XcOna1oAuVuIEjzj0wpqDVfD0JA9eXlRsj" crossorigin="anonymous"></script>
-
-<script src="https://cdn.jsdelivr.net/npm/xterm@4.14.1/lib/xterm.min.js"></script>
-
-<script src="https://cdn.jsdelivr.net/npm/xterm-addon-attach@0.6.0/lib/xterm-addon-attach.min.js"></script>
-
-
+<script src="{{ url_for('js', filename='xterm/xterm.min.js') }}" type="text/javascript"></script>
+<script src="{{ url_for('js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.min.js"></script>
- <script src="https://code.jquery.com/jquery-3.5.1.js"
- integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
- crossorigin="anonymous"></script>
+
<script>
-// document.addEventListener('DOMContentLoaded', function() {
+document.addEventListener('DOMContentLoaded', function() {
let term = new Terminal({
cursorBlink: true,
lineHeight: 1.3,
@@ -117,11 +111,6 @@ term.writeln(termDebugs.general)
wgcnaForm = document.querySelector("#wgcna_form")
-const socket = io("http://127.0.0.1:8081") //issue gn3 private
-const attachAddon = new AttachAddon.AttachAddon(socket);
-
-term.loadAddon(attachAddon);
-
fitAddon.fit()
term.onData((data) => {
term.write(data)
@@ -133,16 +122,6 @@ if (wgcnaForm) {
term.writeln(termDebugs.fail)
}
-socket.on("connect", () => {
- $("#wgcna_form").append(`<input type="hidden" name="socket_id" value=${socket.id}>`);
-})
-
-socket.on("output", ({
- data
-}) => {
- term.writeln(data)
-})
-
$(document).on('submit', '#wgcna_form', function(e) {
term.writeln(termDebugs.success)
@@ -156,6 +135,8 @@ $(document).on('submit', '#wgcna_form', function(e) {
document.write(data)
}
})
-});
+})
+})
+
</script>
{% endblock %} \ No newline at end of file
diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py
index c4cc2e7f..15728f22 100644
--- a/wqflask/wqflask/wgcna/gn3_wgcna.py
+++ b/wqflask/wqflask/wgcna/gn3_wgcna.py
@@ -4,7 +4,9 @@ and process data to be rendered by datatables
import requests
from types import SimpleNamespace
+
from utility.helper_functions import get_trait_db_obs
+from utility.tools import GN_SERVER_URL
def fetch_trait_data(requestform):
@@ -24,7 +26,6 @@ def process_dataset(trait_list):
traits = []
strains = []
- # xtodo unique traits and strains
for trait in trait_list:
traits.append(trait[0].name)
@@ -33,9 +34,6 @@ def process_dataset(trait_list):
for strain in trait[0].data:
strains.append(strain)
input_data[trait[0].name][strain] = trait[0].data[strain].value
- # "sample_names": list(set(strains)),
- # "trait_names": form_traits,
- # "trait_sample_data": form_strains,
return {
"input": input_data,
@@ -77,9 +75,7 @@ def process_image(response):
def run_wgcna(form_data):
"""function to run wgcna"""
- GN3_URL = "http://127.0.0.1:8081"
-
- wgcna_api = f"{GN3_URL}/api/wgcna/run_wgcna"
+ wgcna_api = f"{GN_SERVER_URL}api/wgcna/run_wgcna"
# parse form data