-
Notifications
You must be signed in to change notification settings - Fork 32
sorted all menus #545
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
base: master
Are you sure you want to change the base?
sorted all menus #545
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2712,7 +2712,7 @@ define([ | |
| }; | ||
|
|
||
| /** | ||
| * Returns a list of sample categories. | ||
| * Returns a sorted list of sample categories. | ||
| * | ||
| * If this.isCommunityPlot is false (no table / sample metadata were | ||
| * provided), this just returns []. | ||
|
|
@@ -2721,7 +2721,7 @@ define([ | |
| */ | ||
| Empress.prototype.getSampleCategories = function () { | ||
| if (this.isCommunityPlot) { | ||
| return this._biom.getSampleCategories(); | ||
| return util.naturalSort(this._biom.getSampleCategories()); | ||
| } else { | ||
| return []; | ||
| } | ||
|
|
@@ -2849,12 +2849,12 @@ define([ | |
| }; | ||
|
|
||
| /** | ||
| * Returns an array of feature metadata column names. | ||
| * Returns a sorted list of feature metadata column names. | ||
| * | ||
| * @return {Array} | ||
| */ | ||
| Empress.prototype.getFeatureMetadataCategories = function () { | ||
| return this._featureMetadataColumns; | ||
| return util.naturalSort(this._featureMetadataColumns); | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -3792,5 +3792,39 @@ define([ | |
| this.redrawBarPlotsToMatchLayout(); | ||
| }; | ||
|
|
||
| /** | ||
| * Returns the col variable value for the node. | ||
| * | ||
| * @param {Number} node Postorder position of a node in the tree. | ||
| * @param {String} col The name of the feature metadata column. | ||
|
kwcantrell marked this conversation as resolved.
Outdated
|
||
| * | ||
| * @return {String} The col variable value for the node or undefined if | ||
| * no value exists. | ||
| */ | ||
| Empress.prototype.getNodeFeatureMetadataValue = function (node, col) { | ||
| var colIndx = _.indexOf(this._featureMetadataColumns, col); | ||
| if (_.has(this._tipMetadata, node)) { | ||
| return this._tipMetadata[node][colIndx]; | ||
| } | ||
| if (_.has(this._intMetadata, node)) { | ||
| return this._intMetadata[node][colIndx]; | ||
| } | ||
| return undefined; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, should this ever happen in practice? At least in the context of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can throw an error. I choose to return undefined in case the calling function wants to do something special in situations where no metadata exists (which I guess can also be handled by a try catch block). |
||
| }; | ||
|
|
||
| /** | ||
| * Checks to see if node has feature metadata. | ||
|
kwcantrell marked this conversation as resolved.
Outdated
|
||
| * | ||
| * @param {Number} node Postorder position of a node in the tree. | ||
| * | ||
| * @return true if node has feature metadata else false. | ||
|
kwcantrell marked this conversation as resolved.
Outdated
|
||
| */ | ||
| Empress.prototype.hasFeatureMetadata = function (node) { | ||
| if (_.has(this._tipMetadata, node) || _.has(this._intMetadata, node)) { | ||
| return true; | ||
| } | ||
| return false; | ||
|
kwcantrell marked this conversation as resolved.
Outdated
|
||
| }; | ||
|
|
||
| return Empress; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,23 +288,17 @@ define(["underscore", "util"], function (_, util) { | |
| ) { | ||
| if (this.hasFeatureMetadata) { | ||
| this.fmTable.innerHTML = ""; | ||
| var mdObj; | ||
| if (tipOrInt === "tip") { | ||
| mdObj = this.empress._tipMetadata; | ||
| } else if (tipOrInt === "int") { | ||
| mdObj = this.empress._intMetadata; | ||
| } else { | ||
| throw new Error("Invalid tipOrInt value: " + tipOrInt); | ||
| } | ||
| if (_.has(mdObj, nodeName)) { | ||
| if (this.empress.hasFeatureMetadata(nodeName)) { | ||
| var headerRow = this.fmTable.insertRow(-1); | ||
|
Comment on lines
299
to
292
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't look like the modified code considers
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, Assuming I am not looking over anything, I'll remove |
||
| var featureRow = this.fmTable.insertRow(-1); | ||
| for (var x = 0; x < this.fmCols.length; x++) { | ||
| var colName = this.fmCols[x]; | ||
| for (var col of this.fmCols) { | ||
| var colCell = headerRow.insertCell(-1); | ||
| colCell.innerHTML = "<strong>" + colName + "</strong>"; | ||
| colCell.innerHTML = "<strong>" + col + "</strong>"; | ||
| var dataCell = featureRow.insertCell(-1); | ||
| dataCell.innerHTML = mdObj[nodeName][x]; | ||
| dataCell.innerHTML = this.empress.getNodeFeatureMetadataValue( | ||
| nodeName, | ||
| col | ||
| ); | ||
| } | ||
| show(this.fmTable); | ||
| hide(this.fmNoDataNote); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.