From e9e1c6bcec21d606c7f8267870f2d9d71d59c2cd Mon Sep 17 00:00:00 2001 From: Marco Brandizi Date: Fri, 27 Oct 2023 14:58:33 +0200 Subject: [PATCH] Migrating dev doc about gene table filtering. --- .../html/featureDocs/gene-table-filter.md | 111 ------------------ .../html/javascript/genes-table-filtering.js | 8 ++ 2 files changed, 8 insertions(+), 111 deletions(-) delete mode 100644 client-base/src/main/webapp/html/featureDocs/gene-table-filter.md diff --git a/client-base/src/main/webapp/html/featureDocs/gene-table-filter.md b/client-base/src/main/webapp/html/featureDocs/gene-table-filter.md deleted file mode 100644 index f0f71e4d1..000000000 --- a/client-base/src/main/webapp/html/featureDocs/gene-table-filter.md +++ /dev/null @@ -1,111 +0,0 @@ - -# Genetable filter doc - -This documentation aims to show you how Knetminer genes table filters work. It showcases the code structure in `gene-table-filter.js`. - -## genes-table-filtering.js -This file contains the JavaScript scripts that handle the knetscore and graph distance filters present in the knetminer's gene view. It houses three Objects: `knetscoreFilter`, `graphDistanceFilter` and `geneTableFilterMgr`, and can be found [here][10]. - -`KnetScoreFilter` object handles the functionalities associated with gene view knetscore filter. - -```javascript -// Detects min and max knetscore values from genetable data. -detectRange (tableData) -{ - ... -} - -// Sets min & max range values after both values are detected in detectRange() above. -setRangeValue(value, rangeType) -{ - ... -} - -// Handles on change event triggered when left thumb of gene view slider is triggered. -// Takes min input HTML object as paramter -handleLeftThumb(minElement) -{ - ... -} - -// Handles on change event triggered when right thumb of gene view slider is triggered. -handleRightThumb(maxElement) -{ - ... -} - -//Method takes input value and direction (max or min) to show slider coverage. -setScorePosition (inputValue, direction) -{ - ... -} - -// Renders knetscore slider to knetminer UI. -renderUi() -{ - ... -}; -``` - -`graphDistanceFilter` object houses methods handling functionalities associated with gene view graph distance filter. - -```javascript - // MaxNumber property used for comparison reasons to check for maximum distance within genetable data. - maxNumber : -Infinity - - // Sets the maximum graph distance value from genetable data. - detectRange(tableData) - { - ... - } - // Creates HTML select element based maximum graph distance. - createSelectElement(){ - ... - } - // Renders graph distance drop-down element to knetminer UI. - renderUi() - { - ... - } - -``` - -`geneTableFilterMgr` object handles management of graph-distance and knetscore filters. - -```javascript -// TableData property used to store the genetable data. -tableData:[] - -// Saves table data -setup(data) -{ - ... -} -// Method renders graph-distance and knetscore filters to UI and called in setup() above. -renderFiltersToUi() -{ - ... -} - -// Method handle events triggered by change to graph distance and Knetscore input values. -filterByDistanceAndScore(event) -{ - ... -} - -// Method renders filtered table, called above. -renderFilteredTable(table) -{ - ... -} - -// Toggle visibility of gene view table body based on length filtered table -// When the filtered table length is less than one, the table body is not visible. -// Called in filterByDistanceAndScore(). -toggleTableState(dataLength){ - ... -} -``` - -[10]: https://github.com/Rothamsted/knetminer/blob/master/client-base/src/main/webapp/html/javascript/genes-table-filtering.js#L133 - diff --git a/client-base/src/main/webapp/html/javascript/genes-table-filtering.js b/client-base/src/main/webapp/html/javascript/genes-table-filtering.js index 5bc1481df..e31c711a5 100644 --- a/client-base/src/main/webapp/html/javascript/genes-table-filtering.js +++ b/client-base/src/main/webapp/html/javascript/genes-table-filtering.js @@ -1,3 +1,11 @@ +/** + * UI filters for the gene table. + * + * The code in this file is documented here: + * https://github.com/Rothamsted/knetminer/wiki/%5BDevDoc%5D-Details-about-the-implementation-of-Gene-Evidence-table-UI-filters + * + * Please, keep the two aligned. + */ // Knetscore Filter Element let knetScoreFilter = {