Skip to content

Commit 74e938c

Browse files
Merge branch 'master' into feat/json-schema
2 parents 80b2004 + 6407792 commit 74e938c

18 files changed

+658
-92
lines changed

packages/nextclade-schemas/input-pathogen-json.schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@
376376
"type": "string"
377377
}
378378
}
379+
},
380+
"aaMutLabelMap": {
381+
"type": "object",
382+
"additionalProperties": {
383+
"type": "array",
384+
"items": {
385+
"type": "string"
386+
}
387+
}
379388
}
380389
}
381390
},

packages/nextclade-schemas/input-pathogen-json.schema.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ definitions:
229229
type: array
230230
items:
231231
type: string
232+
aaMutLabelMap:
233+
type: object
234+
additionalProperties:
235+
type: array
236+
items:
237+
type: string
232238
QcConfig:
233239
description: Configuration for QC rules
234240
examples:

packages/nextclade-schemas/output-json.schema.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,13 +1216,17 @@
12161216
"required": [
12171217
"aaChangesGroups",
12181218
"cdsName",
1219+
"labeledSubstitutions",
12191220
"privateDeletionRanges",
12201221
"privateDeletions",
12211222
"privateSubstitutions",
12221223
"reversionSubstitutions",
1224+
"totalLabeledSubstitutions",
12231225
"totalPrivateDeletions",
12241226
"totalPrivateSubstitutions",
1225-
"totalReversionSubstitutions"
1227+
"totalReversionSubstitutions",
1228+
"totalUnlabeledSubstitutions",
1229+
"unlabeledSubstitutions"
12261230
],
12271231
"properties": {
12281232
"cdsName": {
@@ -1252,6 +1256,18 @@
12521256
"$ref": "#/definitions/AaSub"
12531257
}
12541258
},
1259+
"labeledSubstitutions": {
1260+
"type": "array",
1261+
"items": {
1262+
"$ref": "#/definitions/AaSubLabeled"
1263+
}
1264+
},
1265+
"unlabeledSubstitutions": {
1266+
"type": "array",
1267+
"items": {
1268+
"$ref": "#/definitions/AaSub"
1269+
}
1270+
},
12551271
"totalPrivateSubstitutions": {
12561272
"type": "integer",
12571273
"format": "uint",
@@ -1267,6 +1283,16 @@
12671283
"format": "uint",
12681284
"minimum": 0.0
12691285
},
1286+
"totalLabeledSubstitutions": {
1287+
"type": "integer",
1288+
"format": "uint",
1289+
"minimum": 0.0
1290+
},
1291+
"totalUnlabeledSubstitutions": {
1292+
"type": "integer",
1293+
"format": "uint",
1294+
"minimum": 0.0
1295+
},
12701296
"aaChangesGroups": {
12711297
"type": "array",
12721298
"items": {
@@ -1286,6 +1312,25 @@
12861312
}
12871313
}
12881314
},
1315+
"AaSubLabeled": {
1316+
"description": "Labeled aminoacid substitution",
1317+
"type": "object",
1318+
"required": [
1319+
"labels",
1320+
"substitution"
1321+
],
1322+
"properties": {
1323+
"substitution": {
1324+
"$ref": "#/definitions/AaSub"
1325+
},
1326+
"labels": {
1327+
"type": "array",
1328+
"items": {
1329+
"type": "string"
1330+
}
1331+
}
1332+
}
1333+
},
12891334
"CladeNodeAttrFounderInfo": {
12901335
"description": "Information about a clade-like node attribute founder",
12911336
"type": "object",

packages/nextclade-schemas/output-json.schema.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,13 +882,17 @@ definitions:
882882
required:
883883
- aaChangesGroups
884884
- cdsName
885+
- labeledSubstitutions
885886
- privateDeletionRanges
886887
- privateDeletions
887888
- privateSubstitutions
888889
- reversionSubstitutions
890+
- totalLabeledSubstitutions
889891
- totalPrivateDeletions
890892
- totalPrivateSubstitutions
891893
- totalReversionSubstitutions
894+
- totalUnlabeledSubstitutions
895+
- unlabeledSubstitutions
892896
properties:
893897
cdsName:
894898
type: string
@@ -908,6 +912,14 @@ definitions:
908912
type: array
909913
items:
910914
$ref: '#/definitions/AaSub'
915+
labeledSubstitutions:
916+
type: array
917+
items:
918+
$ref: '#/definitions/AaSubLabeled'
919+
unlabeledSubstitutions:
920+
type: array
921+
items:
922+
$ref: '#/definitions/AaSub'
911923
totalPrivateSubstitutions:
912924
type: integer
913925
format: uint
@@ -920,6 +932,14 @@ definitions:
920932
type: integer
921933
format: uint
922934
minimum: 0.0
935+
totalLabeledSubstitutions:
936+
type: integer
937+
format: uint
938+
minimum: 0.0
939+
totalUnlabeledSubstitutions:
940+
type: integer
941+
format: uint
942+
minimum: 0.0
923943
aaChangesGroups:
924944
type: array
925945
items:
@@ -931,6 +951,19 @@ definitions:
931951
properties:
932952
range:
933953
$ref: '#/definitions/Range_for_Position'
954+
AaSubLabeled:
955+
description: Labeled aminoacid substitution
956+
type: object
957+
required:
958+
- labels
959+
- substitution
960+
properties:
961+
substitution:
962+
$ref: '#/definitions/AaSub'
963+
labels:
964+
type: array
965+
items:
966+
type: string
934967
CladeNodeAttrFounderInfo:
935968
description: Information about a clade-like node attribute founder
936969
type: object

packages/nextclade-schemas/output-ndjson.schema.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,17 @@
974974
"required": [
975975
"aaChangesGroups",
976976
"cdsName",
977+
"labeledSubstitutions",
977978
"privateDeletionRanges",
978979
"privateDeletions",
979980
"privateSubstitutions",
980981
"reversionSubstitutions",
982+
"totalLabeledSubstitutions",
981983
"totalPrivateDeletions",
982984
"totalPrivateSubstitutions",
983-
"totalReversionSubstitutions"
985+
"totalReversionSubstitutions",
986+
"totalUnlabeledSubstitutions",
987+
"unlabeledSubstitutions"
984988
],
985989
"properties": {
986990
"cdsName": {
@@ -1010,6 +1014,18 @@
10101014
"$ref": "#/definitions/AaSub"
10111015
}
10121016
},
1017+
"labeledSubstitutions": {
1018+
"type": "array",
1019+
"items": {
1020+
"$ref": "#/definitions/AaSubLabeled"
1021+
}
1022+
},
1023+
"unlabeledSubstitutions": {
1024+
"type": "array",
1025+
"items": {
1026+
"$ref": "#/definitions/AaSub"
1027+
}
1028+
},
10131029
"totalPrivateSubstitutions": {
10141030
"type": "integer",
10151031
"format": "uint",
@@ -1025,6 +1041,16 @@
10251041
"format": "uint",
10261042
"minimum": 0.0
10271043
},
1044+
"totalLabeledSubstitutions": {
1045+
"type": "integer",
1046+
"format": "uint",
1047+
"minimum": 0.0
1048+
},
1049+
"totalUnlabeledSubstitutions": {
1050+
"type": "integer",
1051+
"format": "uint",
1052+
"minimum": 0.0
1053+
},
10281054
"aaChangesGroups": {
10291055
"type": "array",
10301056
"items": {
@@ -1044,6 +1070,25 @@
10441070
}
10451071
}
10461072
},
1073+
"AaSubLabeled": {
1074+
"description": "Labeled aminoacid substitution",
1075+
"type": "object",
1076+
"required": [
1077+
"labels",
1078+
"substitution"
1079+
],
1080+
"properties": {
1081+
"substitution": {
1082+
"$ref": "#/definitions/AaSub"
1083+
},
1084+
"labels": {
1085+
"type": "array",
1086+
"items": {
1087+
"type": "string"
1088+
}
1089+
}
1090+
}
1091+
},
10471092
"CladeNodeAttrFounderInfo": {
10481093
"description": "Information about a clade-like node attribute founder",
10491094
"type": "object",

packages/nextclade-schemas/output-ndjson.schema.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,17 @@ definitions:
718718
required:
719719
- aaChangesGroups
720720
- cdsName
721+
- labeledSubstitutions
721722
- privateDeletionRanges
722723
- privateDeletions
723724
- privateSubstitutions
724725
- reversionSubstitutions
726+
- totalLabeledSubstitutions
725727
- totalPrivateDeletions
726728
- totalPrivateSubstitutions
727729
- totalReversionSubstitutions
730+
- totalUnlabeledSubstitutions
731+
- unlabeledSubstitutions
728732
properties:
729733
cdsName:
730734
type: string
@@ -744,6 +748,14 @@ definitions:
744748
type: array
745749
items:
746750
$ref: '#/definitions/AaSub'
751+
labeledSubstitutions:
752+
type: array
753+
items:
754+
$ref: '#/definitions/AaSubLabeled'
755+
unlabeledSubstitutions:
756+
type: array
757+
items:
758+
$ref: '#/definitions/AaSub'
747759
totalPrivateSubstitutions:
748760
type: integer
749761
format: uint
@@ -756,6 +768,14 @@ definitions:
756768
type: integer
757769
format: uint
758770
minimum: 0.0
771+
totalLabeledSubstitutions:
772+
type: integer
773+
format: uint
774+
minimum: 0.0
775+
totalUnlabeledSubstitutions:
776+
type: integer
777+
format: uint
778+
minimum: 0.0
759779
aaChangesGroups:
760780
type: array
761781
items:
@@ -767,6 +787,19 @@ definitions:
767787
properties:
768788
range:
769789
$ref: '#/definitions/Range_for_Position'
790+
AaSubLabeled:
791+
description: Labeled aminoacid substitution
792+
type: object
793+
required:
794+
- labels
795+
- substitution
796+
properties:
797+
substitution:
798+
$ref: '#/definitions/AaSub'
799+
labels:
800+
type: array
801+
items:
802+
type: string
770803
CladeNodeAttrFounderInfo:
771804
description: Information about a clade-like node attribute founder
772805
type: object

packages/nextclade-web/src/components/Results/ColumnMutations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getSafeId } from 'src/helpers/getSafeId'
99
import { TableSlim } from 'src/components/Common/TableSlim'
1010
import { Tooltip } from 'src/components/Results/Tooltip'
1111
import { ListOfNucMuts } from 'src/components/Results/ListOfNucMuts'
12-
import { ListOfAaSubs } from 'src/components/SequenceView/ListOfAaSubs'
12+
import { ListOfAaMuts } from 'src/components/Results/ListOfAaMuts'
1313
import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
1414

1515
export function ColumnMutations({ analysisResult }: ColumnCladeProps) {
@@ -100,7 +100,7 @@ export function ColumnMutations({ analysisResult }: ColumnCladeProps) {
100100
</tr>
101101
<tr>
102102
<td>
103-
<ListOfAaSubs analysisResult={analysisResult} />
103+
<ListOfAaMuts analysisResult={analysisResult} />
104104
</td>
105105
</tr>
106106
</tbody>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React from 'react'
2+
3+
import type { AaSub } from 'src/types'
4+
import { AminoacidMutationBadge } from 'src/components/Common/MutationBadge'
5+
import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
6+
import { splitToRows } from 'src/components/Results/splitToRows'
7+
import { TableSlim } from 'src/components/Common/TableSlim'
8+
9+
export interface ListOfAaMutationsGenericProps {
10+
substitutions: AaSub[]
11+
}
12+
13+
export function ListOfAaMutationsGeneric({ substitutions }: ListOfAaMutationsGenericProps) {
14+
const { t } = useTranslationSafe()
15+
16+
const totalMutations = substitutions.length
17+
const maxRows = Math.min(8, totalMutations)
18+
const numCols = 8
19+
const substitutionsSelected = substitutions.slice(0, maxRows * numCols)
20+
const columns = splitToRows(substitutionsSelected, { rowLength: maxRows })
21+
22+
let moreText
23+
if (totalMutations > substitutionsSelected.length) {
24+
moreText = t('(truncated)')
25+
}
26+
27+
return (
28+
<div className="d-flex">
29+
<div className="mr-auto">
30+
<TableSlim>
31+
<tbody>
32+
{columns.map((col, i) => (
33+
// eslint-disable-next-line react/no-array-index-key
34+
<tr key={i}>
35+
{col.map((item) => (
36+
<td key={item.pos}>{<AminoacidMutationBadge mutation={item} />}</td>
37+
))}
38+
</tr>
39+
))}
40+
41+
{moreText && (
42+
<tr>
43+
<td colSpan={numCols} className="text-center">
44+
{moreText}
45+
</td>
46+
</tr>
47+
)}
48+
</tbody>
49+
</TableSlim>
50+
</div>
51+
</div>
52+
)
53+
}

0 commit comments

Comments
 (0)