Skip to content

Commit

Permalink
Remove limits for types of input data for clustering and pca
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-preble committed Feb 25, 2025
1 parent 63919a0 commit 69e6c7b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
28 changes: 19 additions & 9 deletions js/source/legacy/solGS/Dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,27 @@ solGS.dataset = {
return datasets;
},

addDataTypeAttr(datasets) {
addDataTypeAttr(datasets, analysis) {

// for (var i = 0; i < datasets.length; i++) {
// if (datasets[i].type.match(/accessions/)) {
// datasets[i]["data_type"] = ["Genotype"];
// } else if (datasets[i].type.match(/plots/)) {
// datasets[i]["data_type"] = ["Phenotype"];
// } else if (datasets[i].type.match(/trials/)) {
// datasets[i]["data_type"] = ["Genotype", "Phenotype"];
// }

// }
var type_opts;
if (analysis == "Population Structure") {
type_opts = ["Genotype", "Phenotype"];
} else if (analysis == "Clustering") {
type_opts = ["Genotype", "Phenotype", "GEBV"];
}

for (var i = 0; i < datasets.length; i++) {
if (datasets[i].type.match(/accessions/)) {
datasets[i]["data_type"] = ["Genotype"];
} else if (datasets[i].type.match(/plots/)) {
datasets[i]["data_type"] = ["Phenotype"];
} else if (datasets[i].type.match(/trials/)) {
datasets[i]["data_type"] = ["Genotype", "Phenotype"];
}

datasets[i]["data_type"] = type_opts;
}

return datasets;
Expand Down
6 changes: 3 additions & 3 deletions js/source/legacy/solGS/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ solGS.cluster = {
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>';
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green" title="'+tool_compatibility["Clustering"]['types']+'"></span></b>';
}
}
}
Expand Down Expand Up @@ -787,10 +787,10 @@ solGS.cluster = {
var list = new solGSList();
var lists = list.getLists(["accessions", "plots", "trials"]);
lists = list.addDataStrAttr(lists);
lists = list.addDataTypeAttr(lists);
lists = list.addDataTypeAttr(lists, "");

var datasets = solGS.dataset.getDatasetPops(["accessions", "trials"]);
datasets = solGS.dataset.addDataTypeAttr(datasets);
datasets = solGS.dataset.addDataTypeAttr(datasets, "Clustering");
clusterPops = [lists, datasets];

return clusterPops.flat();
Expand Down
6 changes: 3 additions & 3 deletions js/source/legacy/solGS/pca.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ solGS.pca = {
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>';
compatibility_message = '<b><span class="glyphicon glyphicon-ok" style="color:green" title="'+tool_compatibility["Population Structure"]['types']+'"></span></b>';
}
}
}
Expand Down Expand Up @@ -288,9 +288,9 @@ solGS.pca = {
var list = new solGSList();
var lists = list.getLists(["accessions", "plots", "trials"]);
lists = list.addDataStrAttr(lists);
lists = list.addDataTypeAttr(lists);
lists = list.addDataTypeAttr(lists, "");
var datasets = solGS.dataset.getDatasetPops(["accessions", "trials"]);
datasets = solGS.dataset.addDataTypeAttr(datasets);
datasets = solGS.dataset.addDataTypeAttr(datasets, "Population Structure");
var pcaPops = [lists, datasets];

return pcaPops.flat();
Expand Down

0 comments on commit 69e6c7b

Please sign in to comment.