-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow adding pre built numberic dicterm cluster #2580
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { NumericModes } from '#shared/terms.js' | ||
|
||
export function makeChartBtnMenu(holder, chartsInstance) { | ||
/* | ||
holder: the holder in the tooltip | ||
chartsInstance: MassCharts instance | ||
termdbConfig is accessible at chartsInstance.state.termdbConfig{} | ||
mass option is accessible at chartsInstance.app.opts{} | ||
*/ | ||
chartsInstance.dom.tip.clear() | ||
const menuDiv = holder.append('div') | ||
if (chartsInstance.state.termdbConfig.numericDictTermClusterPlots) { | ||
for (const plot of chartsInstance.state.termdbConfig.numericDictTermClusterPlots) { | ||
/* plot: | ||
{ | ||
name=str | ||
} | ||
*/ | ||
menuDiv | ||
.append('div') | ||
.attr('class', 'sja_menuoption sja_sharp_border') | ||
.text(plot.name) | ||
.on('click', async () => { | ||
chartsInstance.dom.tip.hide() | ||
const config = await chartsInstance.app.vocabApi.getNumericDictTermClusterByName(plot.name) | ||
chartsInstance.app.dispatch({ | ||
type: 'plot_create', | ||
config | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
const chart = { | ||
//use the app name defined in dataset file | ||
label: chartsInstance.state.termdbConfig.numericDictTermCluster?.appName || 'Numeric Dictionary Term cluster', | ||
chartType: 'numericDictTermCluster', | ||
clickTo: self.showTree_selectlst, | ||
usecase: { | ||
target: 'numericDictTermCluster', | ||
detail: { exclude: chartsInstance.state.termdbConfig.numericDictTermCluster?.exclude } | ||
}, | ||
updateActionBySelectedTerms: (action, termlst) => { | ||
const twlst = termlst.map(term => ({ | ||
term: structuredClone(term), | ||
q: { mode: NumericModes.continuous } | ||
})) | ||
if (twlst.length == 1) { | ||
// violin | ||
action.config.chartType = 'summary' | ||
action.config.term = twlst[0] | ||
return | ||
} | ||
if (twlst.length == 2) { | ||
// scatter | ||
action.config.chartType = 'summary' | ||
action.config.term = twlst[0] | ||
action.config.term2 = twlst[1] | ||
return | ||
} | ||
// 3 or more terms, launch clustering | ||
action.config.chartType = 'hierCluster' | ||
action.config.dataType = 'numericDictTerm' | ||
action.config.termgroups = [ | ||
{ | ||
name: | ||
chartsInstance.state.termdbConfig.numericDictTermCluster?.settings?.termGroupName || | ||
'Numercic Dictionary Term Cluster', | ||
lst: twlst, | ||
type: 'hierCluster' | ||
} | ||
] | ||
} | ||
} | ||
chartsInstance.showTree_selectlst(chart) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
|
||
Features: | ||
- numericDictTermCluster: allows adding pre-built numericDictTermCluster plots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1028,10 +1028,23 @@ type MatrixPlotsEntry = { | |
getConfig?: (f: any) => void | ||
} | ||
|
||
type NumericDictTermClusterPlotsEntry = { | ||
name: string | ||
file: string | ||
settings?: { | ||
[key: string]: any | ||
} | ||
getConfig?: (f: any) => void | ||
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. what's purpose of getConfig()? 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. just added comment |
||
} | ||
|
||
type MatrixPlots = { | ||
plots: MatrixPlotsEntry[] | ||
} | ||
|
||
type NumericDictTermClusterPlots = { | ||
plots: NumericDictTermClusterPlotsEntry[] | ||
} | ||
|
||
type AllowCaseDetails = { | ||
sample_id_key: string | ||
terms: string[] | ||
|
@@ -1271,6 +1284,7 @@ export type Cohort = { | |
defaultChartType?: string | ||
massNav?: MassNav | ||
matrixplots?: MatrixPlots | ||
numericDictTermClusterPlots?: NumericDictTermClusterPlots | ||
mutationset?: MutationSet[] | ||
renamedChartTypes?: { singleCellPlot?: string; sampleScatter?: string } | ||
scatterplots?: Scatterplots | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please define type def for
ds.cohort.numericDictTermClusterPlots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks just added