From 2cc10903967cf819e373e0fc5a5afc227254c62b Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Mon, 30 Jan 2023 10:36:39 -0500 Subject: [PATCH 01/16] Added basic list of phylogeny nodes to phylogeny view. --- src/components/phylogeny/PhylogenyView.vue | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index 0e121543..48450723 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -101,13 +101,13 @@ + + +
+
+ Taxonomic units in this phylogeny +
+
+ + + + +
+
@@ -159,6 +176,7 @@ import { parse as parseNewick } from 'newick-js'; import ModifiedCard from '../cards/ModifiedCard.vue'; import Phylotree from './Phylotree.vue'; import Citation from '../citations/Citation.vue'; +import {PhylogenyWrapper} from "@phyloref/phyx"; export default { name: 'PhylogenyView', @@ -266,6 +284,15 @@ export default { return errors; }, + taxonomicUnitsTable() { + // Create a table of taxonomic units found in this phylogeny. + const terminalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('terminal').sort(); + const internalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('internal').sort(); + + return terminalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Terminal node' })).concat( + internalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Internal node' })), + ); + }, ...mapState({ currentPhyx: state => state.phyx.currentPhyx, loadedPhyx: state => state.phyx.loadedPhyx, From 593aeae4c9a74fa2c6d72739ebb22453555519ba Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 8 Mar 2023 02:51:32 -0500 Subject: [PATCH 02/16] Add description to taxon unit box. --- src/components/phylogeny/PhylogenyView.vue | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index 48450723..e5b3f09f 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -151,15 +151,22 @@ Taxonomic units in this phylogeny
- - - - + To add additional taxonomic units to this list, please label the corresponding node on the phylogeny.
+ + + + @@ -173,10 +180,10 @@ import { has } from 'lodash'; import { mapState } from 'vuex'; import { parse as parseNewick } from 'newick-js'; +import { PhylogenyWrapper } from '@phyloref/phyx'; import ModifiedCard from '../cards/ModifiedCard.vue'; import Phylotree from './Phylotree.vue'; import Citation from '../citations/Citation.vue'; -import {PhylogenyWrapper} from "@phyloref/phyx"; export default { name: 'PhylogenyView', @@ -190,7 +197,7 @@ export default { methods: { deleteThisPhylogeny() { // Delete this phylogeny, and unset the selected phylogeny so we return to the summary page. - if(confirm('Are you sure you wish to delete this phylogeny? This cannot be undone!')) { + if (confirm('Are you sure you wish to delete this phylogeny? This cannot be undone!')) { this.$store.commit('deletePhylogeny', { phylogeny: this.selectedPhylogeny, }); From 0e5f26501bd6ec2da924d5abf0878503f956b551 Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 10 May 2023 01:51:35 -0400 Subject: [PATCH 03/16] Added functionality to retrieve list of taxonomic units. --- src/components/phylogeny/PhylogenyView.vue | 33 ++++++++++++++++++++-- src/store/modules/phylogeny.js | 12 ++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index e5b3f09f..50aad5b8 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -153,10 +153,12 @@
To add additional taxonomic units to this list, please label the corresponding node on the phylogeny.
+ @@ -166,6 +168,27 @@ + + + @@ -296,8 +319,14 @@ export default { const terminalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('terminal').sort(); const internalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('internal').sort(); - return terminalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Terminal node' })).concat( - internalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Internal node' })), + const hasExplicitTaxonomicUnitsForPhylogenyNode = nodeLabel => ( + this.$store.getters + .getExplicitTaxonomicUnitsForPhylogenyNode(this.selectedPhylogeny, nodeLabel) + .length > 0 + ); + + return terminalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Terminal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })).concat( + internalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Internal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })), ); }, ...mapState({ diff --git a/src/store/modules/phylogeny.js b/src/store/modules/phylogeny.js index cc007d28..3da8710f 100644 --- a/src/store/modules/phylogeny.js +++ b/src/store/modules/phylogeny.js @@ -4,8 +4,20 @@ import Vue from 'vue'; import { has, keys, cloneDeep } from 'lodash'; +import {PhylogenyWrapper} from "@phyloref/phyx"; export default { + getters: { + getExplicitTaxonomicUnitsForPhylogenyNode: () => (phylogeny, nodeLabel) => { + // Return true if this node label in this phylogeny has a + if (has(phylogeny, 'additionalNodeProperties') + && has(phylogeny.additionalNodeProperties, nodeLabel) + && has(phylogeny.additionalNodeProperties[nodeLabel], 'representsTaxonomicUnits')) { + return phylogeny.additionalNodeProperties[nodeLabel].representsTaxonomicUnits; + } + return []; + }, + }, mutations: { setPhylogenyProps(state, payload) { if (!has(payload, 'phylogeny')) { From 4e18d09f95a64da03b9ae0eee94635a220e05a2b Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 27 Sep 2023 09:19:23 -0400 Subject: [PATCH 04/16] Added additionalNodeProperties accessing code from PR #203. --- src/store/modules/phylogeny.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/store/modules/phylogeny.js b/src/store/modules/phylogeny.js index 3da8710f..4e0665fe 100644 --- a/src/store/modules/phylogeny.js +++ b/src/store/modules/phylogeny.js @@ -19,6 +19,23 @@ export default { }, }, mutations: { + /** Set the additionalNodeProperties for a particular node label on a particular phylogeny. */ + setPhylogenyAdditionalProps(state, payload) { + if (!has(payload, 'phylogeny')) { + throw new Error('setPhylogenyAdditionalProps needs a phylogeny to modify using the "phylogeny" argument'); + } + if (!has(payload, 'nodeLabel')) { + throw new Error('setPhylogenyAdditionalProps needs a node label to modify using the "nodeLabel" argument'); + } + if (!has(payload, 'content')) { + throw new Error('setPhylogenyAdditionalProps needs content to set using the "content" argument'); + } + + if (!has(payload.phylogeny, 'additionalNodeProperties')) + Vue.set(payload.phylogeny, 'additionalNodeProperties', {}); + + Vue.set(payload.phylogeny.additionalNodeProperties, payload.nodeLabel, payload.content); + }, setPhylogenyProps(state, payload) { if (!has(payload, 'phylogeny')) { throw new Error('setPhylogenyProps needs a phylogeny to modify using the "phylogeny" argument'); From 669165ff22904fcb879d93784ac458a53a2f55db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 22:36:48 +0000 Subject: [PATCH 05/16] Bump postcss from 8.4.24 to 8.4.31 Bumps [postcss](https://github.com/postcss/postcss) from 8.4.24 to 8.4.31. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.4.24...8.4.31) --- updated-dependencies: - dependency-name: postcss dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f4201aa3..453e48e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3021,9 +3021,9 @@ } }, "node_modules/postcss": { - "version": "8.4.24", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", - "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", From 7f10fd8fb35432095dc0fdc9c3c74cd3230d0c21 Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 11 Oct 2023 00:27:32 -0400 Subject: [PATCH 06/16] Rewrote specifiers to support phylogeny tunits as well. --- src/components/specifiers/Specifier.vue | 87 ++++++++++++++++++++----- src/store/modules/phylogeny.js | 72 +++++++++++++++++++- 2 files changed, 143 insertions(+), 16 deletions(-) diff --git a/src/components/specifiers/Specifier.vue b/src/components/specifiers/Specifier.vue index 15215e24..11067648 100644 --- a/src/components/specifiers/Specifier.vue +++ b/src/components/specifiers/Specifier.vue @@ -97,8 +97,8 @@ Specifier details - -
+ +
+ + -
@@ -207,27 +223,17 @@ import { PhylogenyWrapper } from '@phyloref/phyx'; import ModifiedCard from '../cards/ModifiedCard.vue'; import Phylotree from './Phylotree.vue'; import Citation from '../citations/Citation.vue'; +import Specifier from "@/components/specifiers/Specifier.vue"; export default { name: 'PhylogenyView', - components: { ModifiedCard, Phylotree, Citation }, + components: {Specifier, ModifiedCard, Phylotree, Citation }, data() { return { // Errors in the phylogenyId field. phylogenyIdError: undefined, }; }, - methods: { - deleteThisPhylogeny() { - // Delete this phylogeny, and unset the selected phylogeny so we return to the summary page. - if (confirm('Are you sure you wish to delete this phylogeny? This cannot be undone!')) { - this.$store.commit('deletePhylogeny', { - phylogeny: this.selectedPhylogeny, - }); - this.$store.commit('changeDisplay', {}); - } - }, - }, computed: { /* * The following properties allow you to get or set the phylogeny label, @@ -314,16 +320,19 @@ export default { return errors; }, + terminalLabelsSorted() { + return new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('terminal').sort(); + }, + internalLabelsSorted() { + return new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('internal').sort(); + }, taxonomicUnitsTable() { // Create a table of taxonomic units found in this phylogeny. - const terminalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('terminal').sort(); - const internalLabels = new PhylogenyWrapper(this.selectedPhylogeny).getNodeLabels('internal').sort(); + const terminalLabels = this.terminalLabelsSorted; + const internalLabels = this.internalLabelsSorted; - const hasExplicitTaxonomicUnitsForPhylogenyNode = nodeLabel => ( - this.$store.getters - .getExplicitTaxonomicUnitsForPhylogenyNode(this.selectedPhylogeny, nodeLabel) - .length > 0 - ); + const hasExplicitTaxonomicUnitsForPhylogenyNode = (nodeLabel) => + this.getTUnitsForLabel(nodeLabel).length > 0; return terminalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Terminal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })).concat( internalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Internal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })), @@ -335,5 +344,20 @@ export default { selectedPhylogeny: state => state.ui.display.phylogeny, }), }, + methods: { + deleteThisPhylogeny() { + // Delete this phylogeny, and unset the selected phylogeny so we return to the summary page. + if (confirm('Are you sure you wish to delete this phylogeny? This cannot be undone!')) { + this.$store.commit('deletePhylogeny', { + phylogeny: this.selectedPhylogeny, + }); + this.$store.commit('changeDisplay', {}); + } + }, + getTUnitsForLabel(nodeLabel) { + return this.$store.getters + .getExplicitTaxonomicUnitsForPhylogenyNode(this.selectedPhylogeny, nodeLabel); + }, + }, }; From ff549aad058c2fb593f270abbbf069917be98231 Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 11 Oct 2023 01:38:36 -0400 Subject: [PATCH 08/16] Fixed some bugs in the code. --- src/components/phylogeny/PhylogenyView.vue | 7 ++++--- src/components/specifiers/Specifier.vue | 4 ++-- src/store/modules/phylogeny.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index 16e3bf3e..373ab2e8 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -193,10 +193,11 @@ class="mb-12" > diff --git a/src/components/specifiers/Specifier.vue b/src/components/specifiers/Specifier.vue index 11067648..e630f6ac 100644 --- a/src/components/specifiers/Specifier.vue +++ b/src/components/specifiers/Specifier.vue @@ -695,7 +695,7 @@ export default { return; if (this.phyloref) { - console.log('Updating specifier in ', phyloref, ' as ', result, ' differs from ', this.remoteSpecifier); + console.log('Updating specifier in ', this.phyloref, ' as ', result, ' differs from ', this.remoteSpecifier); this.$store.commit('setSpecifierProps', { specifier: this.remoteSpecifier, props: result, @@ -718,7 +718,7 @@ export default { tunit_new: result, }); } else { - console.error("Specifier has neither phyloref nor phylogeny/nodeLabel combination: ", data); + console.error("Specifier has neither phyloref nor phylogeny/nodeLabel combination: ", this); } }, }, diff --git a/src/store/modules/phylogeny.js b/src/store/modules/phylogeny.js index ec76d5ae..4f7bf6f0 100644 --- a/src/store/modules/phylogeny.js +++ b/src/store/modules/phylogeny.js @@ -23,7 +23,7 @@ export default { return []; }, areTUnitsIdentical: () => (tunit1, tunit2) => { - return this.areTUnitsIdentical(tunit1, tunit2); + return areTUnitsIdentical(tunit1, tunit2); } }, mutations: { From d8ff184413373d6b3f9cf9c44cb77a46bd1a16da Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 25 Oct 2023 01:05:14 -0600 Subject: [PATCH 09/16] Removed "show details" as users should control this. --- src/components/phylogeny/PhylogenyView.vue | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index 373ab2e8..c4b74916 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -170,7 +170,7 @@ striped hover :items="taxonomicUnitsTable" - :fields="['node_label', 'node_type', 'show_details']" + :fields="['node_label', 'node_type', 'additional_taxonomic_units']" :primary-key="node_label" show-empty > @@ -180,16 +180,12 @@ - @@ -332,12 +324,29 @@ export default { const terminalLabels = this.terminalLabelsSorted; const internalLabels = this.internalLabelsSorted; + const getExplicitTaxonomicUnitsForPhylogenyNode = (nodeLabel) => + this.getTUnitsForLabel(nodeLabel) + const hasExplicitTaxonomicUnitsForPhylogenyNode = (nodeLabel) => this.getTUnitsForLabel(nodeLabel).length > 0; - return terminalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Terminal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })).concat( - internalLabels.map(nodeLabel => ({ node_label: nodeLabel, node_type: 'Internal node', _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel) })), - ); + return terminalLabels + .map((nodeLabel) => ({ + node_label: nodeLabel, + node_type: "Terminal node", + additional_taxonomic_units: + getExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel).length, + _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel), + })) + .concat( + internalLabels.map((nodeLabel) => ({ + node_label: nodeLabel, + node_type: "Internal node", + additional_taxonomic_units: + getExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel).length, + _showDetails: hasExplicitTaxonomicUnitsForPhylogenyNode(nodeLabel), + })) + ); }, ...mapState({ currentPhyx: state => state.phyx.currentPhyx, From a53047510a92cef9dc8378439eeb7079fe208419 Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Wed, 25 Oct 2023 01:10:56 -0600 Subject: [PATCH 10/16] Added "add taxonomic unit" button for every row. --- src/components/phylogeny/PhylogenyView.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/phylogeny/PhylogenyView.vue b/src/components/phylogeny/PhylogenyView.vue index c4b74916..94d5668b 100644 --- a/src/components/phylogeny/PhylogenyView.vue +++ b/src/components/phylogeny/PhylogenyView.vue @@ -181,6 +181,10 @@

No labels found after filtering.

+ +