@@ -4,60 +4,59 @@ import AttributeList, { AttributeListItem } from '../AttributeList'
44import InlineList from '../InlineList'
55import Link from '../Link'
66
7- import { ShortTandemRepeat } from './ShortTandemRepeatPage'
7+ import { ShortTandemRepeat , RepeatUnitClassification } from './ShortTandemRepeatPage'
88
99type ShortTandemRepeatRepeatUnitsProps = {
1010 shortTandemRepeat : ShortTandemRepeat
1111}
1212
1313const ShortTandemRepeatRepeatUnits = ( { shortTandemRepeat } : ShortTandemRepeatRepeatUnitsProps ) => {
14- const repeatUnitsByClassification : Record < string , string [ ] > = { }
14+ const repeatUnitsByClassification : Partial < Record < RepeatUnitClassification , string [ ] > > = { }
1515 shortTandemRepeat . repeat_units . forEach ( ( repeatUnit ) => {
1616 if ( repeatUnitsByClassification [ repeatUnit . classification ] === undefined ) {
1717 repeatUnitsByClassification [ repeatUnit . classification ] = [ ]
1818 }
19- repeatUnitsByClassification [ repeatUnit . classification ] . push ( repeatUnit . repeat_unit )
19+ repeatUnitsByClassification [ repeatUnit . classification ] ! . push ( repeatUnit . repeat_unit )
2020 } )
2121
2222 if (
23- ! ( repeatUnitsByClassification as any ) . pathogenic &&
24- ! ( repeatUnitsByClassification as any ) . benign
23+ ! repeatUnitsByClassification . pathogenic &&
24+ ! repeatUnitsByClassification . benign &&
25+ repeatUnitsByClassification . unknown
2526 ) {
2627 return (
2728 < AttributeListItem
28- label = { `Repeat unit${ ( repeatUnitsByClassification as any ) . unknown . length > 1 ? 's' : '' } ` }
29+ label = { `Repeat unit${ repeatUnitsByClassification . unknown . length > 1 ? 's' : '' } ` }
2930 >
3031 < InlineList
31- items = { ( repeatUnitsByClassification as any ) . unknown . map ( ( repeatUnit : string ) => (
32+ items = { repeatUnitsByClassification . unknown . map ( ( repeatUnit : string ) => (
3233 < span >
3334 { repeatUnit === shortTandemRepeat . reference_repeat_unit &&
3435 shortTandemRepeat . repeat_units . length > 1
3536 ? `${ repeatUnit } (reference)`
3637 : repeatUnit }
3738 </ span >
3839 ) ) }
39- label = { `Repeat unit${ ( repeatUnitsByClassification as any ) . unknown . length > 1 ? 's' : '' } ` }
40+ label = { `Repeat unit${ repeatUnitsByClassification . unknown . length > 1 ? 's' : '' } ` }
4041 />
4142 </ AttributeListItem >
4243 )
4344 }
4445
4546 if (
46- ( repeatUnitsByClassification as any ) . pathogenic &&
47- ( repeatUnitsByClassification as any ) . pathogenic . length === 1 &&
48- ! ( repeatUnitsByClassification as any ) . benign &&
49- ! ( repeatUnitsByClassification as any ) . unknown
47+ repeatUnitsByClassification . pathogenic &&
48+ repeatUnitsByClassification . pathogenic . length === 1 &&
49+ repeatUnitsByClassification . benign &&
50+ repeatUnitsByClassification . unknown
5051 ) {
5152 return (
5253 < >
53- { ( repeatUnitsByClassification as any ) . pathogenic && (
54+ { repeatUnitsByClassification . pathogenic && (
5455 < AttributeListItem
55- label = { `Repeat unit${
56- ( repeatUnitsByClassification as any ) . pathogenic . length > 1 ? 's' : ''
57- } `}
56+ label = { `Repeat unit${ repeatUnitsByClassification . pathogenic . length > 1 ? 's' : '' } ` }
5857 >
5958 < InlineList
60- items = { ( repeatUnitsByClassification as any ) . pathogenic . map ( ( repeatUnit : string ) => (
59+ items = { repeatUnitsByClassification . pathogenic . map ( ( repeatUnit : string ) => (
6160 < span >
6261 { repeatUnit === shortTandemRepeat . reference_repeat_unit &&
6362 shortTandemRepeat . repeat_units . length > 1
@@ -66,7 +65,7 @@ const ShortTandemRepeatRepeatUnits = ({ shortTandemRepeat }: ShortTandemRepeatRe
6665 </ span >
6766 ) ) }
6867 label = { `Pathogenic repeat unit${
69- ( repeatUnitsByClassification as any ) . pathogenic . length > 1 ? 's' : ''
68+ repeatUnitsByClassification . pathogenic . length > 1 ? 's' : ''
7069 } `}
7170 />
7271 </ AttributeListItem >
@@ -77,15 +76,15 @@ const ShortTandemRepeatRepeatUnits = ({ shortTandemRepeat }: ShortTandemRepeatRe
7776
7877 return (
7978 < >
80- { ( repeatUnitsByClassification as any ) . pathogenic && (
79+ { repeatUnitsByClassification . pathogenic && (
8180 < AttributeListItem
8281 label = { `Pathogenic repeat unit${
83- ( repeatUnitsByClassification as any ) . pathogenic . length > 1 ? 's' : ''
82+ repeatUnitsByClassification . pathogenic . length > 1 ? 's' : ''
8483 } `}
8584 tooltip = "These repeat units have been reported in the literature as pathogenic when they expand beyond a certain threshold."
8685 >
8786 < InlineList
88- items = { ( repeatUnitsByClassification as any ) . pathogenic . map ( ( repeatUnit : string ) => (
87+ items = { repeatUnitsByClassification . pathogenic . map ( ( repeatUnit : string ) => (
8988 < span >
9089 { repeatUnit === shortTandemRepeat . reference_repeat_unit &&
9190 shortTandemRepeat . repeat_units . length > 1
@@ -94,52 +93,44 @@ const ShortTandemRepeatRepeatUnits = ({ shortTandemRepeat }: ShortTandemRepeatRe
9493 </ span >
9594 ) ) }
9695 label = { `Pathogenic repeat unit${
97- ( repeatUnitsByClassification as any ) . pathogenic . length > 1 ? 's' : ''
96+ repeatUnitsByClassification . pathogenic . length > 1 ? 's' : ''
9897 } `}
9998 />
10099 </ AttributeListItem >
101100 ) }
102- { ( repeatUnitsByClassification as any ) . benign && (
101+ { repeatUnitsByClassification . benign && (
103102 < AttributeListItem
104- label = { `Benign repeat unit${
105- ( repeatUnitsByClassification as any ) . benign . length > 1 ? 's' : ''
106- } `}
103+ label = { `Benign repeat unit${ repeatUnitsByClassification . benign . length > 1 ? 's' : '' } ` }
107104 tooltip = "These repeat units are regarded in the literature as benign, even when expanded."
108105 >
109106 < InlineList
110- items = { ( repeatUnitsByClassification as any ) . benign . map ( ( repeatUnit : string ) => (
107+ items = { repeatUnitsByClassification . benign . map ( ( repeatUnit : string ) => (
111108 < span >
112109 { repeatUnit === shortTandemRepeat . reference_repeat_unit &&
113110 shortTandemRepeat . repeat_units . length > 1
114111 ? `${ repeatUnit } (reference)`
115112 : repeatUnit }
116113 </ span >
117114 ) ) }
118- label = { `Benign repeat unit${
119- ( repeatUnitsByClassification as any ) . benign . length > 1 ? 's' : ''
120- } `}
115+ label = { `Benign repeat unit${ repeatUnitsByClassification . benign . length > 1 ? 's' : '' } ` }
121116 />
122117 </ AttributeListItem >
123118 ) }
124- { ( repeatUnitsByClassification as any ) . unknown && (
119+ { repeatUnitsByClassification . unknown && (
125120 < AttributeListItem
126- label = { `Other repeat unit${
127- ( repeatUnitsByClassification as any ) . unknown . length > 1 ? 's' : ''
128- } `}
121+ label = { `Other repeat unit${ repeatUnitsByClassification . unknown . length > 1 ? 's' : '' } ` }
129122 tooltip = "These are the other repeat units detected at this locus within gnomAD samples by the call_non_ref_pathogenic_motifs.py script."
130123 >
131124 < InlineList
132- items = { ( repeatUnitsByClassification as any ) . unknown . map ( ( repeatUnit : string ) => (
125+ items = { repeatUnitsByClassification . unknown . map ( ( repeatUnit : string ) => (
133126 < span >
134127 { repeatUnit === shortTandemRepeat . reference_repeat_unit &&
135128 shortTandemRepeat . repeat_units . length > 1
136129 ? `${ repeatUnit } (reference)`
137130 : repeatUnit }
138131 </ span >
139132 ) ) }
140- label = { `Other repeat unit${
141- ( repeatUnitsByClassification as any ) . unknown . length > 1 ? 's' : ''
142- } `}
133+ label = { `Other repeat unit${ repeatUnitsByClassification . unknown . length > 1 ? 's' : '' } ` }
143134 />
144135 </ AttributeListItem >
145136 ) }
0 commit comments