Skip to content

Commit

Permalink
syncing changes from Q4 2024 and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 committed Jan 5, 2025
1 parent 69d2e2a commit 980166f
Show file tree
Hide file tree
Showing 31 changed files with 576 additions and 227 deletions.
5 changes: 3 additions & 2 deletions apps/agora/api/src/models/genes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const DruggabilitySchema = new Schema<Druggability>({
sm_druggability_bucket: { type: Number, required: true },
safety_bucket: { type: Number, required: true },
abability_bucket: { type: Number, required: true },
pharos_class: { type: String, required: true },
pharos_class: { type: [String], required: true },
classification: { type: String, required: true },
safety_bucket_definition: { type: String, required: true },
abability_bucket_definition: { type: String, required: true },
Expand All @@ -67,6 +67,7 @@ const GeneSchema = new Schema<Gene>(
summary: { type: String, required: true },
hgnc_symbol: { type: String, required: true },
alias: [{ type: String, required: true }],
uniprotkb_accessions: [{ type: String, required: true }],
is_igap: { type: Boolean, required: true },
is_eqtl: { type: Boolean, required: true },
is_any_rna_changed_in_ad_brain: { type: Boolean, required: true },
Expand All @@ -75,7 +76,7 @@ const GeneSchema = new Schema<Gene>(
protein_brain_change_studied: { type: Boolean, required: true },
target_nominations: { type: [TargetNominationSchema], required: true },
median_expression: { type: [MedianExpressionSchema], required: true },
druggability: { type: [DruggabilitySchema], required: true },
druggability: { type: DruggabilitySchema, required: true },
total_nominations: { type: Number, required: true },
ensembl_info: { type: EnsemblInfoSchema, required: true },
},
Expand Down
5 changes: 5 additions & 0 deletions apps/agora/app/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export const routes: Route[] = [
description: 'Nominate a gene as a new candidate for AD treatment or prevention.',
},
},
{
path: 'genes/:id/similar',
loadChildren: () =>
import('@sagebionetworks/agora/gene-similar').then((routes) => routes.routes),
},
{
path: 'genes/:id/:tab/:subtab',
loadChildren: () =>
Expand Down
2 changes: 1 addition & 1 deletion apps/agora/data/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ DB_HOST="agora-mongo" # must match mongo service name

# specifies data release manifest and team images folder
DATA_FILE="syn13363290"
DATA_VERSION="68"
DATA_VERSION="71"
TEAM_IMAGES_ID="syn12861877"
SYNAPSE_AUTH_TOKEN="agora-service-user-pat-here"
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Druggability {
sm_druggability_bucket: number;
safety_bucket: number;
abability_bucket: number;
pharos_class: string;
pharos_class: Array<string>;
classification: string;
safety_bucket_definition: string;
abability_bucket_definition: string;
Expand Down
5 changes: 3 additions & 2 deletions libs/agora/api-client-angular/src/lib/model/gene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface Gene {
summary: string;
hgnc_symbol: string;
alias: Array<string>;
uniprotkb_accessions?: Array<string>;
is_igap: boolean;
is_eqtl: boolean;
is_any_rna_changed_in_ad_brain: boolean;
Expand All @@ -39,7 +40,7 @@ export interface Gene {
protein_brain_change_studied: boolean;
target_nominations: Array<TargetNomination> | null;
median_expression: Array<MedianExpression>;
druggability: Array<Druggability>;
druggability: Druggability;
total_nominations: number | null;
is_adi?: boolean;
is_tep?: boolean;
Expand All @@ -57,7 +58,7 @@ export interface Gene {
ab_modality_display_value?: string | null;
safety_rating_display_value?: string | null;
sm_druggability_display_value?: string | null;
pharos_class_display_value?: string | null;
pharos_class_display_value?: Array<string> | null;
is_any_rna_changed_in_ad_brain_display_value?: string | null;
is_any_protein_changed_in_ad_brain_display_value?: string | null;
nominated_target_display_value?: boolean | null;
Expand Down
17 changes: 11 additions & 6 deletions libs/agora/api-description/build/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ components:
type: integer
example: 3
pharos_class:
type: string
example: Tclin
type: array
items:
type: string
classification:
type: string
example: Enzyme
Expand Down Expand Up @@ -730,6 +731,10 @@ components:
type: array
items:
type: string
uniprotkb_accessions:
type: array
items:
type: string
is_igap:
type: boolean
is_eqtl:
Expand All @@ -752,9 +757,7 @@ components:
items:
$ref: '#/components/schemas/MedianExpression'
druggability:
type: array
items:
$ref: '#/components/schemas/Druggability'
$ref: '#/components/schemas/Druggability'
total_nominations:
type: integer
nullable: true
Expand Down Expand Up @@ -820,7 +823,9 @@ components:
type: string
nullable: true
pharos_class_display_value:
type: string
type: array
items:
type: string
nullable: true
is_any_rna_changed_in_ad_brain_display_value:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ properties:
type: integer
example: 3
pharos_class:
type: string
example: 'Tclin'
type: array
items:
type: string
classification:
type: string
example: 'Enzyme'
Expand Down
12 changes: 8 additions & 4 deletions libs/agora/api-description/src/components/schemas/Gene.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ properties:
type: array
items:
type: string
uniprotkb_accessions:
type: array
items:
type: string
is_igap:
type: boolean
is_eqtl:
Expand All @@ -37,9 +41,7 @@ properties:
items:
$ref: MedianExpression.yaml
druggability:
type: array
items:
$ref: Druggability.yaml
$ref: Druggability.yaml
total_nominations:
type: integer
nullable: true
Expand Down Expand Up @@ -105,7 +107,9 @@ properties:
type: string
nullable: true
pharos_class_display_value:
type: string
type: array
items:
type: string
nullable: true
is_any_rna_changed_in_ad_brain_display_value:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class ScoreBarChartComponent implements OnChanges, AfterViewInit, OnDestr

@HostListener('window:resize', ['$event.target'])
onResize() {
console.log('sbc-onresize');
if (this.shouldResize && this.initialized) {
const divSize = this.scoreBarChartContainer.nativeElement.getBoundingClientRect().width;
clearTimeout(this.resizeTimer);
Expand All @@ -79,8 +78,6 @@ export class ScoreBarChartComponent implements OnChanges, AfterViewInit, OnDestr
}

ngOnChanges(changes: SimpleChanges): void {
console.log('sbc-changes', changes);

if (
(changes['data'] && !changes['data'].firstChange) ||
(changes['score'] && !changes['score'].firstChange) ||
Expand All @@ -98,8 +95,6 @@ export class ScoreBarChartComponent implements OnChanges, AfterViewInit, OnDestr
}

ngAfterViewInit(): void {
console.log('ngAfterViewInit');

if (this.score === null) this.hideChart();
else this.createChart();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,13 @@ export class GeneComparisonToolComponent implements OnInit, AfterViewInit, OnDes

combineLatest([genesApi$, distributionApi$]).subscribe(([genesResult, distributionResult]) => {
if (genesResult.items) {
console.log('# of items', genesResult.items.length);
this.initData(genesResult.items);
this.sortTable(this.headerTable);
this.refresh();

this.scoresDistribution = distributionResult.overall_scores;

this.isLoading = false;
// console.log('calling setLoading false');
// this.helperService.setLoading(false);
}
});
}
Expand Down Expand Up @@ -1295,14 +1292,8 @@ export class GeneComparisonToolComponent implements OnInit, AfterViewInit, OnDes

updateColumnWidth() {
const count = this.columns.length < 5 ? 5 : this.columns.length;
console.log('count is: ', count);

const width = this.headerTable?.containerViewChild?.nativeElement?.offsetWidth || 0;
console.log('ht', this.headerTable?.containerViewChild?.nativeElement?.offsetWidth);
console.log('width is: ', width);

this.columnWidth = Math.ceil((width - 300) / count) + 'px';
console.log('column width is: ', this.columnWidth);
}

onResize() {
Expand Down
1 change: 1 addition & 0 deletions libs/agora/genes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from './lib/components/gene-nominations/gene-nominations.component';
export * from './lib/components/gene-protein-selector/gene-protein-selector.component';
export * from './lib/components/gene-resources/gene-resources.component';
export * from './lib/components/gene-search/gene-search.component';
export * from './lib/components/gene-similar/gene-similar.component';
export * from './lib/components/gene-soe/gene-soe.component';
export * from './lib/components/gene-soe-charts/gene-soe-charts.component';
export * from './lib/components/gene-soe-list/gene-soe-list.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,18 @@ export class GeneDruggabilityComponent {
// Update the initial buckets
if (this.gene) {
if (!this.gene.druggability) {
this.gene.druggability = [
{
sm_druggability_bucket: this.getDefaultBucketNumber(),
safety_bucket: this.getDefaultBucketNumber(),
abability_bucket: this.getDefaultBucketNumber(),
pharos_class: '',
classification: this.getDefaultText(),
safety_bucket_definition: this.getDefaultText(),
abability_bucket_definition: this.getDefaultText(),
},
];
this.gene.druggability = {
sm_druggability_bucket: this.getDefaultBucketNumber(),
safety_bucket: this.getDefaultBucketNumber(),
abability_bucket: this.getDefaultBucketNumber(),
pharos_class: [],
classification: this.getDefaultText(),
safety_bucket_definition: this.getDefaultText(),
abability_bucket_definition: this.getDefaultText(),
};
}

this.druggability = this.gene.druggability[0];
this.druggability = this.gene.druggability;
this.currentBucketSM = this.druggability.sm_druggability_bucket;
this.currentBucketAB = this.druggability.abability_bucket;
this.currentBucketSF = this.druggability.safety_bucket;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2 class="gene-hero-name">
<p class="gene-hero-provider">
{{ getSummary() }}
</p>
@if (gene.bio_domains || getAlias() || getEnsemblUrl() !== '') {
@if (gene.bio_domains || getAliases() || getEnsemblUrl() !== '') {
<hr />
@if (gene.bio_domains) {
<div class="gene-hero-biodomains">
Expand All @@ -29,22 +29,29 @@ <h4 class="gene-hero-biodomains-heading">Biological Domains</h4>
</p>
</div>
}
@if (gene.druggability && gene.druggability.pharos_class) {
<div class="gene-hero-pharos">
<h4 class="gene-hero-pharos-heading">Pharos Class</h4>
<p>{{ gene.druggability.pharos_class.join(', ') }}</p>
</div>
}
<div class="gene-hero-aliases">
<h4 class="gene-hero-aliases-heading">Also known as</h4>
@if (getEnsemblUrl() !== '') {
<p>
@if (getEnsemblUrl()) {
<p class="aliases">
<a [href]="getEnsemblUrl()" target="_blank">{{ gene.ensembl_gene_id }}</a>
@if (gene.ensembl_info.ensembl_release) {
<span> (Ensembl Release {{ gene.ensembl_info.ensembl_release }}) </span>
}
</p>
}
@if (getEnsemblUrl() === '') {
<span>{{ gene.ensembl_gene_id }}</span>
<p class="aliases">
<span>{{ gene.ensembl_gene_id }}</span>
</p>
}

@if (gene.ensembl_info.ensembl_possible_replacements.length > 0) {
<p>
<p class="aliases">
<a [href]="getPossibleReplacementsURL()"
>Possible replacement value<span
*ngIf="gene.ensembl_info.ensembl_possible_replacements.length > 1"
Expand All @@ -54,8 +61,20 @@ <h4 class="gene-hero-aliases-heading">Also known as</h4>
{{ gene.ensembl_info.ensembl_possible_replacements.join(', ') }}
</p>
}
@if (alias !== '') {
<p>{{ alias }}</p>
@if (gene.uniprotkb_accessions) {
<p class="aliases">
UNIPROTKB
<ng-container
*ngFor="let accession of gene.uniprotkb_accessions; let isLast = last"
class="aliases"
>
<a [href]="getUniProtKBLink(accession)" target="_blank">{{ accession }}</a
><span *ngIf="!isLast">, </span>
</ng-container>
</p>
<p *ngIf="gene.alias.length > 0" class="aliases">
{{ getAliases() }}
</p>
}
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ hr {
}

.gene-hero-biodomains {
margin-bottom: 30px;
margin-bottom: 15px;

p {
margin-left: 10px;
}
}

.gene-hero-pharos {
p {
margin-left: 10px;
}
}

.gene-hero-summary {
Expand All @@ -50,11 +60,16 @@ hr {
}

.gene-hero-aliases-heading,
.gene-hero-biodomains-heading {
.gene-hero-biodomains-heading,
.gene-hero-pharos-heading {
text-transform: uppercase;
margin-bottom: 15px;
}

.aliases {
margin: 0 0 0 10px;
}

.possible-replacements {
margin-bottom: 15px;
}
Loading

0 comments on commit 980166f

Please sign in to comment.