@sjcrh/proteinpaint-shared 2.180.0 → 2.180.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/bulk.cnv.js +30 -30
- package/src/bulk.del.js +48 -48
- package/src/bulk.itd.js +48 -48
- package/src/bulk.js +31 -31
- package/src/bulk.snv.js +109 -72
- package/src/bulk.sv.js +78 -78
- package/src/bulk.svjson.js +33 -31
- package/src/bulk.trunc.js +53 -47
- package/src/clustering.js +27 -27
- package/src/common.js +665 -558
- package/src/compute.percentile.js +3 -1
- package/src/fetch-helpers.js +67 -42
- package/src/fileSize.js +4 -4
- package/src/filter.js +207 -179
- package/src/hash.js +8 -5
- package/src/helpers.js +17 -9
- package/src/index.js +24 -24
- package/src/mds3tk.js +14 -12
- package/src/roundValue.js +5 -4
- package/src/termdb.bins.js +151 -84
- package/src/termdb.initbinconfig.js +46 -18
- package/src/termdb.usecase.js +125 -116
- package/src/terms.js +281 -266
- package/src/tree.js +4 -4
- package/src/vcf.ann.js +9 -9
- package/src/vcf.csq.js +8 -8
- package/src/vcf.info.js +3 -3
- package/src/vcf.js +99 -74
- package/src/vcf.type.js +8 -2
package/src/terms.js
CHANGED
|
@@ -1,309 +1,324 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "./common.js"
|
|
10
|
-
import { TermTypeGroups as TermTypeGroups2 } from "./common.js"
|
|
11
|
-
const ROOT_SAMPLE_TYPE = 1
|
|
12
|
-
const DEFAULT_SAMPLE_TYPE = 2
|
|
2
|
+
dtgeneexpression,
|
|
3
|
+
dtssgsea,
|
|
4
|
+
dtdnamethylation,
|
|
5
|
+
dtmetaboliteintensity,
|
|
6
|
+
dtproteomeabundance,
|
|
7
|
+
TermTypeGroups,
|
|
8
|
+
dtTerms,
|
|
9
|
+
} from "./common.js"
|
|
10
|
+
import { TermTypeGroups as TermTypeGroups2 } from "./common.js"
|
|
11
|
+
const ROOT_SAMPLE_TYPE = 1
|
|
12
|
+
const DEFAULT_SAMPLE_TYPE = 2
|
|
13
13
|
const NumericModes = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
const CATEGORICAL = "categorical"
|
|
18
|
-
const CONDITION = "condition"
|
|
19
|
-
const DATE = "date"
|
|
20
|
-
const DNA_METHYLATION = "dnaMethylation"
|
|
21
|
-
const FLOAT = "float"
|
|
22
|
-
const GENE_VARIANT = "geneVariant"
|
|
23
|
-
const GENE_EXPRESSION = "geneExpression"
|
|
24
|
-
const INTEGER = "integer"
|
|
25
|
-
const METABOLITE_INTENSITY = "metaboliteIntensity"
|
|
26
|
-
const MULTIVALUE = "multivalue"
|
|
27
|
-
const SAMPLELST = "samplelst"
|
|
28
|
-
const SINGLECELL_CELLTYPE = "singleCellCellType"
|
|
29
|
-
const SINGLECELL_GENE_EXPRESSION = "singleCellGeneExpression"
|
|
30
|
-
const SNP = "snp"
|
|
31
|
-
const SNP_LIST = "snplst"
|
|
32
|
-
const SNP_LOCUS = "snplocus"
|
|
33
|
-
const SSGSEA = "ssGSEA"
|
|
34
|
-
const SURVIVAL = "survival"
|
|
35
|
-
const TERM_COLLECTION = "termCollection"
|
|
36
|
-
const
|
|
14
|
+
continuous: "continuous",
|
|
15
|
+
discrete: "discrete",
|
|
16
|
+
}
|
|
17
|
+
const CATEGORICAL = "categorical"
|
|
18
|
+
const CONDITION = "condition"
|
|
19
|
+
const DATE = "date"
|
|
20
|
+
const DNA_METHYLATION = "dnaMethylation"
|
|
21
|
+
const FLOAT = "float"
|
|
22
|
+
const GENE_VARIANT = "geneVariant"
|
|
23
|
+
const GENE_EXPRESSION = "geneExpression"
|
|
24
|
+
const INTEGER = "integer"
|
|
25
|
+
const METABOLITE_INTENSITY = "metaboliteIntensity"
|
|
26
|
+
const MULTIVALUE = "multivalue"
|
|
27
|
+
const SAMPLELST = "samplelst"
|
|
28
|
+
const SINGLECELL_CELLTYPE = "singleCellCellType"
|
|
29
|
+
const SINGLECELL_GENE_EXPRESSION = "singleCellGeneExpression"
|
|
30
|
+
const SNP = "snp"
|
|
31
|
+
const SNP_LIST = "snplst"
|
|
32
|
+
const SNP_LOCUS = "snplocus"
|
|
33
|
+
const SSGSEA = "ssGSEA"
|
|
34
|
+
const SURVIVAL = "survival"
|
|
35
|
+
const TERM_COLLECTION = "termCollection"
|
|
36
|
+
const PROTEOME_ABUNDANCE = "proteomeAbundance"
|
|
37
37
|
const TermTypes = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
const dtTermTypes = new Set(dtTerms.map((t) => t.type))
|
|
38
|
+
GENE_VARIANT,
|
|
39
|
+
GENE_EXPRESSION,
|
|
40
|
+
SSGSEA,
|
|
41
|
+
DNA_METHYLATION,
|
|
42
|
+
CATEGORICAL,
|
|
43
|
+
INTEGER,
|
|
44
|
+
FLOAT,
|
|
45
|
+
SNP,
|
|
46
|
+
SNP_LIST,
|
|
47
|
+
SNP_LOCUS,
|
|
48
|
+
CONDITION,
|
|
49
|
+
SURVIVAL,
|
|
50
|
+
SAMPLELST,
|
|
51
|
+
METABOLITE_INTENSITY,
|
|
52
|
+
PROTEOME_ABUNDANCE,
|
|
53
|
+
SINGLECELL_CELLTYPE,
|
|
54
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
55
|
+
MULTIVALUE,
|
|
56
|
+
DATE,
|
|
57
|
+
TERM_COLLECTION,
|
|
58
|
+
}
|
|
59
|
+
const dtTermTypes = new Set(dtTerms.map((t) => t.type))
|
|
60
60
|
for (const dtTermType of dtTermTypes) {
|
|
61
|
-
|
|
61
|
+
TermTypes[dtTermType.toUpperCase()] = dtTermType
|
|
62
62
|
}
|
|
63
|
-
const NUMERIC_DICTIONARY_TERM = "numericDictTerm";
|
|
64
63
|
const TermTypes2Dt = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
64
|
+
[GENE_EXPRESSION]: dtgeneexpression,
|
|
65
|
+
[SSGSEA]: dtssgsea,
|
|
66
|
+
[DNA_METHYLATION]: dtdnamethylation,
|
|
67
|
+
[METABOLITE_INTENSITY]: dtmetaboliteintensity,
|
|
68
|
+
[PROTEOME_ABUNDANCE]: dtproteomeabundance,
|
|
69
|
+
}
|
|
71
70
|
const typeGroup = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
71
|
+
[CATEGORICAL]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
72
|
+
[CONDITION]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
73
|
+
[FLOAT]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
74
|
+
[INTEGER]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
75
|
+
[SAMPLELST]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
76
|
+
[SURVIVAL]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
77
|
+
[DATE]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
78
|
+
[MULTIVALUE]: TermTypeGroups.DICTIONARY_VARIABLES,
|
|
79
|
+
[GENE_VARIANT]: TermTypeGroups.MUTATION_CNV_FUSION,
|
|
80
|
+
[SNP]: TermTypeGroups.SNP,
|
|
81
|
+
[SNP_LIST]: TermTypeGroups.SNP_LIST,
|
|
82
|
+
[SNP_LOCUS]: TermTypeGroups.SNP_LOCUS,
|
|
83
|
+
[GENE_EXPRESSION]: TermTypeGroups.GENE_EXPRESSION,
|
|
84
|
+
[SSGSEA]: TermTypeGroups.SSGSEA,
|
|
85
|
+
[DNA_METHYLATION]: TermTypeGroups.DNA_METHYLATION,
|
|
86
|
+
[METABOLITE_INTENSITY]: TermTypeGroups.METABOLITE_INTENSITY,
|
|
87
|
+
[PROTEOME_ABUNDANCE]: TermTypeGroups.PROTEOME_ABUNDANCE,
|
|
88
|
+
[TERM_COLLECTION]: TermTypeGroups.TERM_COLLECTION,
|
|
89
|
+
[SINGLECELL_CELLTYPE]: TermTypeGroups.SINGLECELL_CELLTYPE,
|
|
90
|
+
[SINGLECELL_GENE_EXPRESSION]: TermTypeGroups.SINGLECELL_GENE_EXPRESSION,
|
|
91
|
+
}
|
|
93
92
|
const nonDictTypes = /* @__PURE__ */ new Set([
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
])
|
|
93
|
+
SNP,
|
|
94
|
+
SNP_LIST,
|
|
95
|
+
SNP_LOCUS,
|
|
96
|
+
GENE_EXPRESSION,
|
|
97
|
+
SSGSEA,
|
|
98
|
+
DNA_METHYLATION,
|
|
99
|
+
GENE_VARIANT,
|
|
100
|
+
METABOLITE_INTENSITY,
|
|
101
|
+
PROTEOME_ABUNDANCE,
|
|
102
|
+
SINGLECELL_CELLTYPE,
|
|
103
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
104
|
+
])
|
|
106
105
|
for (const dtTermType of dtTermTypes) {
|
|
107
|
-
|
|
106
|
+
nonDictTypes.add(TermTypes[dtTermType.toUpperCase()])
|
|
108
107
|
}
|
|
109
108
|
const numericTypes = /* @__PURE__ */ new Set([
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
])
|
|
120
|
-
const annoNumericTypes = /* @__PURE__ */ new Set([INTEGER, FLOAT, DATE])
|
|
121
|
-
const categoricalTypes = /* @__PURE__ */ new Set([CATEGORICAL, SNP])
|
|
122
|
-
const singleCellTerms = /* @__PURE__ */ new Set([
|
|
109
|
+
INTEGER,
|
|
110
|
+
FLOAT,
|
|
111
|
+
GENE_EXPRESSION,
|
|
112
|
+
SSGSEA,
|
|
113
|
+
DNA_METHYLATION,
|
|
114
|
+
METABOLITE_INTENSITY,
|
|
115
|
+
PROTEOME_ABUNDANCE,
|
|
116
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
117
|
+
DATE,
|
|
118
|
+
])
|
|
119
|
+
const annoNumericTypes = /* @__PURE__ */ new Set([INTEGER, FLOAT, DATE])
|
|
120
|
+
const categoricalTypes = /* @__PURE__ */ new Set([CATEGORICAL, SNP])
|
|
121
|
+
const singleCellTerms = /* @__PURE__ */ new Set([
|
|
122
|
+
SINGLECELL_CELLTYPE,
|
|
123
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
124
|
+
])
|
|
123
125
|
function isSingleCellTerm(term) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
if (!term) return false
|
|
127
|
+
return singleCellTerms.has(term.type)
|
|
126
128
|
}
|
|
127
129
|
function isNumericTerm(term) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
if (!term) return false
|
|
131
|
+
return numericTypes.has(term.type)
|
|
130
132
|
}
|
|
131
133
|
function isCategoricalTerm(term) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
if (!term) return false
|
|
135
|
+
return categoricalTypes.has(term.type)
|
|
134
136
|
}
|
|
135
137
|
function isDictionaryType(type) {
|
|
136
|
-
|
|
138
|
+
return !isNonDictionaryType(type)
|
|
137
139
|
}
|
|
138
140
|
function isNonDictionaryType(type) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
if (!type) throw new Error("Type is not defined")
|
|
142
|
+
return nonDictTypes.has(type)
|
|
141
143
|
}
|
|
142
144
|
function equals(t1, t2) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
145
|
+
if (!t1) throw new Error("First term is not defined ")
|
|
146
|
+
if (!t2) throw new Error("Second term is not defined ")
|
|
147
|
+
if (t1.type !== t2.type) return false
|
|
148
|
+
if (
|
|
149
|
+
isDictionaryType(t1.type) &&
|
|
150
|
+
isDictionaryType(t2.type) &&
|
|
151
|
+
t1.type != SAMPLELST
|
|
152
|
+
)
|
|
153
|
+
return t1.id === t2.id
|
|
154
|
+
switch (t1.type) {
|
|
155
|
+
case GENE_EXPRESSION:
|
|
156
|
+
return t1.gene == t2.gene
|
|
157
|
+
case SSGSEA:
|
|
158
|
+
return t1.id == t2.id
|
|
159
|
+
case DNA_METHYLATION:
|
|
160
|
+
return t1.chr == t2.chr && t1.start == t2.start && t1.stop == t2.stop
|
|
161
|
+
case METABOLITE_INTENSITY:
|
|
162
|
+
case PROTEOME_ABUNDANCE:
|
|
163
|
+
return t1.name == t2.name
|
|
164
|
+
case GENE_VARIANT:
|
|
165
|
+
return (
|
|
166
|
+
t1.gene == t2.gene ||
|
|
167
|
+
(t1.chr == t2.chr && t1.start == t2.start && t1.stop == t2.stop)
|
|
168
|
+
)
|
|
169
|
+
// TO DO: Add more cases
|
|
170
|
+
// case SNP_LIST:
|
|
171
|
+
// case SNP_LOCUS:
|
|
172
|
+
// case SAMPLELST:
|
|
173
|
+
default:
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
166
176
|
}
|
|
167
177
|
function getBin(lst, value) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
let bin = lst.findIndex(
|
|
179
|
+
(b) =>
|
|
180
|
+
(b.startunbounded && value < b.stop) ||
|
|
181
|
+
(b.startunbounded && b.stopinclusive && value == b.stop)
|
|
182
|
+
)
|
|
183
|
+
if (bin == -1)
|
|
184
|
+
bin = lst.findIndex(
|
|
185
|
+
(b) =>
|
|
186
|
+
(b.stopunbounded && value > b.start) ||
|
|
187
|
+
(b.stopunbounded && b.startinclusive && value == b.start)
|
|
188
|
+
)
|
|
189
|
+
if (bin == -1)
|
|
190
|
+
bin = lst.findIndex(
|
|
191
|
+
(b) =>
|
|
192
|
+
(value > b.start && value < b.stop) ||
|
|
193
|
+
(b.startinclusive && value == b.start) ||
|
|
194
|
+
(b.stopinclusive && value == b.stop)
|
|
195
|
+
)
|
|
196
|
+
return bin
|
|
180
197
|
}
|
|
181
198
|
function getSampleType(term, ds) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
if (!term) return null
|
|
200
|
+
if (term.type && isNonDictionaryType(term.type)) return DEFAULT_SAMPLE_TYPE
|
|
201
|
+
if (term.id) return ds.cohort.termdb.term2SampleType.get(term.id)
|
|
202
|
+
if (term.type == "samplelst") {
|
|
203
|
+
const key = Object.keys(term.values)[0]
|
|
204
|
+
const sampleId = term.values[key].list[0]?.sampleId
|
|
205
|
+
if (sampleId) return ds.sampleId2Type.get(Number(sampleId) || sampleId)
|
|
206
|
+
else return DEFAULT_SAMPLE_TYPE
|
|
207
|
+
}
|
|
208
|
+
return DEFAULT_SAMPLE_TYPE
|
|
192
209
|
}
|
|
193
210
|
function getParentType(types, ds) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
if (Object.keys(ds.cohort.termdb.sampleTypes).length == 0) return null
|
|
212
|
+
const ids = Array.from(types)
|
|
213
|
+
if (!ids || ids.length == 0) return null
|
|
214
|
+
for (const id of ids) {
|
|
215
|
+
const typeObj = ds.cohort.termdb.sampleTypes[id]
|
|
216
|
+
if (!typeObj) continue
|
|
217
|
+
if (typeObj.parent_id == null) return id
|
|
218
|
+
if (ids.includes(typeObj.parent_id)) continue
|
|
219
|
+
else return typeObj.parent_id
|
|
220
|
+
}
|
|
221
|
+
return null
|
|
205
222
|
}
|
|
206
223
|
const typeMap = {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
};
|
|
224
|
+
categorical: "Categorical",
|
|
225
|
+
condition: "Condition",
|
|
226
|
+
float: "Numerical",
|
|
227
|
+
integer: "Numerical",
|
|
228
|
+
geneExpression: "Gene Expression",
|
|
229
|
+
ssGSEA: "Geneset Expression",
|
|
230
|
+
dnaMethylation: "DNA Methylation",
|
|
231
|
+
geneVariant: "Gene Variant",
|
|
232
|
+
metaboliteIntensity: "Metabolite Intensity",
|
|
233
|
+
proteomeAbundance: "Whole Proteome Abundance",
|
|
234
|
+
multivalue: "Multi Value",
|
|
235
|
+
singleCellGeneExpression: "Single Cell, Gene Expression",
|
|
236
|
+
singleCellCellType: "Single Cell, Cell Type",
|
|
237
|
+
snplocus: "SNP Locus",
|
|
238
|
+
snp: "SNP",
|
|
239
|
+
snplst: "SNP List",
|
|
240
|
+
termCollection: "Term Collection",
|
|
241
|
+
}
|
|
226
242
|
function termType2label(type) {
|
|
227
|
-
|
|
243
|
+
return typeMap[type] || "Unknown term type"
|
|
228
244
|
}
|
|
229
245
|
function getDateFromNumber(value) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
246
|
+
const year = Math.floor(value)
|
|
247
|
+
const january1st = new Date(year, 0, 1)
|
|
248
|
+
const totalDays = getDaysInYear(year)
|
|
249
|
+
const time = Math.round((value - year) * totalDays) * oneDayTime
|
|
250
|
+
const date = new Date(january1st.getTime() + time)
|
|
251
|
+
return date
|
|
236
252
|
}
|
|
237
|
-
const oneDayTime = 24 * 60 * 60 * 1e3
|
|
253
|
+
const oneDayTime = 24 * 60 * 60 * 1e3
|
|
238
254
|
function getDateStrFromNumber(value) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
255
|
+
const date = getDateFromNumber(value)
|
|
256
|
+
return date.toLocaleDateString("en-US", {
|
|
257
|
+
year: "numeric",
|
|
258
|
+
month: "long",
|
|
259
|
+
})
|
|
244
260
|
}
|
|
245
261
|
function getNumberFromDateStr(str) {
|
|
246
|
-
|
|
247
|
-
|
|
262
|
+
const date = new Date(str)
|
|
263
|
+
return getNumberFromDate(date)
|
|
248
264
|
}
|
|
249
265
|
function getNumberFromDate(date) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
const year = date.getFullYear()
|
|
267
|
+
const january1st = new Date(year, 0, 1)
|
|
268
|
+
const diffDays = (date.getTime() - january1st.getTime()) / oneDayTime
|
|
269
|
+
const daysTotal = getDaysInYear(year)
|
|
270
|
+
const decimal = diffDays / daysTotal
|
|
271
|
+
return year + decimal
|
|
256
272
|
}
|
|
257
273
|
function getDaysInYear(year) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
274
|
+
const isLeap = new Date(year, 1, 29).getMonth() === 1
|
|
275
|
+
const days = isLeap ? 366 : 365
|
|
276
|
+
return days
|
|
261
277
|
}
|
|
262
278
|
export {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
279
|
+
CATEGORICAL,
|
|
280
|
+
CONDITION,
|
|
281
|
+
DATE,
|
|
282
|
+
DEFAULT_SAMPLE_TYPE,
|
|
283
|
+
DNA_METHYLATION,
|
|
284
|
+
FLOAT,
|
|
285
|
+
GENE_EXPRESSION,
|
|
286
|
+
GENE_VARIANT,
|
|
287
|
+
INTEGER,
|
|
288
|
+
METABOLITE_INTENSITY,
|
|
289
|
+
MULTIVALUE,
|
|
290
|
+
NumericModes,
|
|
291
|
+
PROTEOME_ABUNDANCE,
|
|
292
|
+
ROOT_SAMPLE_TYPE,
|
|
293
|
+
SAMPLELST,
|
|
294
|
+
SINGLECELL_CELLTYPE,
|
|
295
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
296
|
+
SNP,
|
|
297
|
+
SNP_LIST,
|
|
298
|
+
SNP_LOCUS,
|
|
299
|
+
SSGSEA,
|
|
300
|
+
SURVIVAL,
|
|
301
|
+
TERM_COLLECTION,
|
|
302
|
+
TermTypeGroups2 as TermTypeGroups,
|
|
303
|
+
TermTypes,
|
|
304
|
+
TermTypes2Dt,
|
|
305
|
+
annoNumericTypes,
|
|
306
|
+
dtTermTypes,
|
|
307
|
+
equals,
|
|
308
|
+
getBin,
|
|
309
|
+
getDateFromNumber,
|
|
310
|
+
getDateStrFromNumber,
|
|
311
|
+
getDaysInYear,
|
|
312
|
+
getNumberFromDate,
|
|
313
|
+
getNumberFromDateStr,
|
|
314
|
+
getParentType,
|
|
315
|
+
getSampleType,
|
|
316
|
+
isCategoricalTerm,
|
|
317
|
+
isDictionaryType,
|
|
318
|
+
isNonDictionaryType,
|
|
319
|
+
isNumericTerm,
|
|
320
|
+
isSingleCellTerm,
|
|
321
|
+
numericTypes,
|
|
322
|
+
termType2label,
|
|
323
|
+
typeGroup,
|
|
324
|
+
}
|
package/src/tree.js
CHANGED
|
@@ -29,8 +29,8 @@ using Map for lp, nodes etc will cause memory issue, thus the use of simple obje
|
|
|
29
29
|
to-do: verify this works after a reorg
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
const hardcode_root =
|
|
33
|
-
const hierarchy_spacer =
|
|
32
|
+
const hardcode_root = "root"
|
|
33
|
+
const hierarchy_spacer = "..."
|
|
34
34
|
|
|
35
35
|
export function stratinput(lst, levels) {
|
|
36
36
|
const lp = Object.create(null)
|
|
@@ -75,7 +75,7 @@ export function stratinput(lst, levels) {
|
|
|
75
75
|
}
|
|
76
76
|
if (!(thisv in nodes)) {
|
|
77
77
|
const n = {
|
|
78
|
-
lst: []
|
|
78
|
+
lst: [],
|
|
79
79
|
}
|
|
80
80
|
if (lev.full) {
|
|
81
81
|
n.full = m[lev.full]
|
|
@@ -119,7 +119,7 @@ export function stratinput(lst, levels) {
|
|
|
119
119
|
id1: n.id1,
|
|
120
120
|
v1: n.v1,
|
|
121
121
|
id2: n.id2,
|
|
122
|
-
v2: n.v2
|
|
122
|
+
v2: n.v2,
|
|
123
123
|
})
|
|
124
124
|
}
|
|
125
125
|
return nlst
|
package/src/vcf.ann.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { vepinfo } from
|
|
1
|
+
import { vepinfo } from "./common.js"
|
|
2
2
|
|
|
3
3
|
export function parse_ANN(str, header, m) {
|
|
4
4
|
// snpEff
|
|
5
5
|
if (!header) {
|
|
6
6
|
return null
|
|
7
7
|
}
|
|
8
|
-
for (const thisannotation of str.split(
|
|
9
|
-
const lst = thisannotation.replace(/&/g,
|
|
8
|
+
for (const thisannotation of str.split(",")) {
|
|
9
|
+
const lst = thisannotation.replace(/&/g, ",").split("|")
|
|
10
10
|
|
|
11
11
|
const o = {}
|
|
12
12
|
|
|
@@ -35,8 +35,8 @@ export function parse_ANN(str, header, m) {
|
|
|
35
35
|
allele.ann.push(o)
|
|
36
36
|
o._gene = o.Gene_Name
|
|
37
37
|
// isoform
|
|
38
|
-
if (o.Feature_Type && o.Feature_Type ==
|
|
39
|
-
o._isoform = o.Feature_ID.split(
|
|
38
|
+
if (o.Feature_Type && o.Feature_Type == "transcript" && o.Feature_ID) {
|
|
39
|
+
o._isoform = o.Feature_ID.split(".")[0]
|
|
40
40
|
}
|
|
41
41
|
// class
|
|
42
42
|
if (o.Annotation) {
|
|
@@ -50,11 +50,11 @@ export function parse_ANN(str, header, m) {
|
|
|
50
50
|
o._class = mclassnonstandard
|
|
51
51
|
}
|
|
52
52
|
// mname
|
|
53
|
-
if (o[
|
|
53
|
+
if (o["HGVS.p"]) {
|
|
54
54
|
//o._mname=decodeURIComponent(o.HGVSp.substr(o.HGVSp.indexOf(':')+1))
|
|
55
|
-
o._mname = o[
|
|
56
|
-
} else if (o[
|
|
57
|
-
o._mname = o[
|
|
55
|
+
o._mname = o["HGVS.p"]
|
|
56
|
+
} else if (o["HGVS.c"]) {
|
|
57
|
+
o._mname = o["HGVS.c"]
|
|
58
58
|
} else {
|
|
59
59
|
}
|
|
60
60
|
}
|