Commit 43f73c1b authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !92
parents 14319a7b c4edb05e
Pipeline #8237 passed with stages
in 34 seconds
This diff is collapsed.
......@@ -30,18 +30,30 @@
padding: 5px;
}
.container {
width: 100%;
}
table {
margin-left: auto;
margin-right: auto;
}
.row {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
th,
td {
padding: 5px 15px;
th,td {
padding: 5px 5px;
text-align: center;
}
.he {
padding: 0px;
width: 10px;
}
.no_checkbox>i.jstree-checkbox {
display: none
}
......@@ -118,8 +130,9 @@
<div class="container" align=center style="max-width: none;">
<table id="samplesTable" border="1">
<tr>
<th>H&E Thumbnail (Pr)</th>
<th>H&E Thumbnail (Bl)</th>
<th class="he">H&E Thumbnail (Pr)</th>
<th class="he">H&E Thumbnail (Bl)</th>
<th class="he">H&E Thumbnail (LUT)</th>
<th>Disease</th>
<th>ID</th>
<th>Age</th>
......@@ -167,53 +180,7 @@
});
$("#jstree").bind("check_node.jstree uncheck_node.jstree", function (e, data) {
var checked = $("#jstree").jstree("get_checked")
var filter = []
for (i = 0; i < checked.length; i++) {
for (j = 0; j < filters.length; j++) {
if (checked[i] == filters[j].id) {
filter.push(filters[j].text)
}
}
}
filtered = filterRepo(repo, checked)
filterRepoGroups_out = filterRepoGroups(repo, filtered)
filtered_dis = filterRepoGroups_out[0]
filtered_bmi = filterRepoGroups_out[1]
filtered_t2d = filterRepoGroups_out[2]
filtered_eth = filterRepoGroups_out[3]
filtered_age = filterRepoGroups_out[4]
filtered_prv = filterRepoGroups_out[5]
filtered_psa = filterRepoGroups_out[6]
document.getElementById("total").innerHTML = filtered.length
if (checked.length == 0) {
document.getElementById("filters").innerHTML = "NO"
} else {
document.getElementById("filters").innerHTML = filter
}
filterDoughnut_out = filterDoughnut(filtered_bmi, filtered_t2d, filtered_eth, filtered_age, filtered_prv, filtered_psa)
doughnut_data_dis = filterDoughnut_out[0]
doughnut_data_bmi = filterDoughnut_out[1]
doughnut_data_t2d = filterDoughnut_out[2]
doughnut_data_eth = filterDoughnut_out[3]
doughnut_data_age = filterDoughnut_out[4]
doughnut_data_prv = filterDoughnut_out[5]
doughnut_data_psa = filterDoughnut_out[6]
dis.destroy()
dis = new Chart(document.getElementById("doughnut-dis"), { type: "doughnut", data: doughnut_data_dis, options: doughnut_options })
bmi.destroy()
bmi = new Chart(document.getElementById("doughnut-bmi"), { type: "doughnut", data: doughnut_data_bmi, options: doughnut_options })
t2d.destroy()
t2d = new Chart(document.getElementById("doughnut-t2d"), { type: "doughnut", data: doughnut_data_t2d, options: doughnut_options })
eth.destroy()
eth = new Chart(document.getElementById("doughnut-eth"), { type: "doughnut", data: doughnut_data_eth, options: doughnut_options })
age.destroy()
age = new Chart(document.getElementById("doughnut-age"), { type: "doughnut", data: doughnut_data_age, options: doughnut_options })
prv.destroy()
prv = new Chart(document.getElementById("doughnut-prv"), { type: "doughnut", data: doughnut_data_prv, options: doughnut_options })
psa.destroy()
psa = new Chart(document.getElementById("doughnut-psa"), { type: "doughnut", data: doughnut_data_psa, options: doughnut_options })
tableData(repo, filtered)
refresh()
})
checked = []
filtered = filterRepo(repo, checked)
......@@ -843,6 +810,7 @@
]
}
function tableData(repo, fitered) {
var thumbnails = {{ index .Site.Data.repository.thumbnails }}
let table = document.getElementById("samplesTable")
while (table.rows.length > 1) {
table.deleteRow(-1);
......@@ -852,24 +820,72 @@
let newRow = table.insertRow(-1)
var row_he_pr = newRow.insertCell(0)
var row_he_bl = newRow.insertCell(1)
var row_ds = newRow.insertCell(2)
var row_si = newRow.insertCell(3)
var row_ag = newRow.insertCell(4)
var row_et = newRow.insertCell(5)
var row_he_lut = newRow.insertCell(2)
var row_ds = newRow.insertCell(3)
var row_si = newRow.insertCell(4)
var row_ag = newRow.insertCell(5)
var row_et = newRow.insertCell(6)
var thm_pr = document.createElement("img")
thm_pr.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/Pr/" + repo[i]["Disease Status"] + ("000"+repo[i]["Study ID"]).slice(-3) + ".00.Pr.jpg"
thm_pr.height = "75"
var thm_pr_file
var thm_bl = document.createElement("img")
var thm_bl_file
var thm_lut = document.createElement("img")
var thm_lut_file
if (repo[i]["Disease Status"] == "Donor") {
var dis_status = "D"
} else {
var dis_status = repo[i]["Disease Status"]
}
for (j = 0; j < thumbnails.length; j++) {
if (thumbnails[j].patient == dis_status + ("000"+repo[i]["Study ID"]).slice(-3)) {
if (thumbnails[j].Pr != ""){
thm_pr_file = thumbnails[j].Pr
thm_pr.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/jpg/Pr/" + thm_pr_file
}
if (thumbnails[j].Bl != ""){
thm_bl_file = thumbnails[j].Bl
thm_bl.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/jpg/Bl/" + thm_bl_file
}
if (thumbnails[j].LUT != ""){
thm_lut_file = thumbnails[j].LUT
thm_lut.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/jpg/LUT/" + thm_lut_file
}
break
}
}
if (window.innerWidth > 1250) {
thm_pr.height = "75"
} else if (window.innerWidth > 1000) {
thm_pr.height = "50"
} else if (window.innerWidth < 1000) {
thm_pr.height = "25"
}
row_he_pr.appendChild(thm_pr)
thm_pr.onerror=function(){
this.remove()
}
var thm_bl = document.createElement("img")
thm_bl.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/Bl/" + repo[i]["Disease Status"] + ("000"+repo[i]["Study ID"]).slice(-3) + ".00.Bl.jpg"
thm_bl.height = "75"
if (window.innerWidth > 1250) {
thm_bl.height = "75"
} else if (window.innerWidth > 1000) {
thm_bl.height = "50"
} else if (window.innerWidth < 1000) {
thm_bl.height = "25"
}
row_he_bl.appendChild(thm_bl)
thm_bl.onerror=function(){
this.remove()
}
if (window.innerWidth > 1250) {
thm_lut.height = "75"
} else if (window.innerWidth > 1000) {
thm_lut.height = "50"
} else if (window.innerWidth < 1000) {
thm_lut.height = "25"
}
row_he_lut.appendChild(thm_lut)
thm_lut.onerror=function(){
this.remove()
}
row_ds.innerHTML = repo[i]["Disease Status"]
row_si.innerHTML = repo[i]["Study ID"]
row_ag.innerHTML = repo[i].Age
......@@ -884,8 +900,62 @@
var t;
if (b.length > a.length) t = b, b = a, a = t;
return a.filter(function (e) {
return b.indexOf(e) > -1;
return b.indexOf(e) > -1
});
}
$( window ).resize(function() {
refresh()
})
function refresh() {
var repo = {{ index .Site.Data.repository.repository }}
var filters = {{ index .Site.Data.repository.filters }}
var checked = $("#jstree").jstree("get_checked")
var filter = []
for (i = 0; i < checked.length; i++) {
for (j = 0; j < filters.length; j++) {
if (checked[i] == filters[j].id) {
filter.push(filters[j].text)
}
}
}
filtered = filterRepo(repo, checked)
filterRepoGroups_out = filterRepoGroups(repo, filtered)
filtered_dis = filterRepoGroups_out[0]
filtered_bmi = filterRepoGroups_out[1]
filtered_t2d = filterRepoGroups_out[2]
filtered_eth = filterRepoGroups_out[3]
filtered_age = filterRepoGroups_out[4]
filtered_prv = filterRepoGroups_out[5]
filtered_psa = filterRepoGroups_out[6]
document.getElementById("total").innerHTML = filtered.length
if (checked.length == 0) {
document.getElementById("filters").innerHTML = "NO"
} else {
document.getElementById("filters").innerHTML = filter
}
filterDoughnut_out = filterDoughnut(filtered_bmi, filtered_t2d, filtered_eth, filtered_age, filtered_prv, filtered_psa)
doughnut_data_dis = filterDoughnut_out[0]
doughnut_data_bmi = filterDoughnut_out[1]
doughnut_data_t2d = filterDoughnut_out[2]
doughnut_data_eth = filterDoughnut_out[3]
doughnut_data_age = filterDoughnut_out[4]
doughnut_data_prv = filterDoughnut_out[5]
doughnut_data_psa = filterDoughnut_out[6]
dis.destroy()
dis = new Chart(document.getElementById("doughnut-dis"), { type: "doughnut", data: doughnut_data_dis, options: doughnut_options })
bmi.destroy()
bmi = new Chart(document.getElementById("doughnut-bmi"), { type: "doughnut", data: doughnut_data_bmi, options: doughnut_options })
t2d.destroy()
t2d = new Chart(document.getElementById("doughnut-t2d"), { type: "doughnut", data: doughnut_data_t2d, options: doughnut_options })
eth.destroy()
eth = new Chart(document.getElementById("doughnut-eth"), { type: "doughnut", data: doughnut_data_eth, options: doughnut_options })
age.destroy()
age = new Chart(document.getElementById("doughnut-age"), { type: "doughnut", data: doughnut_data_age, options: doughnut_options })
prv.destroy()
prv = new Chart(document.getElementById("doughnut-prv"), { type: "doughnut", data: doughnut_data_prv, options: doughnut_options })
psa.destroy()
psa = new Chart(document.getElementById("doughnut-psa"), { type: "doughnut", data: doughnut_data_psa, options: doughnut_options })
tableData(repo, filtered)
}
</script>
</head>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment