Skip to content

Commit

Permalink
Refactor tool compatibility on other tools to get compatibility in CX…
Browse files Browse the repository at this point in the history
…GN.Dataset.js
  • Loading branch information
ryan-preble committed Feb 21, 2025
1 parent 9c2d5b6 commit 858d02f
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 71 deletions.
62 changes: 0 additions & 62 deletions js/source/entries/toolcompatibility.js

This file was deleted.

2 changes: 2 additions & 0 deletions js/source/legacy/solGS/Dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ solGS.dataset = {
name: name,
type: datasetTypes[j],
data_str: "dataset",
tool_compatibility: d.tool_compatibility
};
datasetPops.push(dsObj);
dsIds.push(id);
Expand Down Expand Up @@ -96,6 +97,7 @@ solGS.dataset = {
privateDatasets = this.addDataOwnerAttr(privateDatasets, 'private')

var allDatasets = [privateDatasets, publicDatasets];
console.log(allDatasets);
return allDatasets.flat();

},
Expand Down
15 changes: 14 additions & 1 deletion js/source/legacy/solGS/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ solGS.cluster = {
var popId = clusterPop.id;
var popName = clusterPop.name;
var dataStr = clusterPop.data_str;
var tool_compatibility = clusterPop.tool_compatibility;

var clusterPopId = solGS.cluster.getClusterPopId(popId, dataStr);
var clusterTypeOpts = solGS.cluster.createClusterTypeSelect(clusterPopId);
Expand All @@ -231,7 +232,19 @@ solGS.cluster = {
var compatibility_message = '';
if (dataStr.match(/dataset/)) {
popName = `<a href="/dataset/${popId}">${popName}</a>`;
compatibility_message = `<p id=compatibility_glyph_${popId}>Working...</p>`;
if (tool_compatibility == "(not calculated)"){
compatibility_message = "(not calculated)";
} else {
if (tool_compatibility["Clustering"]['compatible'] == 0) {
compatibility_message = '<b><span class="glyphicon glyphicon-remove" style="color:red"></span></b>'
} else {
if ('warn' in tool_compatibility["Clustering"]) {
compatibility_message = '<b><span class="glyphicon glyphicon-warning-sign" style="color:orange;font-size:14px" title="' + tool_compatibility["Clustering"]['warn'] + '"></span></b>';
} else {
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green"></span></b>';
}
}
}
}
var rowData = [popName,
dataStr, compatibility_message, clusterPop.owner, clusterTypeOpts,
Expand Down
15 changes: 14 additions & 1 deletion js/source/legacy/solGS/correlation.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ getSelectedPopCorrArgs: function (runCorrElemId) {
var popId = corrPop.id;
var popName = corrPop.name;
var dataStr = corrPop.data_str;
var tool_compatibility = corrPop.tool_compatibility;

var corrPopId = this.getCorrPopId(popId, dataStr);

Expand Down Expand Up @@ -194,7 +195,19 @@ getSelectedPopCorrArgs: function (runCorrElemId) {
var compatibility_message = '';
if (dataStr.match(/dataset/)) {
popName = `<a href="/dataset/${popId}">${popName}</a>`;
compatibility_message = `<p id=compatibility_glyph_${popId}>Working...</p>`;
if (tool_compatibility == "(not calculated)"){
compatibility_message = "(not calculated)";
} else {
if (tool_compatibility["Correlation"]['compatible'] == 0) {
compatibility_message = '<b><span class="glyphicon glyphicon-remove" style="color:red"></span></b>'
} else {
if ('warn' in tool_compatibility["Correlation"]) {
compatibility_message = '<b><span class="glyphicon glyphicon-warning-sign" style="color:orange;font-size:14px" title="' + tool_compatibility["Correlation"]['warn'] + '"></span></b>';
} else {
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green"></span></b>';
}
}
}
}

var rowData = [popName,
Expand Down
15 changes: 14 additions & 1 deletion js/source/legacy/solGS/kinship.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ solGS.kinship = {
var popId = kinshipPop.id;
var popName = kinshipPop.name;
var dataStr = kinshipPop.data_str;
var tool_compatibility = kinshipPop.tool_compatibility;

var kinshipPopId = solGS.kinship.getKinshipPopId(popId, dataStr);

Expand Down Expand Up @@ -197,7 +198,19 @@ solGS.kinship = {
var compatibility_message = '';
if (dataStr.match(/dataset/)) {
popName = `<a href="/dataset/${popId}">${popName}</a>`;
compatibility_message = `<p id=compatibility_glyph_${popId}>Working...</p>`;
if (tool_compatibility == "(not calculated)"){
compatibility_message = "(not calculated)";
} else {
if (tool_compatibility["Kinship & Inbreeding"]['compatible'] == 0) {
compatibility_message = '<b><span class="glyphicon glyphicon-remove" style="color:red"></span></b>'
} else {
if ('warn' in tool_compatibility["Kinship & Inbreeding"]) {
compatibility_message = '<b><span class="glyphicon glyphicon-warning-sign" style="color:orange;font-size:14px" title="' + tool_compatibility["Kinship & Inbreeding"]['warn'] + '"></span></b>';
} else {
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green"></span></b>';
}
}
}
}
var rowData = [popName,
dataStr, compatibility_message, kinshipPop.owner, dataTypeOpts, runKinshipBtn, `${dataStr}_${popId}`];
Expand Down
15 changes: 14 additions & 1 deletion js/source/legacy/solGS/pca.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ solGS.pca = {
var popId = pcaPop.id;
var popName = pcaPop.name;
var dataStr = pcaPop.data_str;
var tool_compatibility = pcaPop.tool_compatibility;

var pcaPopId = solGS.pca.getPcaPopId(popId, dataStr);

Expand Down Expand Up @@ -224,7 +225,19 @@ solGS.pca = {

if (dataStr.match(/dataset/)) {
popName = `<a href="/dataset/${popId}">${popName}</a>`;
compatibility_message = `<p id=compatibility_glyph_${popId}>Working...</p>`;
if (tool_compatibility == "(not calculated)"){
compatibility_message = "(not calculated)";
} else {
if (tool_compatibility["Population Structure"]['compatible'] == 0) {
compatibility_message = '<b><span class="glyphicon glyphicon-remove" style="color:red"></span></b>'
} else {
if ('warn' in tool_compatibility["Population Structure"]) {
compatibility_message = '<b><span class="glyphicon glyphicon-warning-sign" style="color:orange;font-size:14px" title="' + tool_compatibility["Population Structure"]['warn'] + '"></span></b>';
} else {
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green"></span></b>';
}
}
}
}

var rowData = [popName,
Expand Down
2 changes: 1 addition & 1 deletion lib/CXGN/Dataset.pm
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ sub get_dataset_data {
$dataref->{category_order} = $self->category_order();
$dataref->{outliers} = $self->outliers() if $self->outliers;
$dataref->{outlier_cutoffs} = $self->outlier_cutoffs() if $self->outliers;
$dataref->{tool_compatibility} = $self->tool_compatibility() if $self->tool_compatibility;
$dataref->{tool_compatibility} = ($self->tool_compatibility) ? $self->tool_compatibility() : '(not calculated)';
return $dataref;
}

Expand Down
2 changes: 1 addition & 1 deletion mason/solgs/tools/datatable_display.mas
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ my $analysis_abbr = $analysis_type =~ /correlation/ ? 'corr' : $analysis_type;
$wizard_link_txt = 'Create a new list or dataset' if !$wizard_link_txt;
</%perl>

<& /util/import_javascript.mas, entries => ["toolcompatibility"], classes => [ "solGS.Dataset", "CXGN.List"] &>
<& /util/import_javascript.mas, classes => [ "solGS.Dataset", "CXGN.List"] &>

<div id="lists_datasets_canvas">

Expand Down
2 changes: 1 addition & 1 deletion mason/tools/heritability/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</%perl>


<& '/util/import_javascript.mas', entries => ["toolcompatibility"], classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>
<& '/util/import_javascript.mas', classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>

<script src="https://cdn.jsdelivr.net/npm/vega@4"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script>
Expand Down
2 changes: 1 addition & 1 deletion mason/tools/solgwas/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</%perl>


<& '/util/import_javascript.mas', entries => ["toolcompatibility"], classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>
<& '/util/import_javascript.mas', classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>

<script src="https://cdn.jsdelivr.net/npm/vega@4"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script>
Expand Down
2 changes: 1 addition & 1 deletion mason/tools/stability/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</%perl>


<& '/util/import_javascript.mas', entries => ["toolcompatibility"], classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>
<& '/util/import_javascript.mas', classes => ['jquery', 'jqueryui', 'CXGN.Login', 'd3.d3v4Min.js', 'CXGN.BreedersToolbox.HTMLSelect'] &>


<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Expand Down

0 comments on commit 858d02f

Please sign in to comment.