Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store pca scores results #5265

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
bdbff75
add save pcs btn
isaak Nov 12, 2024
dc4ba1d
Merge branch 'master' into topic/solgs/store-pca-results
isaak Nov 18, 2024
5125aa5
save pca scores
isaak Nov 22, 2024
7e7554c
make analysis save methods generic
isaak Nov 22, 2024
f42a5f6
reuse analysisSave methods
isaak Nov 29, 2024
09fa87c
use solGS.save.storeAnalysisResults
isaak Nov 29, 2024
765d663
load analysisSave js lib
isaak Nov 29, 2024
18388c6
add include_rownames param
isaak Nov 29, 2024
43674d8
refactor pca analysis args structuring and parsing
isaak Dec 2, 2024
25ce791
move gebvs saving code into gebvsSave.js
isaak Dec 2, 2024
48bc51f
use getPcaAnalysisArgs method
isaak Dec 3, 2024
c797ff0
add functions for getting breeding prog id
isaak Dec 9, 2024
9295872
add get_trial_id_by_accession
isaak Dec 9, 2024
89898cc
tweak pca args structuring
isaak Dec 9, 2024
3ad03c3
clean up
isaak Dec 9, 2024
516cab4
save top 10 principal components
isaak Dec 13, 2024
a579819
add PCA score terms
isaak Dec 13, 2024
ef3ee1d
fix style
isaak Dec 13, 2024
2efd1ba
add prcomp protocol type
isaak Dec 13, 2024
a36b3b4
import gebvsSave js
isaak Dec 13, 2024
74b176f
add prcomp protocol_type entry
isaak Dec 13, 2024
65f97aa
pca result save controller
isaak Dec 13, 2024
ff17fbb
gbvs save controller
isaak Dec 13, 2024
df58e67
clean up modules, fix indentations
isaak Dec 13, 2024
4889372
add pca results detail ajax req
isaak Dec 13, 2024
0ca8334
update get analysis results method names
isaak Dec 13, 2024
3efada4
move gebvs save logic to gebvsSave controller
isaak Dec 13, 2024
dd5210e
tweak convert_arrayref_to_hashref fun to make it wrok with multi trai…
isaak Dec 16, 2024
e613889
update div elem names
isaak Dec 16, 2024
f42e009
make selenium tests work with private lists
isaak Dec 17, 2024
7d2f3ff
update fixture dump with db patches and cxgn_statistics.obo (PCA) terms
isaak Dec 17, 2024
fb0954d
tweak pca args parsing
isaak Dec 18, 2024
19ea1cf
make pcs saving work for different data types from trial detail page
isaak Dec 18, 2024
c6348a6
add analysis_page to args
isaak Dec 18, 2024
3aaebc4
organize code
isaak Dec 18, 2024
3208d9e
delete double variable_of cvterm in fixture
isaak Dec 19, 2024
8ea228c
update parsing list or dataset ids
isaak Dec 23, 2024
5e5c492
clean up redundant code for pca and clustering file id
isaak Dec 23, 2024
624b89a
remove selection pop id...
isaak Dec 24, 2024
6fc027f
make loading pca result from selection predition page load in standal…
isaak Dec 24, 2024
e358bfa
ad pca resuls saving selenium tests
isaak Dec 24, 2024
5c3bb7e
show save pcs on analysis with submitted job names only
isaak Dec 31, 2024
9329d8e
fix conflict and merge master
isaak Jan 2, 2025
bcc68c5
fix logged analysis name check and pass selenium tests
isaak Jan 2, 2025
5ef4147
update expected recordsTotal and recordsFiltered and pass unit_mech/A…
isaak Jan 6, 2025
fe4163c
update BrAPI_v1 mech tests to reflect changes to new cvterm entries i…
isaak Jan 8, 2025
7a259a9
update BrAPIV2 phenotying mech test to reflect new cvterm entries in …
isaak Jan 8, 2025
d264b95
fix lint test failures
isaak Jan 8, 2025
9506d26
Merge branch 'master' into topic/solgs/store-pca-results
isaak Jan 13, 2025
7e74097
limit loading pca results to once, regardless of how many times a use…
isaak Jan 20, 2025
ee1cdb3
retrieve the latest analysis job details
isaak Jan 27, 2025
364b59b
apply Prettier formatting
isaak Jan 27, 2025
a870075
apply formatting
isaak Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions db/00187/AddPrcompCvterm.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env perl


=head1 NAME

AddPHGGenotypingCvterms

=head1 SYNOPSIS

mx-run AddPHGGenotypingCvterms [options] -H hostname -D dbname -u username [-F]

this is a subclass of L<CXGN::Metadata::Dbpatch>
see the perldoc of parent class for more details.

=head1 DESCRIPTION
This patch adds pcr_marker_details, pcr_marker_genotyping and pcr_marker_protocol cvterms
This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>

=head1 AUTHOR

Isaak Y Tecle <iyt2@cornell.edu>

=head1 COPYRIGHT & LICENSE

Copyright 2010 Boyce Thompson Institute for Plant Research

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut


package AddPrcompCvterm;

use Moose;
use Bio::Chado::Schema;
use Try::Tiny;
extends 'CXGN::Metadata::Dbpatch';


has '+description' => ( default => <<'' );
This patch adds the 'prcomp' protocol_type cvterm.

has '+prereq' => (
default => sub {
[],
},

);

sub patch {
my $self=shift;

print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";

print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";

print STDOUT "\nExecuting the SQL commands.\n";
my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );

print STDERR "INSERTING CV TERMS...\n";

my $terms = {
'protocol_type' => [
'prcomp',
]
};

foreach my $t (keys %$terms){
foreach (@{$terms->{$t}}){
$schema->resultset("Cv::Cvterm")->create_with({
name => $_,
cv => $t
});
}
}

print "You're done!\n";
}


####
1; #
####
111 changes: 31 additions & 80 deletions js/source/legacy/solGS/analysisSave.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
/*
*Saves solgs modeling output
*Saves solGS modeling and other analysis output
* Isaak Y Tecle <iyt2@cornell.edu>
*
*/

var solGS = solGS || function solGS() {};

solGS.save = {
checkStoredAnalysis: function () {
var args = this.saveGebvsArgs();
var checkArgs = JSON.stringify(args);
checkStoredAnalysis: function (analysisArgs) {
analysisArgs = JSON.stringify(analysisArgs);
var stored = jQuery.ajax({
dataType: "json",
type: "POST",
data: {'arguments': checkArgs},
data: {'arguments': analysisArgs},
url: "/solgs/check/stored/analysis/",
});

return stored;
},

getResultDetails: function () {
var args = this.saveGebvsArgs();
var resultArgs = JSON.stringify(args);
getGebvsResultDetails: function (analysisArgs) {
analysisArgs = JSON.stringify(analysisArgs);
var details = jQuery.ajax({
dataType: "json",
type: "POST",
data: {'arguments': resultArgs},
url: "/solgs/analysis/result/details",
data: {'arguments': analysisArgs},
url: "/solgs/gebvs/result/details",
});

return details;
},

saveGebvs: function (args) {
getPcaResultDetails: function (analysisArgs) {
analysisArgs = JSON.stringify(analysisArgs);
var details = jQuery.ajax({
dataType: "json",
type: "POST",
data: {'arguments': analysisArgs},
url: "/solgs/pca/result/details",
});

return details;
},

storeAnalysisResults: function (args) {
var save = jQuery.ajax({
dataType: "json",
type: "POST",
Expand All @@ -44,6 +54,14 @@ solGS.save = {
return save;
},

checkUserStatus: function () {
return jQuery.ajax({
type: "POST",
dataType: "json",
url: "/solgs/check/user/login/",
});
},

saveGebvsArgs: function () {

var analysisArgs = solGS.getSelectionPopArgs();
Expand All @@ -52,80 +70,13 @@ solGS.save = {

return analysisArgs;
},

analysisResultType: function () {
return jQuery('#analysis_type').val();
},

checkUserStatus: function () {
return jQuery.ajax({
type: "POST",
dataType: "json",
url: "/solgs/check/user/login/",
});
},

};

jQuery(document).ready(function () {
solGS.save.checkStoredAnalysis().done(function (res) {
if (res.analysis_id) {
jQuery("#save_gebvs").hide();
var link = '<a href="/analyses/' + res.analysis_id + '">View stored GEBVs</a>';
jQuery("#gebvs_output").append(link);
}
});

jQuery("#save_gebvs").click(function () {
jQuery("#gebvs_output .multi-spinner-container").show();
jQuery("#gebvs_save_message")
.html("Please wait...saving the GEBVs may take a few minutes.")
.show();
jQuery("#save_gebvs").hide();

solGS.save.checkUserStatus().done(function (res) {
if (!res.loggedin) {
solGS.submitJob.loginAlert();
} else {
}
});

solGS.save.checkUserStatus().fail(function () {
solGS.alertMessage("Error occured checking for user status");
});

solGS.save.getResultDetails().done(function (res) {

if (res.error) {
jQuery("#gebvs_output .multi-spinner-container").hide();
jQuery("#gebvs_save_message")
.html(res.error + ". The logged info may not exist for the result.")
.show()
.fadeOut(50000);

jQuery("#save_gebvs").show();
} else {
var save = solGS.save.saveGebvs(res.analysis_details);

save.done(function (res) {
jQuery("#gebvs_output .multi-spinner-container").hide();
if (res.error) {
jQuery("#gebvs_save_message").html(res.error).show().fadeOut(50000);

jQuery("#save_gebvs").show();
} else {
jQuery("#gebvs_save_message").hide();

var link = '<a href="/analyses/' + res.analysis_id + '">View stored GEBVs</a>';
jQuery("#gebvs_output").append(link);
}
});

save.fail(function (res) {
jQuery("#gebvs_output .multi-spinner-container").hide();
jQuery("#save_gebvs").show();
jQuery("#gebvs_save_message").html(res.error).show().fadeOut(50000);
});
}
});
});
});
4 changes: 2 additions & 2 deletions js/source/legacy/solGS/anova.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jQuery(document).ready(function () {
var traitId = jQuery("#anova_selected_trait_id").val();
if (traitId) {
jQuery(runDiv).hide();
solGS.anova.showMessage("Please wait...Querying the database for trait data...");
solGS.anova.showMessage("Please wait...querying the database for the trait data...");
jQuery(`${canvas} .multi-spinner-container`).show();

solGS.anova.queryPhenoData(traitId).done(function (queryRes) {
Expand All @@ -187,7 +187,7 @@ jQuery(document).ready(function () {
} else {
var traitsAbbrs = queryRes.traits_abbrs;
traitsAbbrs = JSON.parse(traitsAbbrs);
solGS.anova.showMessage("Validated trait data...Now running ANOVA...");
solGS.anova.showMessage("Validated trait data...now running ANOVA...");

solGS.anova
.runAnovaAnalysis(traitsAbbrs)
Expand Down
2 changes: 1 addition & 1 deletion js/source/legacy/solGS/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ jQuery(document).ready(function () {

solGS.cluster.displayClusterPopsTable(tableId, clusterPopsRows)

jQuery("#add_new_pops").show();
jQuery("#create_new_list_dataset").show();

}
});
2 changes: 1 addition & 1 deletion js/source/legacy/solGS/correlation.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ jQuery(document).ready(function () {

solGS.correlation.displayCorrPopsTable(tableId, corrPopsRows);

jQuery("#add_new_pops").show();
jQuery("#create_new_list_dataset").show();

}
});
Expand Down
65 changes: 65 additions & 0 deletions js/source/legacy/solGS/gebvsSave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
jQuery(document).ready(function () {
var analysisArgs = solGS.save.saveGebvsArgs();
solGS.save.checkStoredAnalysis(analysisArgs).done(function (res) {
if (res.analysis_id) {
jQuery("#save_gebvs").hide();
var link = '<a href="/analyses/' + res.analysis_id + '">View stored GEBVs</a>';
jQuery("#gebvs_output").append(link);
}
});

jQuery("#save_gebvs").click(function () {
jQuery("#gebvs_output .multi-spinner-container").show();
jQuery("#gebvs_save_message")
.html("Please wait...saving the GEBVs may take a few minutes.")
.show();
jQuery("#save_gebvs").hide();

solGS.save.checkUserStatus().done(function (res) {
if (!res.loggedin) {
solGS.submitJob.loginAlert();
} else {
}
});

solGS.save.checkUserStatus().fail(function () {
solGS.alertMessage("Error occured checking for user status");
});

solGS.save.getGebvsResultDetails(analysisArgs).done(function (res) {

if (res.error) {
jQuery("#gebvs_output .multi-spinner-container").hide();
jQuery("#gebvs_save_message")
.html(res.error + ". The logged info may not exist for the result.")
.show()
.fadeOut(50000);

jQuery("#save_gebvs").show();
} else {
var save = solGS.save.storeAnalysisResults(res.analysis_details);

save.done(function (res) {
jQuery("#gebvs_output .multi-spinner-container").hide();
if (res.error) {
jQuery("#gebvs_save_message").html(res.error).show().fadeOut(50000);

jQuery("#save_gebvs").show();
} else {
jQuery("#gebvs_save_message").hide();

var link = '<a href="/analyses/' + res.analysis_id + '">View stored GEBVs</a>';
jQuery("#gebvs_output").append(link);
}
});

save.fail(function (res) {
jQuery("#gebvs_output .multi-spinner-container").hide();
jQuery("#save_gebvs").show();
jQuery("#gebvs_save_message").html(res.error).show().fadeOut(50000);
});
}
});
});
});

2 changes: 1 addition & 1 deletion js/source/legacy/solGS/kinship.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,6 @@ jQuery(document).ready(function () {
var kinshipPopsRows = solGS.kinship.getKinshipPopsRows(kinshipPops);

solGS.kinship.displayKinshipPopsTable(tableId, kinshipPopsRows);
jQuery("#add_new_pops").show();
jQuery("#create_new_list_dataset").show();
}
});
2 changes: 1 addition & 1 deletion js/source/legacy/solGS/listTypeSelectionPopulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,6 @@ jQuery(document).ready(function () {

jQuery("#lists_datasets_message").hide();
jQuery("#lists_datasets_progress .multi-spinner-container").hide();
jQuery("#add_new_pops").show();
jQuery("#create_new_list_dataset").show();

});
2 changes: 1 addition & 1 deletion js/source/legacy/solGS/listTypeTrainingPopulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,6 @@ jQuery(document).ready(function () {

jQuery("#lists_datasets_message").hide();
jQuery("#lists_datasets_progress .multi-spinner-container").hide();
jQuery("#add_new_pops").show();
jQuery("#create_new_list_dataset").show();

});
Loading
Loading