Skip to content

Commit

Permalink
Merge pull request #1267 from sagely1/AG-959-gene-hero-surface-ensemb…
Browse files Browse the repository at this point in the history
…l-version

AG-959 Surface Ensembl version in gene hero
  • Loading branch information
sagely1 authored Dec 19, 2023
2 parents 75cc2d5 + 7ae4b60 commit 22471eb
Show file tree
Hide file tree
Showing 13 changed files with 1,122 additions and 21 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ name: Node.js CI

on:
push:
branches: [ "develop" ]
branches: [ develop, main ]
pull_request:
branches: [ "develop" ]
branches: [ develop, main ]

jobs:
build:

timeout-minutes: 60

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# Allow OIDC Integration (so we can assume the AWS role to deploy)
# permissions:
Expand Down
14 changes: 8 additions & 6 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { defineConfig, devices } from '@playwright/test';

export const baseURL = 'http://localhost:8080';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
Expand All @@ -26,7 +28,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://127.0.0.1:8080',
baseURL: baseURL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down Expand Up @@ -71,9 +73,9 @@ export default defineConfig({
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: 'npm run start',
url: baseURL,
reuseExistingServer: !process.env.CI,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,32 @@ <h2 class="gene-hero-name">
<p class="gene-hero-provider">
{{ getSummary() }}
</p>
<ng-container *ngIf="gene.bio_domains || getAlias()">
<ng-container *ngIf="gene.bio_domains || getAlias() || getEnsemblUrl() !== ''">
<hr />
<div *ngIf="gene.bio_domains" class="gene-hero-biodomains">
<h4 class="gene-hero-biodomains-heading">Biological Domains</h4>
<p>
{{ getBiodomains() }}
</p>
</div>
<div *ngIf="getAlias()" class="gene-hero-aliases">
<div class="gene-hero-aliases">
<h4 class="gene-hero-aliases-heading">Also known as</h4>
<p *ngIf="gene.hgnc_symbol" class="mb-0">{{ gene.ensembl_gene_id }}</p>
<p>
<ng-container *ngIf="getEnsemblUrl() !== ''">
<p>
<a [href]="getEnsemblUrl()" target="_blank">{{ gene.ensembl_gene_id }}</a>
<span *ngIf="gene.ensembl_info[0].ensembl_release">
(Ensembl Release {{ gene.ensembl_info[0].ensembl_release }})
</span>
</p>
</ng-container>
<ng-container *ngIf="getEnsemblUrl() === ''">
<span *ngIf="getEnsemblUrl() === ''">{{ gene.ensembl_gene_id }}</span>
</ng-container>
<p *ngIf="gene.ensembl_info[0].ensembl_possible_replacements.length > 0">
<a [href]="getPossibleReplacementsURL()">Possible replacement value<span *ngIf="gene.ensembl_info[0].ensembl_possible_replacements.length > 1">s</span></a>:
{{ gene.ensembl_info[0].ensembl_possible_replacements.join(', ')}}
</p>
<p *ngIf="getAlias() !== ''">
{{ getAlias() }}
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ hr {
text-transform: uppercase;
margin-bottom: 15px;
}

.possible-replacements {
margin-bottom: 15px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RouterTestingModule } from '@angular/router/testing';
// Internal
// -------------------------------------------------------------------------- //
import { GeneHeroComponent } from './';
import { geneMock1, geneMock3 } from '../../../../testing';
import { geneMissingEnsemblInfo, geneMock1, geneMock3 } from '../../../../testing';

// -------------------------------------------------------------------------- //
// Tests
Expand Down Expand Up @@ -110,4 +110,20 @@ describe('Component: Gene Hero', () => {
const expected = 'Immune Response, Lipid Metabolism, Structural Stabilization, Synapse, Vasculature';
expect(component.getBiodomains()).toBe(expected);
});

it('should return the ensembl permalink', () => {
component.gene = geneMock1;
expect(component.getEnsemblUrl()).toBe('https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794');
});

it('should return an empty string if the gene is missing ensembl info', () => {
// if gene does not have a url
component.gene = geneMissingEnsemblInfo;
expect(component.getEnsemblUrl()).toBe('');
});

it('should return a url with ensembl id', () => {
component.gene = geneMock1;
expect(component.getPossibleReplacementsURL()).toBe('https://useast.ensembl.org/Homo_sapiens/Gene/Idhistory?g=ENSG00000147065');
});
});
11 changes: 11 additions & 0 deletions src/app/features/genes/components/gene-hero/gene-hero.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,15 @@ export class GeneHeroComponent {
.sort(ascending);
return biodomains.join(', ');
}

getEnsemblUrl() {
if (!this.gene?.ensembl_info || this.gene.ensembl_info.length <= 0)
return '';
return this.gene?.ensembl_info[0].ensembl_permalink;
}

getPossibleReplacementsURL() {
let url = 'https://useast.ensembl.org/Homo_sapiens/Gene/Idhistory?g=';
return url += this.gene?.ensembl_gene_id;
}
}
5 changes: 5 additions & 0 deletions src/app/models/EnsemblInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface EnsemblInfo {
ensembl_release: number;
ensembl_possible_replacements: string[];
ensembl_permalink: string;
}
4 changes: 4 additions & 0 deletions src/app/models/genes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SimilarGenesNetwork,
BioDomains
} from './';
import { EnsemblInfo } from './EnsemblInfo';

export interface TargetNomination {
source: string;
Expand Down Expand Up @@ -98,6 +99,9 @@ export interface Gene {
input_data_display_value?: string;

bio_domains?: BioDomains;

// FIXME Will be fixed by AG-1324 in a future data release as it doesn't make sense to have an array here
ensembl_info: EnsemblInfo[];
}

export interface GenesResponse {
Expand Down
Loading

0 comments on commit 22471eb

Please sign in to comment.