covariants
covariants copied to clipboard
Allow clusters.py to take mutations in 'mutation badge' format
Currently clusters.py takes mutations like so:
"mutations":{
"nonsynonymous": [
{'gene': 'S', 'left': 'S', 'pos': 98, 'right': 'F'},
{'gene': 'N', 'left': 'P', 'pos': 199, 'right': 'L'},
{'gene': 'ORF3a', 'left': 'Q', 'pos': 38, 'right': 'R'},
{'gene': 'ORF3a', 'left': 'G', 'pos': 172, 'right': 'R'},
{'gene': 'ORF3a', 'left': 'V', 'pos': 202, 'right': 'L'}
],
"synonymous": [
{'left': 'C', 'pos': 28651, 'right': 'T'}
]
}
},
The idea is we would like it to also take mutations like this:
"S452": {'snps': [21599,22017,22916], 'cluster_data': [], #'CA' variant
"country_info": [], 'build_name': "S.L452R", "display_name": "S:L452R",
'col': "#b30000", 'url_params': "c=gt-S_13,152,452", # color, no europe filter
"mutations":{
"nonsynonymous": [
'S:S13I',
'S:W152C',
'S:L452R',
'ORF1a:I4205V',
'ORF1b:D1183Y'
],
"synonymous": [
'28651T'
]
}
},
However, if you swap the above code in to clusters.py
(in place of mutation S452) it will do the make web-data
just fine, and also build the website just fine.
But when you click on the 452 button, it will give the following error:
ERROR in src/io/getClusters.ts:24:3
TS2322: Type '({ build_name: string; build_url: string; cluster_data: never[]; col: string; country_info: never[]; display_name: string; display_name2: string; mutations: { nonsynonymous: { gene: string; left: string; pos: number; right: string; }[]; synonymous: { ...; }[]; }; snps: number[]; snps2?: undefined; url_params?: undef...' is not assignable to type 'ClusterDatum[]'.
Type '{ build_name: string; build_url: string; cluster_data: never[]; col: string; country_info: never[]; display_name: string; display_name2: string; mutations: { nonsynonymous: { gene: string; left: string; pos: number; right: string; }[]; synonymous: { ...; }[]; }; snps: number[]; snps2?: undefined; url_params?: undefi...' is not assignable to type 'ClusterDatum'.
Type '{ build_name: string; build_url: string; cluster_data: never[]; col: string; country_info: never[]; display_name: string; mutations: { nonsynonymous: string[]; synonymous: { left: string; pos: number; right: string; }[]; }; ... 4 more ...; gaps?: undefined; }' is not assignable to type 'ClusterDatum'.
The types of 'mutations.nonsynonymous' are incompatible between these types.
Type 'string[]' is not assignable to type 'Mutation[]'.
Type 'string' is not assignable to type 'Mutation'.
22 |
23 | export function getClusters(): ClusterDatum[] {
> 24 | return clustersJson.clusters
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 | }
26 |
27 | export function getDefaultCluster(): ClusterDatum {
@ivan-aksamentov Says:
you changed objects to strings, but Typescript types still say objects (type Mutation) (