diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.html b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.html index b88f662c..bdb7fc11 100644 --- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.html +++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.html @@ -231,6 +231,7 @@

Gene Comparison Tool

{{ subCategoryLabel }}
Gene Comparison Tool
{{ gene.hgnc_symbol || gene.ensembl_gene_id }} - + ({{ gene.uniprotid }})
@@ -441,7 +442,7 @@

Gene Comparison Tool

{{ gene.hgnc_symbol || gene.ensembl_gene_id }} - + ({{ gene.uniprotid }})
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts index faba1600..ace93c52 100644 --- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts +++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts @@ -14,6 +14,8 @@ import { MessageService, SortEvent } from 'primeng/api'; import { Table } from 'primeng/table'; import { Checkbox } from 'primeng/checkbox'; +import * as helpers from './gene-comparison-tool.helpers'; + import { GeneComparisonToolComponent, GeneComparisonToolDetailsPanelComponent, @@ -24,7 +26,7 @@ import { import { ApiService, HelperService } from '../../../../core/services'; import { GeneService } from '../../../../features/genes/services'; import { routes } from '../../../../app.routing'; -import { comparisonGeneMock1, comparisonGeneMock2 } from '../../../../testing'; +import { comparisonGeneEmptyHGNCMock, comparisonGeneMock1, comparisonGeneMock2 } from '../../../../testing'; const DEFAULT_SIGNIFICANCE_THRESHOLD = 0.05; @@ -506,5 +508,15 @@ describe('Component: GeneComparisonToolComponent', () => { expectSignificanceThresholdIsApplied(newValue); })); + + it('should have a label for SRM popup', () => { + const label = helpers.getGeneLabelForSRM(comparisonGeneMock1); + const expected = 'MSN - ENSG00000147065'; + expect(label).toBe(expected); + + const label2 = helpers.getGeneLabelForSRM(comparisonGeneEmptyHGNCMock); + const expected2 = 'ENSG00000147065'; + expect(label2).toBe(expected2); + }); }); }); diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.helpers.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.helpers.ts index 2f3b544f..467c07a3 100644 --- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.helpers.ts +++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.helpers.ts @@ -68,6 +68,12 @@ export function getGeneLabelForProteinDifferentialExpression(gene: GCTGene) { gene.ensembl_gene_id; } +export function getGeneLabelForSRM(gene: GCTGene) { + let label = gene.hgnc_symbol ? `${ gene.hgnc_symbol } - ` : ''; + label += gene.ensembl_gene_id; + return label; +} + export function getScore(columnName: string, gene: GCTGene) { columnName = columnName.toUpperCase(); if (columnName === 'RISK SCORE') @@ -140,17 +146,13 @@ export const getDetailsPanelData = function ( }; if (category === 'Protein - Differential Expression') { - data.label = getGeneLabelForProteinDifferentialExpression(gene); + if (subCategory === 'SRM') { + data.label = getGeneLabelForSRM(gene); + } else { + data.label = getGeneLabelForProteinDifferentialExpression(gene); + } data.heading = 'Differential Protein Expression (' + tissue.name + ')'; data.allTissueLink = false; - - // if ('TMT' === subCategory) { - // data.min = -35; - // data.max = 35; - // } else { - // data.min = -4; - // data.max = 4; - // } } else { data.label = getGeneLabel(gene); data.heading = 'Differential RNA Expression (' + tissue.name + ')'; diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.variables.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.variables.ts index 26c90db2..62eaf5ae 100644 --- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.variables.ts +++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.variables.ts @@ -32,13 +32,17 @@ export const subCategories: { [key: string]: GCTSelectOption[] } = { ], 'Protein - Differential Expression': [ { - label: 'Label-free Quantification (LFQ)', - value: 'LFQ', + label: 'Targeted Selected Reaction Monitoring (SRM)', + value: 'SRM', }, { - label: 'Tandem Mass Tag (TMT)', + label: 'Genome-wide Tandem Mass Tag (TMT)', value: 'TMT', }, + { + label: 'Genome-wide Label-free Quantification (LFQ)', + value: 'LFQ', + }, ], }; diff --git a/src/app/testing/gene-comparison-tool-mocks.ts b/src/app/testing/gene-comparison-tool-mocks.ts index 4266f4b5..a3b6de95 100644 --- a/src/app/testing/gene-comparison-tool-mocks.ts +++ b/src/app/testing/gene-comparison-tool-mocks.ts @@ -173,6 +173,92 @@ export const comparisonGeneMock2: GCTGene = { multi_omics_score: 1.3 }; +export const comparisonGeneEmptyHGNCMock: GCTGene = { + ensembl_gene_id: 'ENSG00000147065', + hgnc_symbol: '', + tissues: [ + { + name: 'ACC', + logfc: -0.0144678061734664, + adj_p_val: 0.893263674388766, + ci_l: -0.133332670728704, + ci_r: 0.104397058381771, + }, + { + name: 'CBE', + logfc: -0.0751554371582435, + adj_p_val: 0.530889774959758, + ci_l: -0.247449816301241, + ci_r: 0.0971389419847545, + }, + { + name: 'DLPFC', + logfc: 0.0349940606540153, + adj_p_val: 0.604655110745068, + ci_l: -0.0564780903179806, + ci_r: 0.126466211626011, + }, + { + name: 'FP', + logfc: 0.235992067764791, + adj_p_val: 0.0293685880983672, + ci_l: 0.0813918568317721, + ci_r: 0.390592278697809, + }, + { + name: 'IFG', + logfc: 0.393613393602616, + adj_p_val: 0.0000468370819411619, + ci_l: 0.236604395922642, + ci_r: 0.550622391282589, + }, + { + name: 'PCC', + logfc: 0.0870992749746771, + adj_p_val: 0.275931011190809, + ci_l: -0.0292845799777793, + ci_r: 0.203483129927133, + }, + { + name: 'PHG', + logfc: 0.6626818751507, + adj_p_val: 9.688467425132421e-14, + ci_l: 0.506746460875332, + ci_r: 0.818617289426068, + }, + { + name: 'STG', + logfc: 0.421363564302165, + adj_p_val: 0.0000165742209158385, + ci_l: 0.26315969917125, + ci_r: 0.57956742943308, + }, + { + name: 'TCX', + logfc: 0.450452869099202, + adj_p_val: 0.00000476005829762979, + ci_l: 0.275315930793305, + ci_r: 0.625589807405099, + }, + ], + nominations: { + count: 4, + year: 2018, + teams: ['Chang Lab', 'Emory', 'MSSM', 'MSSM'], + studies: ['ROSMAP', 'Kronos', 'MSBB', 'ACT', 'BLSA', 'Banner'], + inputs: ['Genetics', 'RNA', 'Protein'], + programs: ['Community Contributed', 'AMP-AD'], + validations: [ + 'validation studies ongoing', + 'not prioritized for experimental validation', + ], + }, + associations: [3, 4], + target_risk_score: 3.1, + genetics_score: 2.2, + multi_omics_score: 3.3 +}; + export const gctDetailsPanelDataMock: GCTDetailsPanelData = { label: 'label', heading: 'heading', diff --git a/src/server/api.ts b/src/server/api.ts index 468f58f7..b37be822 100644 --- a/src/server/api.ts +++ b/src/server/api.ts @@ -38,23 +38,9 @@ const database = { url: '' }; doc && ('doc => ' + util.inspect(doc)), '\n'); }); */ -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); -console.log('HELLLLLLOOOOOOOO'); console.log(process.env); console.log(process.env.MONGODB_HOST); console.log(process.env.MONGODB_PORT); -console.log('DONE!'); -console.log('DONE!'); -console.log('DONE!'); -console.log('DONE!'); -console.log('DONE!'); -console.log('DONE!'); // Set the database url if ( diff --git a/src/server/components/comparison.ts b/src/server/components/comparison.ts index bd147698..e3e4f995 100644 --- a/src/server/components/comparison.ts +++ b/src/server/components/comparison.ts @@ -18,6 +18,7 @@ import { ProteomicsLFQCollection, ProteomicsTMTCollection, Team, + ProteomicsSRMCollection, } from '../models'; import { BioDomains, TargetNomination, Scores } from '../../app/models'; @@ -208,11 +209,19 @@ export async function getProteinComparisonGenes(method: string) { .lean() .sort({ hgnc_symbol: 1, tissue: 1 }) .exec(); - } else { + } else if ('LFQ' === method) { items = await ProteomicsLFQCollection.find() .lean() .sort({ hgnc_symbol: 1, tissue: 1 }) .exec(); + } else if ('SRM' === method) { + items = await ProteomicsSRMCollection.find() + .lean() + .sort({ hgnc_symbol: 1, tissue: 1 }) + .exec(); + } else { + // TODO capture corner scenarios + throw 'unknown method selected: ' + method; } if (items) { diff --git a/tests/gene-comparison-tool.spec.ts b/tests/gene-comparison-tool.spec.ts new file mode 100644 index 00000000..f203600a --- /dev/null +++ b/tests/gene-comparison-tool.spec.ts @@ -0,0 +1,30 @@ +import { test, expect } from '@playwright/test'; + +test.describe('specific viewport block', () => { + test.slow(); + test.use({ viewport: { width: 1600, height: 1200 } }); + + test('has title', async ({ page }) => { + await page.goto('/genes/comparison?category=Protein+-+Differential+Expression'); + + // wait for page to load (i.e. spinner to disappear) + await expect(page.locator('div:nth-child(4) > div > .spinner')) + .not.toBeVisible({ timeout: 250000}); + + // Expect a title "to contain" a substring. + await expect(page).toHaveTitle('Gene Comparison | Visual comparison tool for AD genes'); + }); + + test('sub-category is SRM by default', async ({ page }) => { + // set category for Protein - Differential Expression + await page.goto('/genes/comparison?category=Protein+-+Differential+Expression'); + + // wait for page to load (i.e. spinner to disappear) + await expect(page.locator('div:nth-child(4) > div > .spinner')) + .not.toBeVisible({ timeout: 150000}); + + // expect sub-category dropdown to be SRM + const dropdown = page.locator('#subCategory'); + await expect(dropdown).toHaveText('Targeted Selected Reaction Monitoring (SRM)'); + }); +});