Skip to content

Commit

Permalink
annotation db analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cohen committed Jun 22, 2021
1 parent 59f3967 commit 643fd64
Show file tree
Hide file tree
Showing 8 changed files with 59,478 additions and 44 deletions.
18 changes: 17 additions & 1 deletion html/top_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,26 @@
<li class="nav-item active">
<a id="cdr3_length" class="nav-link nav-a" style="font-size: 1rem">CDR3</a>
</li>

<li class="nav-item disabled" id="cohort_analysis_status">

<a id="cohort_analysis" class="nav-link nav-a disabled" href="cohort_analysis.html"
style="font-size: 1rem">Cohort Analysis</a>
style="font-size: 1rem;display:none">Cohort Analysis</a>

<div id="cohort_analysis_expanded" class="btn-group" style="display:none">
<button type="button" id="cohort_analysis_expanded_button" disabled=""
class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<span>Cohort Analysis</span>
</button>
<div class="dropdown-menu active pre-scrollable">
<a class="dropdown-item" href="cohort_analysis.html">Diversity</a>
<a class="dropdown-item" href="cohort_analysis.html?data=db">Database</a>
</div>
</div>

</li>

<li class="nav-item active">
<a id="home" class="nav-link nav-a" href="index.html" style="font-size: 1rem">Home</a>
</li>
Expand Down
11 changes: 8 additions & 3 deletions js/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ var cohort_name_intra = 'Intracohort Analysis'
var cohort_name_pair = 'Paired Sample Cohort Analysis'
var cohort_name_scatter = 'Intracohort Scatterplot'

var data_sheet = {};
data_sheet[null] = 'intracohort_data.csv';
data_sheet['db'] = 'db_data.csv';
var data_sheet_url = data_sheet[new URL(location.href).searchParams.get('data')];

if (sessionStorage.getItem('path_val') != "data/" && sessionStorage.getItem('path_val') != null) {
cohort_name_intra = sessionStorage.getItem('path_val').split("/")[sessionStorage.getItem('path_val').split("/").length - 2];
cohort_name_pair = sessionStorage.getItem('path_val').split("/")[sessionStorage.getItem('path_val').split("/").length - 2];
Expand Down Expand Up @@ -143,7 +148,7 @@ $.ajax({
url: data_path + "meta.csv",
type: 'HEAD',
error: function () {
d3.text(data_path + "intracohort_data.csv").then(function (data) {
d3.text(data_path + data_sheet_url).then(function (data) {

cond_name[0] = "no_cond_cond";
cond_group[0] = [];
Expand Down Expand Up @@ -303,7 +308,7 @@ $.ajax({
// On last meta table row...
if (j == (meta_rows.length - 1)) {

d3.text(data_path + "intracohort_data.csv").then(function (data) {
d3.text(data_path + data_sheet_url).then(function (data) {

var data_rows = d3.csvParseRows(data);
func_name = data_rows[0].slice(2);
Expand Down Expand Up @@ -1345,7 +1350,7 @@ function pscaDraw() {

pval_anno.push({
showarrow: false,
text: split_group[k],
text: split_group[k].split(' ').join('<br>').split('/').join('/<br>'),
x: (k * timepoint_group.length) + ((timepoint_group.length - 1) * .5),
xref: 'x',
y: 1.06,
Expand Down
62 changes: 30 additions & 32 deletions js/populate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ plot_labels['csumBarplot'] = ['C Gene Usage', 'C Gene', 'Frequency'];
plot_labels['vjStackBar'] = ['V-J Gene Usage', 'V Gene', 'Frequency', 'J Gene'];

// Get current sample value from URL
var current_sample = $(location).attr('search').split('=').pop();
if (current_sample == "") {
var current_sample = new URL(location.href).searchParams.get('sample');
if (current_sample == null) {
current_sample = "All";
}
// Populate figures based off of sample ID
Expand Down Expand Up @@ -140,37 +140,35 @@ if ($.inArray(window.location.pathname.split('/').pop(), ['index.html', '']) >=
// Populate information table from info.csv
if ($.inArray(window.location.pathname.split('/').pop(), ['cohort_analysis.html']) >= 0) {
$(document).ready(function () {
var data_path = 'data/'
if (sessionStorage.getItem('path_val') != null) {
data_path = sessionStorage.getItem('path_val')
} else {
jQuery.get("cohort_list.csv", function (data) {
var path_val = data.split("\n")[0].split(",")[0]
path_val = path_val.replace(/\/?$/, '/');
sessionStorage.setItem('path_val', path_val);
data_path = sessionStorage.getItem('path_val');
location.reload();
}, dataType = 'text');
}
var data_path = 'data/'
if (sessionStorage.getItem('path_val') != null) {
data_path = sessionStorage.getItem('path_val')
} else {
jQuery.get("cohort_list.csv", function (data) {
var path_val = data.split("\n")[0].split(",")[0]
path_val = path_val.replace(/\/?$/, '/');
sessionStorage.setItem('path_val', path_val);
data_path = sessionStorage.getItem('path_val');
location.reload();
}, dataType = 'text');
}

// var i = setInterval(function () {
// if (sessionStorage.length) {
// clearInterval(i);
parseData(data_path + "intracohort_data.csv", jsonToTable);
$("#statsCSV").attr('href', data_path + "intracohort_data.csv");
$.ajax({
url: data_path + "meta.csv",
type:'HEAD',
success: function()
{
$('#cohortMetaTable').attr('style','');
parseData(data_path + "meta.csv", jsonToMetaTable);
$("#metaCSV").attr('href', data_path + "meta.csv");
}
});
// }
// }, 100);
});
let data_sheet = {};
data_sheet[null] = 'intracohort_data.csv';
data_sheet['db'] = 'db_data.csv';
let data_sheet_url = data_sheet[new URL(location.href).searchParams.get('data')];
parseData(data_path + data_sheet_url, jsonToTable);
$("#statsCSV").attr('href', data_path + data_sheet_url);
$.ajax({
url: data_path + "meta.csv",
type: 'HEAD',
success: function () {
$('#cohortMetaTable').attr('style', '');
parseData(data_path + "meta.csv", jsonToMetaTable);
$("#metaCSV").attr('href', data_path + "meta.csv");
}
});
});
}


Expand Down
20 changes: 14 additions & 6 deletions js/top_navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,23 @@ $(function () {
if (current_sample == "All") {
$("#cohort_analysis").attr("class", "nav-link nav-a");
$("#cohort_analysis_status").attr("class", "nav-item active");
$('#cohort_analysis_expanded_button').prop('disabled', false);
}
// db data availability
$.ajax({
url: path_val + "db_data.csv",
type: 'HEAD',
error: function () {
$('#cohort_analysis').show();
},
success: function () {
$('#cohort_analysis_expanded').show();
}
});

});
// Current sample display on dropdown
if (current_sample == '') {
$('#chosen_sample').text('All');
}
else {
$('#chosen_sample').text(current_sample);
}
$('#chosen_sample').text(current_sample);
// Search dropdown samples
$(document).ready(function () {
$("#searchSamples").on("keyup", function () {
Expand Down
1 change: 1 addition & 0 deletions r/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ clonotypeMax = 8
sample_level_run = TRUE
cohort_level_run = TRUE
intracohort_run = TRUE
db_run = TRUE

#####################
# CUSTOM INPUT FORMAT
Expand Down
Loading

0 comments on commit 643fd64

Please sign in to comment.