Skip to content

Commit

Permalink
Add feature viewer in Modification section
Browse files Browse the repository at this point in the history
Refs #2203
  • Loading branch information
kimrutherford committed Oct 19, 2024
1 parent bca819a commit def211c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 11 deletions.
14 changes: 14 additions & 0 deletions src/app/annotation-table/annotation-table.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@
.annotation-table-slim, .gene-alleles-link {
margin-bottom: 0.8em;
}

.view-all-link {
margin-left: 13.5em;
}

.view-all-link .help-icon {
font-size: 90%;
opacity: 80%;
}

.embedded-protein-viewer {
width: 1050px;
border: 0;
}
16 changes: 16 additions & 0 deletions src/app/annotation-table/annotation-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@
<a routerLink="/gene_alleles/{{geneDetails.uniquename}}">View all alleles of <span class="name-id-highlight">{{geneDetails.displayName}}</span></a>
</div>

<div *ngIf="sanitizedFeatureViewURL">
<div class="view-all-link">
<span class="help-icon">
<app-help-link [route]="'/documentation/gene-page-protein-features'"
[title]="'Click to view documentation for this section'">
</app-help-link>
</span>

<a routerLink="/gene_protein_features/{{geneDetails!.uniquename}}">View all protein features ...</a>
</div>

<iframe [src]="getProteinViewerIFrameURL()" id="protein-feature-viewer-mods" frameborder="0" scrolling="no"
onload="resizeIframe(this, 100)" class="embedded-protein-viewer" #modsproteinfeaturesiframe>
</iframe>
</div>

<div *ngIf="split_by_parents.length == 0">
<app-annotation-sub-table
[annotationTypeName]="annotationTypeName"
Expand Down
18 changes: 17 additions & 1 deletion src/app/annotation-table/annotation-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TermAnnotation, GeneDetails } from '../pombase-api.service';
import { getAnnotationTableConfig, AnnotationTableConfig, AnnotationType,
SplitByParentsConfig } from '../config';
import { DeployConfigService } from '../deploy-config.service';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';

@Component({
selector: 'app-annotation-table',
Expand All @@ -26,8 +27,10 @@ export class AnnotationTableComponent implements OnInit, OnChanges {
splitSummaryList = {};
split_by_parents: Array<SplitByParentsConfig> = [];
helpIconTitle = 'Click to view documention';
sanitizedFeatureViewURL?: SafeResourceUrl;

constructor(public deployConfigService: DeployConfigService) { }
constructor(private sanitizer: DomSanitizer,
public deployConfigService: DeployConfigService) { }

maybeDoSplit() {
if (this.annotationTable && this.typeConfig && this.typeConfig.split_by_parents) {
Expand Down Expand Up @@ -75,6 +78,10 @@ export class AnnotationTableComponent implements OnInit, OnChanges {
}
}

getProteinViewerIFrameURL(): SafeResourceUrl | undefined {
return this.sanitizedFeatureViewURL;
}

ngOnInit() {
}

Expand All @@ -96,6 +103,15 @@ export class AnnotationTableComponent implements OnInit, OnChanges {
this.helpIconTitle = 'Click to view documentation';
}

if (this.geneDetails && this.typeConfig.protein_viewer_type) {
const rawUrl = 'protein_feature_view/' + this.typeConfig.protein_viewer_type + '/' +
this.geneDetails.uniquename;
this.sanitizedFeatureViewURL =
this.sanitizer.bypassSecurityTrustResourceUrl(rawUrl);
} else {
this.sanitizedFeatureViewURL = undefined;
}

this.maybeDoSplit();
}
}
1 change: 1 addition & 0 deletions src/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ export interface AnnotationType {
slim_description?: string;
slim_link?: string;
slim_no_category_text?: string;
protein_viewer_type?: string;
downstream_query_title?: string;
downstream_relations?: Array<TermId>;
modification_abbreviations?: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ export class ProteinFeatureViewerComponent {
this.geneDisplayName = this.geneDetails.uniquename;
}

if (this.geneDetails.uniprot_identifier) {
const rawUrl = 'protein_feature_view/widget/' + this.geneDetails.uniquename;
this.sanitizedURL =
this.sanitizer.bypassSecurityTrustResourceUrl(rawUrl);
} else {
this.sanitizedURL = undefined;
}
const rawUrl = 'protein_feature_view/widget/' + this.geneDetails.uniquename;
this.sanitizedURL =
this.sanitizer.bypassSecurityTrustResourceUrl(rawUrl);
}
}
2 changes: 1 addition & 1 deletion src/app/protein-features/protein-features.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
.view-all-link .help-icon {
font-size: 90%;
opacity: 80%;
}
}
2 changes: 1 addition & 1 deletion src/japonicus/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
function resizeIframe(obj, minHeight, timeout) {
if (!obj || !obj.contentWindow || !obj.contentWindow.document || !obj.contentWindow.document.body) { return; }
if (!timeout) { timeout = 100; }
let height = obj.contentWindow.document.body.scrollHeight + 40;
let height = obj.contentWindow.document.body.scrollHeight + 25;
if (height < minHeight) { height = minHeight; }
obj.style.height = height + 'px';
const nextTimeout = Math.round(timeout * 1.1);
Expand Down
2 changes: 1 addition & 1 deletion src/pombase/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
function resizeIframe(obj, minHeight, timeout) {
if (!obj || !obj.contentWindow || !obj.contentWindow.document || !obj.contentWindow.document.body) { return; }
if (!timeout) { timeout = 100; }
let height = obj.contentWindow.document.body.scrollHeight + 40;
let height = obj.contentWindow.document.body.scrollHeight + 25;
if (height < minHeight) { height = minHeight; }
obj.style.height = height + 'px';
const nextTimeout = Math.round(timeout * 1.1);
Expand Down

0 comments on commit def211c

Please sign in to comment.