Skip to content
Snippets Groups Projects
Unverified Commit 7fa8da0d authored by Xiao Gui's avatar Xiao Gui
Browse files

feat: add polar plot & line plot to receptor ds

chore: log siibra version
parent f8f3ae1b
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,21 @@
</mat-card-content>
</mat-card>
<!-- radar special view -->
<ng-template [ngIf]="polar$ | async" let-polar>
<kg-dataset-dumb-radar
[radar]="polar"
[attr.kg-ds-prv-darkmode]="darktheme$ | async">
</kg-dataset-dumb-radar>
</ng-template>
<!-- line special view -->
<ng-template [ngIf]="linear$ | async" let-linear>
<kg-dataset-dumb-line
[profileBs]="linear"
[attr.kg-ds-prv-darkmode]="darktheme$ | async">
</kg-dataset-dumb-line>
</ng-template>
<!-- tabular special view -->
<ng-template [ngIf]="tabular$ | async" let-tabular>
......
......@@ -15,3 +15,10 @@ spinner-cmp
margin: auto;
margin-left: 0.5rem;
}
kg-dataset-dumb-radar,
kg-dataset-dumb-line
{
display: block;
max-height: 24rem;
}
import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, Inject, Input, OnChanges } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { filter, map } from 'rxjs/operators';
import { SAPI } from 'src/atlasComponents/sapi/sapi.service';
import { Feature, TabularFeature, VoiFeature } from 'src/atlasComponents/sapi/sxplrTypes';
import { DARKTHEME } from 'src/util/injectionTokens';
function isTabularData(feature: unknown): feature is TabularFeature<number|string|number[]> {
return !!feature['index'] && !!feature['columns']
......@@ -12,6 +13,18 @@ function isVoiData(feature: unknown): feature is VoiFeature {
return !!feature['bbox']
}
type PolarPlotData = {
receptor: {
label: string
}
density: {
mean: number
sd: number
unit: string
}
}
@Component({
selector: 'sxplr-feature-view',
templateUrl: './feature-view.component.html',
......@@ -32,7 +45,42 @@ export class FeatureViewComponent implements OnChanges {
? ['index', ...data.columns]
: []),
)
constructor(private sapi: SAPI) { }
polar$: Observable<PolarPlotData[]> = this.tabular$.pipe(
filter(v => v?.name.includes("ReceptorDensityFingerprint")),
map(v => {
return v.index.map((receptor, idx) => ({
receptor: {
label: receptor
},
density: {
mean: v.data[idx][0] as number,
sd: v.data[idx][1] as number,
unit: 'fmol/mg'
}
}))
})
)
linear$: Observable<Record<number, number>> = this.tabular$.pipe(
filter(v => v && v.name.includes("ReceptorDensityProfile")),
map(v => {
const returnLbl: Record<number, number> = {}
v.index.forEach((label, idx) => {
const val = v.data[idx][0]
if (typeof val === 'number') {
returnLbl[Math.round(Number(label)*100)] = val
}
})
return returnLbl
})
)
constructor(
private sapi: SAPI,
@Inject(DARKTHEME) public darktheme$: Observable<boolean>,
) { }
ngOnChanges(): void {
......
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
import { MatCardModule } from "@angular/material/card";
import { MatRippleModule } from "@angular/material/core";
import { MatExpansionModule } from "@angular/material/expansion";
......@@ -56,6 +56,9 @@ import { NgLayerCtlModule } from "src/viewerModule/nehuba/ngLayerCtlModule/modul
exports: [
EntryComponent,
FeatureViewComponent,
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
]
})
export class FeatureModule{}
\ No newline at end of file
......@@ -34,7 +34,7 @@ import { MainModule } from './main.module';
import { environment } from 'src/environments/environment'
const { PRODUCTION, VERSION, GIT_HASH } = environment
if (PRODUCTION) enableProdMode()
if (PRODUCTION) { console.log(`Siibra Explorer: ${VERSION}::${GIT_HASH}`) }
console.log(`Siibra Explorer: ${VERSION}::${GIT_HASH}`)
platformBrowserDynamic().bootstrapModule(MainModule)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment