Skip to content

Commit

Permalink
AG-959 Surface Ensembl release version
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 committed Dec 7, 2023
1 parent 93a99d0 commit d3b36a5
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,31 @@ <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 *ngIf="getAlias() || getEnsemblUrl() !== ''" 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>
<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>
{{ getAlias() }}
</p>
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 @@ -110,4 +110,14 @@ 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 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)
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;
}
3 changes: 3 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,8 @@ export interface Gene {
input_data_display_value?: string;

bio_domains?: BioDomains;

ensembl_info: EnsemblInfo[];
}

export interface GenesResponse {
Expand Down
45 changes: 40 additions & 5 deletions src/app/testing/gene-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2934,7 +2934,14 @@ export const geneMock1: Gene = {
},
is_adi: false,
is_tep: true,
resource_url: 'https://adknowledgeportal.synapse.org/Explore/Target%20Enabling%20Resources?QueryWrapper0=%7B%22sql%22%3A%22select%20*%20from%20syn26146692%20WHERE%20%60isPublic%60%20%3D%20true%22%2C%22limit%22%3A25%2C%22offset%22%3A0%2C%22selectedFacets%22%3A%5B%7B%22concreteType%22%3A%22org.sagebionetworks.repo.model.table.FacetColumnValuesRequest%22%2C%22columnName%22%3A%22target%22%2C%22facetValues%22%3A%5B%22MSN%22%5D%7D%5D%7D'
resource_url: 'https://adknowledgeportal.synapse.org/Explore/Target%20Enabling%20Resources?QueryWrapper0=%7B%22sql%22%3A%22select%20*%20from%20syn26146692%20WHERE%20%60isPublic%60%20%3D%20true%22%2C%22limit%22%3A25%2C%22offset%22%3A0%2C%22selectedFacets%22%3A%5B%7B%22concreteType%22%3A%22org.sagebionetworks.repo.model.table.FacetColumnValuesRequest%22%2C%22columnName%22%3A%22target%22%2C%22facetValues%22%3A%5B%22MSN%22%5D%7D%5D%7D',
ensembl_info: [
{
ensembl_release: 84,
ensembl_possible_replacements: ['ENSG00000283172'],
ensembl_permalink: 'https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794'
}
]
};

export const geneMock2: Gene = {
Expand Down Expand Up @@ -3121,7 +3128,14 @@ export const geneMock2: Gene = {
total_nominations: 3,
is_adi: false,
is_tep: true,
resource_url: 'https://adknowledgeportal.synapse.org/Explore/Target%20Enabling%20Resources?QueryWrapper0=%7B%22sql%22%3A%22select%20*%20from%20syn26146692%20WHERE%20%60isPublic%60%20%3D%20true%22%2C%22limit%22%3A25%2C%22offset%22%3A0%2C%22selectedFacets%22%3A%5B%7B%22concreteType%22%3A%22org.sagebionetworks.repo.model.table.FacetColumnValuesRequest%22%2C%22columnName%22%3A%22target%22%2C%22facetValues%22%3A%5B%22PLEC%22%5D%7D%5D%7D'
resource_url: 'https://adknowledgeportal.synapse.org/Explore/Target%20Enabling%20Resources?QueryWrapper0=%7B%22sql%22%3A%22select%20*%20from%20syn26146692%20WHERE%20%60isPublic%60%20%3D%20true%22%2C%22limit%22%3A25%2C%22offset%22%3A0%2C%22selectedFacets%22%3A%5B%7B%22concreteType%22%3A%22org.sagebionetworks.repo.model.table.FacetColumnValuesRequest%22%2C%22columnName%22%3A%22target%22%2C%22facetValues%22%3A%5B%22PLEC%22%5D%7D%5D%7D',
ensembl_info: [
{
ensembl_release: 84,
ensembl_possible_replacements: ['ENSG00000283172, ENSG00000283172'],
ensembl_permalink: 'https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794'
}
]
};

export const geneMock3: Gene = {
Expand Down Expand Up @@ -3243,7 +3257,14 @@ export const geneMock3: Gene = {
total_nominations: null,
is_adi: false,
is_tep: true,
resource_url: null
resource_url: null,
ensembl_info: [
{
ensembl_release: 84,
ensembl_possible_replacements: ['ENSG00000283172, ENSG00000283172'],
ensembl_permalink: 'https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794'
}
]
};

export const gctGeneMock1: GCTGene = {
Expand Down Expand Up @@ -3421,7 +3442,14 @@ export const nominatedGeneMock1: Gene = {
total_nominations: 4,
is_adi: false,
is_tep: false,
resource_url: null
resource_url: null,
ensembl_info: [
{
ensembl_release: 84,
ensembl_possible_replacements: ['ENSG00000283172, ENSG00000283172'],
ensembl_permalink: 'https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794'
}
]
} as Gene;

export const noHGNCgeneMock: Gene = {
Expand Down Expand Up @@ -3518,5 +3546,12 @@ export const noHGNCgeneMock: Gene = {
total_nominations: 4,
is_adi: false,
is_tep: false,
resource_url: null
resource_url: null,
ensembl_info: [
{
ensembl_release: 84,
ensembl_possible_replacements: ['ENSG00000283172, ENSG00000283172'],
ensembl_permalink: 'https://may2015.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=ENSG00000264794'
}
]
} as Gene;
8 changes: 8 additions & 0 deletions src/server/models/genes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TargetNomination,
Druggability,
} from '../../app/models';
import { EnsemblInfo } from '../../app/models/EnsemblInfo';
export { Gene } from '../../app/models';

// -------------------------------------------------------------------------- //
Expand Down Expand Up @@ -42,6 +43,12 @@ const MedianExpressionSchema = new Schema<MedianExpression>({
tissue: { type: String, required: true },
});

const EnsemblInfoSchema = new Schema<EnsemblInfo>({
ensembl_release: { type: Number, required: true },
ensembl_possible_replacements: { type: [String], required: true },
ensembl_permalink: { type: String, required: true }
});

const DruggabilitySchema = new Schema<Druggability>({
sm_druggability_bucket: { type: Number, required: true },
safety_bucket: { type: Number, required: true },
Expand Down Expand Up @@ -70,6 +77,7 @@ const GeneSchema = new Schema<Gene>(
median_expression: { type: [MedianExpressionSchema], required: true },
druggability: { type: [DruggabilitySchema], required: true },
total_nominations: { type: Number, required: true },
ensembl_info: { type: [EnsemblInfoSchema], required: true }
},
{ collection: 'geneinfo' }
);
Expand Down

0 comments on commit d3b36a5

Please sign in to comment.