Skip to content

Commit

Permalink
Merge branch 'features' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Mar 29, 2024
2 parents 88c73ce + 513667f commit 685c756
Show file tree
Hide file tree
Showing 21 changed files with 235 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
nzSize="small"
[nzColumn]="2"
nzBordered="true">
<nz-descriptions-item
*ngIf="feature.fullName"
nzSpan="2"
nzTitle="Full Name">
{{ feature.fullName }}
</nz-descriptions-item>
<!-- aliases -->
<nz-descriptions-item
nzTitle="Aliases"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ query FeaturePopover($featureId: Int!) {
fragment featurePopover on Feature {
id
name
fullName
featureInstance {
__typename
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,109 +1,116 @@
@if(variant.__typename == "FactorVariant") {
<nz-card
[nzTitle]="cardTitle"
nzType="inner"
nzSize="small">
<ng-template #cardTitle>
<i
nz-icon
nzType="civic-variant"
nzTheme="twotone"
[nzTwotoneColor]="'Variant' | entityColor"></i>
{{ variant.name }}
</ng-template>
<nz-row [nzGutter]="[8, 16]">
<nz-col [nzSpan]="24">
<nz-row [nzGutter]="[8, 8]">
<!-- gene attributes block -->
<nz-col nzSpan="24">
<nz-descriptions
nzLayout="horizontal"
nzSize="small"
[nzColumn]="4"
nzBordered="true">
<nz-descriptions-item
[nzSpan]="4"
nzTitle="Factor Variant">
<cvc-feature-variant-tag
[variant]="variant"></cvc-feature-variant-tag>
</nz-descriptions-item>
<!-- aliases -->
<nz-descriptions-item
[nzSpan]="2"
nzTitle="Aliases">
<ng-container
*ngIf="variant.variantAliases.length > 0; else noAliases">
<cvc-tag-list>
<nz-tag *ngFor="let alias of variant.variantAliases">{{
alias
}}</nz-tag>
</cvc-tag-list>
</ng-container>
<ng-template #noAliases>
<span
nz-typography
nzType="secondary"
>None specified</span
>
</ng-template>
</nz-descriptions-item>

<!-- variant type(s) -->
<nz-descriptions-item
[nzSpan]="2"
[nzTitle]="
variant.variantTypes.length > 1
? 'Variant Types'
: 'Variant Type'
">
<ng-container
*ngIf="variant.variantTypes.length > 0; else noTypes">
<cvc-tag-list>
<cvc-variant-type-tag
[variantType]="type"
*ngFor="let type of variant.variantTypes">
</cvc-variant-type-tag>
</cvc-tag-list>
</ng-container>
<ng-template #noTypes>
<span
nz-typography
nzType="secondary"
>None specified</span
>
</ng-template>
</nz-descriptions-item>

<nz-descriptions-item
[nzSpan]="4"
*ngIf="this.displayMps.length > 0"
nzTitle="Other Molecular Profiles">
<cvc-tag-list>
<ng-container *ngFor="let mp of this.displayMps">
<cvc-molecular-profile-tag
[molecularProfile]="mp"
[truncateLongName]="true"></cvc-molecular-profile-tag>
@if (variant.__typename == 'FactorVariant') {
<nz-card
[nzTitle]="cardTitle"
nzType="inner"
nzSize="small">
<ng-template #cardTitle>
<i
nz-icon
nzType="civic-variant"
nzTheme="twotone"
[nzTwotoneColor]="'Variant' | entityColor"></i>
<span
nz-typography
nzType="secondary">
{{ variant.feature.name }}
</span>
<span nz-typography>
{{ variant.name }}
</span>
</ng-template>
<nz-row [nzGutter]="[8, 16]">
<nz-col [nzSpan]="24">
<nz-row [nzGutter]="[8, 8]">
<!-- gene attributes block -->
<nz-col nzSpan="24">
<nz-descriptions
nzLayout="horizontal"
nzSize="small"
[nzColumn]="4"
nzBordered="true">
<nz-descriptions-item
[nzSpan]="4"
nzTitle="Factor Variant">
<cvc-feature-variant-tag
[variant]="variant"></cvc-feature-variant-tag>
</nz-descriptions-item>
<!-- aliases -->
<nz-descriptions-item
[nzSpan]="2"
nzTitle="Aliases">
<ng-container
*ngIf="variant.variantAliases.length > 0; else noAliases">
<cvc-tag-list>
<nz-tag *ngFor="let alias of variant.variantAliases">{{
alias
}}</nz-tag>
</cvc-tag-list>
</ng-container>
<ng-template #noAliases>
<span
nz-typography
nzType="secondary"
>None specified</span
>
</ng-template>
</nz-descriptions-item>

<!-- variant type(s) -->
<nz-descriptions-item
[nzSpan]="2"
[nzTitle]="
variant.variantTypes.length > 1
? 'Variant Types'
: 'Variant Type'
">
<ng-container
*ngIf="
variant.molecularProfiles.totalCount >
this.displayMps.length + 1
">
<a routerLink="/variants/{{ variant.id }}/summary">
+ view
{{
variant.molecularProfiles.totalCount -
this.displayMps.length
}}
more
</a>
*ngIf="variant.variantTypes.length > 0; else noTypes">
<cvc-tag-list>
<cvc-variant-type-tag
[variantType]="type"
*ngFor="let type of variant.variantTypes">
</cvc-variant-type-tag>
</cvc-tag-list>
</ng-container>
</cvc-tag-list>
</nz-descriptions-item>
</nz-descriptions>
</nz-col>
</nz-row>
</nz-col>
</nz-row>
</nz-card>
<ng-template #noTypes>
<span
nz-typography
nzType="secondary"
>None specified</span
>
</ng-template>
</nz-descriptions-item>

<nz-descriptions-item
[nzSpan]="4"
*ngIf="this.displayMps.length > 0"
nzTitle="Other Molecular Profiles">
<cvc-tag-list>
<ng-container *ngFor="let mp of this.displayMps">
<cvc-molecular-profile-tag
[molecularProfile]="mp"
[truncateLongName]="true"></cvc-molecular-profile-tag>
</ng-container>
<ng-container
*ngIf="
variant.molecularProfiles.totalCount >
this.displayMps.length + 1
">
<a routerLink="/variants/{{ variant.id }}/summary">
+ view
{{
variant.molecularProfiles.totalCount -
this.displayMps.length
}}
more
</a>
</ng-container>
</cvc-tag-list>
</nz-descriptions-item>
</nz-descriptions>
</nz-col>
</nz-row>
</nz-col>
</nz-row>
</nz-card>
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<cvc-molecular-profiles-table
[variantId]="variant.id"
cvcHeight="300px"
cvcTitle="{{ variant.name }} Molecular Profiles">
cvcTitle="Molecular Profiles">
</cvc-molecular-profiles-table>
</nz-col>
</nz-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@
</th>
<th
nzLeft
nzWidth="70px">
Category
nzWidth="70px"
nz-tooltip
nzTooltipTitle="Feature Type">
<i
nz-icon
nzType="civic-feature"></i>
Type
</th>
<th
nzWidth="100px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class CvcEntityTagComponent implements OnChanges {
)
return
}
console.log(typename)
// get linkable entity
let fragment = undefined
if (!this.cvcDisableLink) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const formFieldConfig: FormlyFieldConfig[] = [
props: {
label: 'Variants',
required: true,
requireGene: false,
requireFeature: false,
showManagerBtn: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const formFieldConfig: FormlyFieldConfig[] = [
label: 'Variants',
required: true,
colSpan: 24,
requireGene: false,
requireFeature: false,
showManagerBtn: true,
},
},
Expand Down
10 changes: 2 additions & 8 deletions client/src/app/forms/types/feature-select/feature-select.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { FormlyFieldProps } from '@ngx-formly/ng-zorro-antd/form-field'
import { NzSelectOptionInterface } from 'ng-zorro-antd/select'
import mixin from 'ts-mixin-extended'
import { FeatureIdWithCreationStatus } from './feature-quick-add/feature-quick-add.form'
import { BehaviorSubject, Subscription } from 'rxjs'
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { BehaviorSubject } from 'rxjs'
import { UntilDestroy } from '@ngneat/until-destroy'

export type CvcFeatureSelectFieldOption = Partial<
FieldTypeConfig<Partial<CvcFeatureSelectFieldProps>>
Expand Down Expand Up @@ -109,12 +109,6 @@ export class CvcFeatureSelectField

ngAfterViewInit(): void {
this.selectedFeatureType = this.props.featureType
if (this.props.featureTypeCallback) {
this.onFeatureType$
.pipe(untilDestroyed(this))
.subscribe((ft) => this.props.featureTypeCallback(ft))
this.onFeatureType$.next(this.selectedFeatureType)
}
this.configureBaseField() // mixin fn
this.configureEntitySelectField({
// mixin fn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import { Apollo, gql } from 'apollo-angular'
import { Maybe } from 'graphql/jsutils/Maybe'
import { NzFormLayoutType } from 'ng-zorro-antd/form'
import { BehaviorSubject } from 'rxjs'
import { tag } from 'rxjs-spy/operators'
import { CvcVariantSelectFieldOption } from '../../variant-select/variant-select.type'
import { EnumToTitlePipe } from '@app/core/pipes/enum-to-title-pipe'

type MpFinderModel = {
featureId?: number
Expand All @@ -45,7 +43,6 @@ export class MpFinderComponent {
model: MpFinderModel
form: UntypedFormGroup
config: FormlyFieldConfig[]
featureType?: CreateableFeatureTypes

finderState: MpFinderState = {
formLayout: 'horizontal',
Expand Down Expand Up @@ -82,9 +79,6 @@ export class MpFinderComponent {
showExtra: false,
showErrorTip: false,
required: true,
featureTypeCallback: (ft: CreateableFeatureTypes) => {
this.featureType = ft
},
},
},
<CvcVariantSelectFieldOption>{
Expand Down Expand Up @@ -119,11 +113,10 @@ export class MpFinderComponent {

getSelectedVariant(variantId: Maybe<number>): Maybe<Variant> {
if (!variantId) return
const feature = new EnumToTitlePipe().transform(this.featureType)
const fragment = {
id: `${feature}Variant:${variantId}`,
id: `Variant:${variantId}`,
fragment: gql`
fragment VariantSelectQuery on ${feature}Variant {
fragment VariantSelectQuery on Variant {
id
name
link
Expand Down
12 changes: 2 additions & 10 deletions client/src/app/forms/types/variant-select/variant-select.query.gql
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
query VariantSelectTypeahead($name: String!, $featureId: Int) {
variants(name: $name, featureId: $featureId, first: 50) {
totalCount
edges {
node {
...VariantSelectTypeaheadFields
}
}
nodes {
...VariantSelectTypeaheadFields
}
variantsTypeahead(queryTerm: $name, featureId: $featureId) {
...VariantSelectTypeaheadFields
}
}

Expand Down
Loading

0 comments on commit 685c756

Please sign in to comment.