@sjcrh/proteinpaint-shared 2.180.1 → 2.181.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-shared",
3
- "version": "2.180.1",
3
+ "version": "2.181.0",
4
4
  "description": "ProteinPaint code that is shared between server and client-side workspaces",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/common.js CHANGED
@@ -15,27 +15,32 @@ import { getWrappedTvslst } from "./filter.js"
15
15
 
16
16
  // moved from `#shared/terms` to here, so that this can be passed as
17
17
  // part of 'common' argument to exported dataset js function, at server runtime
18
- export const TermTypeGroups = {
19
- DICTIONARY_VARIABLES: "Dictionary Variables",
20
- DNA_METHYLATION: "DNA Methylation",
21
- GENE_DEPENDENCY: "Gene Dependency",
22
- GENE_EXPRESSION: "Gene Expression",
23
- GSEA: "GSEA",
24
- METABOLITE_INTENSITY: "Metabolite Intensity",
25
- PROTEOME_ABUNDANCE: "Whole Proteome Abundance",
26
- MUTATION_CNV_FUSION: "Mutation/CNV/Fusion",
27
- MUTATION_SIGNATURE: "Mutation Signature",
28
- PROTEIN_EXPRESSION: "Protein Expression",
29
- SINGLECELL_CELLTYPE: "Single-cell Cell Type",
30
- SINGLECELL_GENE_EXPRESSION: "Single-cell Gene Expression",
31
- SNP: "SNP Genotype",
32
- SNP_LIST: "SNP List",
33
- SNP_LOCUS: "SNP Locus",
34
- SPLICE_JUNCTION: "Splice Junction",
35
- SSGSEA: "Geneset Expression",
36
- TERM_COLLECTION: "Term Collection",
37
- VARIANT_GENOTYPE: "Variant Genotype",
38
- }
18
+ // 3/30/2026 - changed from literal object to a class with static properties
19
+ // to make it easier for IDEs and tsc compiler to catch typos in consumer code
20
+ export class TermTypeGroups {
21
+ static DICTIONARY_VARIABLES = "Dictionary Variables"
22
+ static DNA_METHYLATION = "DNA Methylation"
23
+ static GENE_DEPENDENCY = "Gene Dependency"
24
+ static GENE_EXPRESSION = "Gene Expression"
25
+ static ISOFORM_EXPRESSION = "Isoform Expression"
26
+ static GSEA = "GSEA"
27
+ static METABOLITE_INTENSITY = "Metabolite Intensity"
28
+ static PROTEOME_ABUNDANCE = "Whole Proteome Abundance"
29
+ static MUTATION_CNV_FUSION = "Mutation/CNV/Fusion"
30
+ static MUTATION_SIGNATURE = "Mutation Signature"
31
+ static PROTEIN_EXPRESSION = "Protein Expression"
32
+ static SINGLECELL_CELLTYPE = "Single-cell Cell Type"
33
+ static SINGLECELL_GENE_EXPRESSION = "Single-cell Gene Expression"
34
+ static SNP = "SNP Genotype"
35
+ static SNP_LIST = "SNP List"
36
+ static SNP_LOCUS = "SNP Locus"
37
+ static SPLICE_JUNCTION = "Splice Junction"
38
+ static SSGSEA = "Geneset Expression"
39
+ static TERM_COLLECTION = "Term Collection"
40
+ static VARIANT_GENOTYPE = "Variant Genotype"
41
+ }
42
+ // freeze so that mutating any of the static properties above will throw at runtime
43
+ Object.freeze(TermTypeGroups)
39
44
 
40
45
  export const defaultcolor = rgb("#8AB1D4").darker()
41
46
  export const default_text_color = rgb("#aaa").darker().darker()
@@ -3,6 +3,7 @@ import {
3
3
  isNumericTerm,
4
4
  SINGLECELL_CELLTYPE,
5
5
  SINGLECELL_GENE_EXPRESSION,
6
+ ISOFORM_EXPRESSION,
6
7
  } from "./terms.js"
7
8
 
8
9
  export const graphableTypes = new Set([
@@ -16,6 +17,7 @@ export const graphableTypes = new Set([
16
17
  "geneVariant",
17
18
  "samplelst",
18
19
  "geneExpression",
20
+ ISOFORM_EXPRESSION,
19
21
  "dtcnv",
20
22
  "dtsnvindel",
21
23
  "dtfusion",
package/src/terms.js CHANGED
@@ -21,6 +21,7 @@ const DNA_METHYLATION = "dnaMethylation"
21
21
  const FLOAT = "float"
22
22
  const GENE_VARIANT = "geneVariant"
23
23
  const GENE_EXPRESSION = "geneExpression"
24
+ const ISOFORM_EXPRESSION = "isoformExpression"
24
25
  const INTEGER = "integer"
25
26
  const METABOLITE_INTENSITY = "metaboliteIntensity"
26
27
  const MULTIVALUE = "multivalue"
@@ -37,6 +38,7 @@ const PROTEOME_ABUNDANCE = "proteomeAbundance"
37
38
  const TermTypes = {
38
39
  GENE_VARIANT,
39
40
  GENE_EXPRESSION,
41
+ ISOFORM_EXPRESSION,
40
42
  SSGSEA,
41
43
  DNA_METHYLATION,
42
44
  CATEGORICAL,
@@ -81,6 +83,7 @@ const typeGroup = {
81
83
  [SNP_LIST]: TermTypeGroups.SNP_LIST,
82
84
  [SNP_LOCUS]: TermTypeGroups.SNP_LOCUS,
83
85
  [GENE_EXPRESSION]: TermTypeGroups.GENE_EXPRESSION,
86
+ [ISOFORM_EXPRESSION]: TermTypeGroups.ISOFORM_EXPRESSION,
84
87
  [SSGSEA]: TermTypeGroups.SSGSEA,
85
88
  [DNA_METHYLATION]: TermTypeGroups.DNA_METHYLATION,
86
89
  [METABOLITE_INTENSITY]: TermTypeGroups.METABOLITE_INTENSITY,
@@ -94,6 +97,7 @@ const nonDictTypes = /* @__PURE__ */ new Set([
94
97
  SNP_LIST,
95
98
  SNP_LOCUS,
96
99
  GENE_EXPRESSION,
100
+ ISOFORM_EXPRESSION,
97
101
  SSGSEA,
98
102
  DNA_METHYLATION,
99
103
  GENE_VARIANT,
@@ -109,6 +113,7 @@ const numericTypes = /* @__PURE__ */ new Set([
109
113
  INTEGER,
110
114
  FLOAT,
111
115
  GENE_EXPRESSION,
116
+ ISOFORM_EXPRESSION,
112
117
  SSGSEA,
113
118
  DNA_METHYLATION,
114
119
  METABOLITE_INTENSITY,
@@ -141,6 +146,10 @@ function isNonDictionaryType(type) {
141
146
  if (!type) throw new Error("Type is not defined")
142
147
  return nonDictTypes.has(type)
143
148
  }
149
+ function isNumTermCollection(term) {
150
+ if (!term || !term.type) throw new Error("Term or term type is not defined")
151
+ return term.type === TERM_COLLECTION
152
+ }
144
153
  function equals(t1, t2) {
145
154
  if (!t1) throw new Error("First term is not defined ")
146
155
  if (!t2) throw new Error("Second term is not defined ")
@@ -154,6 +163,8 @@ function equals(t1, t2) {
154
163
  switch (t1.type) {
155
164
  case GENE_EXPRESSION:
156
165
  return t1.gene == t2.gene
166
+ case ISOFORM_EXPRESSION:
167
+ return t1.isoform == t2.isoform
157
168
  case SSGSEA:
158
169
  return t1.id == t2.id
159
170
  case DNA_METHYLATION:
@@ -226,6 +237,7 @@ const typeMap = {
226
237
  float: "Numerical",
227
238
  integer: "Numerical",
228
239
  geneExpression: "Gene Expression",
240
+ isoformExpression: "Isoform Expression",
229
241
  ssGSEA: "Geneset Expression",
230
242
  dnaMethylation: "DNA Methylation",
231
243
  geneVariant: "Gene Variant",
@@ -285,6 +297,7 @@ export {
285
297
  GENE_EXPRESSION,
286
298
  GENE_VARIANT,
287
299
  INTEGER,
300
+ ISOFORM_EXPRESSION,
288
301
  METABOLITE_INTENSITY,
289
302
  MULTIVALUE,
290
303
  NumericModes,
@@ -316,6 +329,7 @@ export {
316
329
  isCategoricalTerm,
317
330
  isDictionaryType,
318
331
  isNonDictionaryType,
332
+ isNumTermCollection,
319
333
  isNumericTerm,
320
334
  isSingleCellTerm,
321
335
  numericTypes,