From 6dd752711b3835ae9e9c6af217d960440b6677db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:20:38 +0000 Subject: [PATCH 1/6] Initial plan From 4f54d1065bc88fc28770872010b329321e855cd6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:24:45 +0000 Subject: [PATCH 2/6] Add algorithm reference data initialization to initTreebase.sql Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- treebase-core/src/main/resources/initTreebase.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/treebase-core/src/main/resources/initTreebase.sql b/treebase-core/src/main/resources/initTreebase.sql index 50778ec58..220764d18 100644 --- a/treebase-core/src/main/resources/initTreebase.sql +++ b/treebase-core/src/main/resources/initTreebase.sql @@ -283,6 +283,18 @@ alter table study alter column study_id restart with 2; commit; -- END Study, StudyStatus, Submission +-- Add algorithm reference data +delete from algorithm; +insert into algorithm (type, algorithm_id, version, description) values +('L', 1, 1, 'maximum likelihood'), +('B', 2, 1, 'bayesian inference'), +('P', 3, 1, 'parsimony'), +('E', 4, 1, 'minimum evolution'), +('J', 5, 1, 'neighbor joining'), +('U', 6, 1, 'UPGMA'); +alter table algorithm alter column algorithm_id restart with 7; +commit; + -- Add indices --CREATE INDEX "TREENODE_TREE_IDX" -- ON "PHYLOTREENODE"("PHYLOTREE_ID") From 52ca4c02c69e7df0321e4dc2daebf228cbb97f9e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:35:26 +0000 Subject: [PATCH 3/6] Add test data initialization in AlgorithmDAOTest setUp Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- .../treebase/dao/study/AlgorithmDAOTest.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java b/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java index 0538c9628..6f8875911 100644 --- a/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java +++ b/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java @@ -7,6 +7,12 @@ import org.cipres.treebase.dao.AbstractDAOTest; import org.cipres.treebase.domain.study.AlgorithmHome; +import org.cipres.treebase.domain.study.BayesianAlgorithm; +import org.cipres.treebase.domain.study.EvolutionAlgorithm; +import org.cipres.treebase.domain.study.JoiningAlgorithm; +import org.cipres.treebase.domain.study.LikelihoodAlgorithm; +import org.cipres.treebase.domain.study.ParsimonyAlgorithm; +import org.cipres.treebase.domain.study.UPGMAAlgorithm; /** * @author madhu @@ -36,6 +42,42 @@ public void setFixture(AlgorithmHome pNewFixture) { mFixture = pNewFixture; } + /** + * Initialize test data before transaction. + */ + @Override + protected void onSetUpBeforeTransaction() throws Exception { + super.onSetUpBeforeTransaction(); + + // Create standard algorithm types for testing + LikelihoodAlgorithm likelihood = new LikelihoodAlgorithm(); + likelihood.setDescription("maximum likelihood"); + + BayesianAlgorithm bayesian = new BayesianAlgorithm(); + bayesian.setDescription("bayesian inference"); + + ParsimonyAlgorithm parsimony = new ParsimonyAlgorithm(); + parsimony.setDescription("parsimony"); + + EvolutionAlgorithm evolution = new EvolutionAlgorithm(); + evolution.setDescription("minimum evolution"); + + JoiningAlgorithm joining = new JoiningAlgorithm(); + joining.setDescription("neighbor joining"); + + UPGMAAlgorithm upgma = new UPGMAAlgorithm(); + upgma.setDescription("UPGMA"); + + // Save to database using hibernateTemplate + hibernateTemplate.save(likelihood); + hibernateTemplate.save(bayesian); + hibernateTemplate.save(parsimony); + hibernateTemplate.save(evolution); + hibernateTemplate.save(joining); + hibernateTemplate.save(upgma); + hibernateTemplate.flush(); + } + /** * Test method for * {@link org.cipres.treebase.dao.study.AlgorithmDAO#findAllUniqueAlgorithmDescriptions()}. From 135053b82eec463cde18d612a0c58680dfc02931 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:47:35 +0000 Subject: [PATCH 4/6] Add patch 0006_add-algorithm-types.sql to database initialization Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- treebase-core/db/schema/init_db_uptodate.pg | 1 + .../db/schema/patches/0006_add-algorithm-types.sql | 13 +++++++++++++ ...6_create-indices.sql => 0007_create-indices.sql} | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 treebase-core/db/schema/patches/0006_add-algorithm-types.sql rename treebase-core/db/schema/patches/{0006_create-indices.sql => 0007_create-indices.sql} (70%) diff --git a/treebase-core/db/schema/init_db_uptodate.pg b/treebase-core/db/schema/init_db_uptodate.pg index 935de9462..338fdd771 100644 --- a/treebase-core/db/schema/init_db_uptodate.pg +++ b/treebase-core/db/schema/init_db_uptodate.pg @@ -9,6 +9,7 @@ \i patches/0003_rename-stepmatrixelement-pk.sql \i patches/0004_create-indexes.sql \i patches/0005_add-taxonabel-tb1legacyid.sql +\i patches/0006_add-algorithm-types.sql diff --git a/treebase-core/db/schema/patches/0006_add-algorithm-types.sql b/treebase-core/db/schema/patches/0006_add-algorithm-types.sql new file mode 100644 index 000000000..d144abbcf --- /dev/null +++ b/treebase-core/db/schema/patches/0006_add-algorithm-types.sql @@ -0,0 +1,13 @@ +insert into versionhistory(patchnumber, patchlabel, patchdescription) + values (6, 'add-algorithm-types', + 'Add standard algorithm types reference data'); + +delete from algorithm; +insert into algorithm (type, algorithm_id, version, description) values +('L', 1, 1, 'maximum likelihood'), +('B', 2, 1, 'bayesian inference'), +('P', 3, 1, 'parsimony'), +('E', 4, 1, 'minimum evolution'), +('J', 5, 1, 'neighbor joining'), +('U', 6, 1, 'UPGMA'); + diff --git a/treebase-core/db/schema/patches/0006_create-indices.sql b/treebase-core/db/schema/patches/0007_create-indices.sql similarity index 70% rename from treebase-core/db/schema/patches/0006_create-indices.sql rename to treebase-core/db/schema/patches/0007_create-indices.sql index 99bc29035..f6cb5cf19 100644 --- a/treebase-core/db/schema/patches/0006_create-indices.sql +++ b/treebase-core/db/schema/patches/0007_create-indices.sql @@ -1,6 +1,6 @@ insert into versionhistory(patchnumber, patchlabel, patchdescription) - values (6, 'create-indices', - 'Create additional indices to improve query performance.'); + values (7, 'create-indices', + 'Create additional indices to improve query performance'); CREATE INDEX discretecharstate_phylochar_id_idx ON discretecharstate USING btree (phylochar_id); CREATE INDEX matrixcolumn_matrix_id_idx ON matrixcolumn USING btree (matrix_id); From ac480260967958bc4f540b49a8dbae8b377af8c1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:48:43 +0000 Subject: [PATCH 5/6] Include patch 0007_create-indices.sql in init_db_uptodate.pg Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- treebase-core/db/schema/init_db_uptodate.pg | 1 + 1 file changed, 1 insertion(+) diff --git a/treebase-core/db/schema/init_db_uptodate.pg b/treebase-core/db/schema/init_db_uptodate.pg index 338fdd771..02b422afb 100644 --- a/treebase-core/db/schema/init_db_uptodate.pg +++ b/treebase-core/db/schema/init_db_uptodate.pg @@ -10,6 +10,7 @@ \i patches/0004_create-indexes.sql \i patches/0005_add-taxonabel-tb1legacyid.sql \i patches/0006_add-algorithm-types.sql +\i patches/0007_create-indices.sql From 0bb40c8e2273950b64e02ec02f17218bad120918 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 22:02:22 +0000 Subject: [PATCH 6/6] Remove redundant onSetUpBeforeTransaction from AlgorithmDAOTest Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com> --- .../treebase/dao/study/AlgorithmDAOTest.java | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java b/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java index 6f8875911..0538c9628 100644 --- a/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java +++ b/treebase-core/src/test/java/org/cipres/treebase/dao/study/AlgorithmDAOTest.java @@ -7,12 +7,6 @@ import org.cipres.treebase.dao.AbstractDAOTest; import org.cipres.treebase.domain.study.AlgorithmHome; -import org.cipres.treebase.domain.study.BayesianAlgorithm; -import org.cipres.treebase.domain.study.EvolutionAlgorithm; -import org.cipres.treebase.domain.study.JoiningAlgorithm; -import org.cipres.treebase.domain.study.LikelihoodAlgorithm; -import org.cipres.treebase.domain.study.ParsimonyAlgorithm; -import org.cipres.treebase.domain.study.UPGMAAlgorithm; /** * @author madhu @@ -42,42 +36,6 @@ public void setFixture(AlgorithmHome pNewFixture) { mFixture = pNewFixture; } - /** - * Initialize test data before transaction. - */ - @Override - protected void onSetUpBeforeTransaction() throws Exception { - super.onSetUpBeforeTransaction(); - - // Create standard algorithm types for testing - LikelihoodAlgorithm likelihood = new LikelihoodAlgorithm(); - likelihood.setDescription("maximum likelihood"); - - BayesianAlgorithm bayesian = new BayesianAlgorithm(); - bayesian.setDescription("bayesian inference"); - - ParsimonyAlgorithm parsimony = new ParsimonyAlgorithm(); - parsimony.setDescription("parsimony"); - - EvolutionAlgorithm evolution = new EvolutionAlgorithm(); - evolution.setDescription("minimum evolution"); - - JoiningAlgorithm joining = new JoiningAlgorithm(); - joining.setDescription("neighbor joining"); - - UPGMAAlgorithm upgma = new UPGMAAlgorithm(); - upgma.setDescription("UPGMA"); - - // Save to database using hibernateTemplate - hibernateTemplate.save(likelihood); - hibernateTemplate.save(bayesian); - hibernateTemplate.save(parsimony); - hibernateTemplate.save(evolution); - hibernateTemplate.save(joining); - hibernateTemplate.save(upgma); - hibernateTemplate.flush(); - } - /** * Test method for * {@link org.cipres.treebase.dao.study.AlgorithmDAO#findAllUniqueAlgorithmDescriptions()}.