Skip to content
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

call blitzgseas geneset libraries #2739

Merged
merged 10 commits into from
Feb 10, 2025
2 changes: 1 addition & 1 deletion client/plots/DEanalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ add:
value: sample_size1
},
{
label: self.config.samplelst.groups[1].name + ' sample size (treatment group)',
label: self.config.samplelst.groups[1].name + ' sample size (case group)',
value: sample_size2
}
]
Expand Down
3 changes: 2 additions & 1 deletion client/plots/geneORA.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getCompInit, copyMerge } from '#rx'
import { Menu } from '../dom/menu'
import { newSandboxDiv } from '../dom/sandbox.ts'
import { select, pointer } from 'd3-selection'
import { downloadTable } from '../dom/table'
import { roundValueAuto } from '#shared/roundValue.js'

const hlcolor = '#ffa200'
Expand Down Expand Up @@ -114,7 +115,7 @@ class geneORA {
})
}
this.components.controls.on('downloadClick.geneORA', () => {
downloadTable(this.table_rows, this.table_cols)
downloadTable(this.gene_ora_table_rows, this.gene_ora_table_cols)
})
}
getState(appState) {
Expand Down
57 changes: 36 additions & 21 deletions client/plots/gsea.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,11 @@ import { controlsInit } from './controls'
import { getCompInit, copyMerge } from '#rx'
import { Menu } from '../dom/menu'
import { scaleLog, scaleLinear } from 'd3-scale'
import { downloadTable } from '../dom/table'
import { roundValueAuto } from '#shared/roundValue.js'

const tip = new Menu()

// table columns showing analysis results for each gene set
const gsea_table_cols = [
{ label: 'Pathway name' },
{ label: 'enrichment score' },
{ label: 'normalized enrichment score' },
{ label: 'Geneset size' },
{ label: 'pvalue' },
{ label: 'sidak' },
{ label: 'FDR' },
{ label: 'Leading edge' }
]

class gsea {
constructor() {
this.type = 'gsea'
Expand Down Expand Up @@ -53,7 +42,7 @@ class gsea {
this.dom.controlsDiv.selectAll('*').remove()
const inputs = [
{
label: 'P-value filter cutoff (linear scale)',
label: 'P-value Filter Cutoff (Linear Scale)',
type: 'number',
chartType: 'gsea',
settingsKey: 'pvalue',
Expand All @@ -62,18 +51,18 @@ class gsea {
max: 1
},
{
label: 'P-value filter type',
label: 'P-value Filter Type',
type: 'radio',
chartType: 'gsea',
settingsKey: 'adjusted_original_pvalue',
title: 'Toggle between original and adjusted pvalues for volcano plot',
options: [
{ label: 'adjusted', value: 'adjusted' },
{ label: 'original', value: 'original' }
{ label: 'Adjusted', value: 'adjusted' },
{ label: 'Original', value: 'original' }
]
},
{
label: 'Gene set size filter cutoff',
label: 'Gene Set Size Filter Cutoff',
type: 'number',
chartType: 'gsea',
settingsKey: 'gene_set_size_cutoff',
Expand All @@ -82,7 +71,7 @@ class gsea {
max: 20000
},
{
label: 'Filter non-coding genes',
label: 'Filter Non-coding Genes',
type: 'checkbox',
chartType: 'gsea',
settingsKey: 'filter_non_coding_genes',
Expand All @@ -92,7 +81,7 @@ class gsea {
]

const geneSet = {
label: 'Gene set group',
label: 'Gene Set Group',
type: 'dropdown',
chartType: 'gsea',
settingsKey: 'pathway',
Expand All @@ -104,9 +93,23 @@ class gsea {
{ label: 'CC: subset of GO', value: 'CC: subset of GO' },
{ label: 'WikiPathways subset of CP', value: 'WikiPathways subset of CP' },
{ label: 'REACTOME subset of CP', value: 'REACTOME subset of CP' },
/* QUICK FIX
geneset name ending in "--blitzgsea" signals to use built-in genesets but not msigdb
later a proper fix is to add a radio toggle of Blitzgsea versus MSigDB, and do not use such hardcode
*/
{ label: 'H: hallmark gene sets', value: 'H: hallmark gene sets' }
]
}

// Now blitzgsea geneSets are inside serverconfig flag
if (JSON.parse(sessionStorage.getItem('optionalFeatures')).gsea_test == true) {
geneSet.options.push(
{ label: 'REACTOME (blitzgsea)', value: 'REACTOME--blitzgsea' },
{ label: 'KEGG (blitzgsea)', value: 'KEGG--blitzgsea' },
{ label: 'WikiPathways (blitzgsea)', value: 'WikiPathways--blitzgsea' }
)
}

if (!this.settings.pathway) {
geneSet.options.unshift({ label: '-', value: '-' })
this.settings.pathway = '-'
Expand All @@ -122,7 +125,7 @@ class gsea {
})
}
this.components.controls.on('downloadClick.gsea', () => {
downloadTable(this.table_rows, this.table_cols)
downloadTable(this.gsea_table_rows, this.gsea_table_cols)
})
}
getState(appState) {
Expand Down Expand Up @@ -194,6 +197,7 @@ add:

// Generating the table
self.gsea_table_rows = []
Object.keys(output.data).sort((i, j) => Number(i.fdr) - Number(j.fdr)) // Sorting pathways in ascending order of FDR
for (const pathway_name of Object.keys(output.data)) {
const pathway = output.data[pathway_name]
if (
Expand Down Expand Up @@ -241,8 +245,19 @@ add:

self.dom.tableDiv.selectAll('*').remove()
const d_gsea = self.dom.tableDiv.append('div')
// table columns showing analysis results for each gene set
self.gsea_table_cols = [
{ label: 'Geneset' },
{ label: 'Enrichment Score' },
{ label: 'Normalized Enrichment Score' },
{ label: 'Geneset Size' },
{ label: 'P value' },
{ label: 'Sidak' },
{ label: 'FDR' },
{ label: 'Leading Edge' }
]
renderTable({
columns: gsea_table_cols,
columns: self.gsea_table_cols,
rows: self.gsea_table_rows,
div: d_gsea,
showLines: true,
Expand Down
Loading