@vitessce/utils 3.5.1 → 3.5.3

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/dist/index.js CHANGED
@@ -380,6 +380,12 @@ function getLongestString(strings) {
380
380
  (prevLongest, currentValue) => prevLongest.length > currentValue.length ? prevLongest : currentValue
381
381
  );
382
382
  }
383
+ function cleanFeatureId(featureName) {
384
+ if (featureName.startsWith("ENSG")) {
385
+ return featureName.split(".")[0];
386
+ }
387
+ return featureName;
388
+ }
383
389
  function getNextScope(prevScopes) {
384
390
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
385
391
  const nextCharIndices = [0];
@@ -628,6 +634,7 @@ export {
628
634
  VIEWER_PALETTE,
629
635
  asEsModule,
630
636
  capitalize,
637
+ cleanFeatureId,
631
638
  commaNumber,
632
639
  copyUint8Array,
633
640
  createDefaultClearPleaseWait,
@@ -1,4 +1,4 @@
1
- export { commaNumber, capitalize, pluralize, getLongestString, getNextScope, getNextScopeNumeric, createPrefixedGetNextScopeNumeric, getInitialCoordinationScopePrefix, getInitialCoordinationScopeName, } from './root.js';
1
+ export { commaNumber, capitalize, pluralize, cleanFeatureId, getLongestString, getNextScope, getNextScopeNumeric, createPrefixedGetNextScopeNumeric, getInitialCoordinationScopePrefix, getInitialCoordinationScopeName, } from './root.js';
2
2
  export { DEFAULT_DARK_COLOR, DEFAULT_LIGHT_COLOR, getDefaultColor, PALETTE, VIEWER_PALETTE, PATHOLOGY_PALETTE, LARGE_PATHOLOGY_PALETTE, COLORMAP_OPTIONS, DEFAULT_GL_OPTIONS, createDefaultUpdateStatus, createDefaultUpdateCellsSelection, createDefaultUpdateCellsHover, createDefaultUpdateGenesHover, createDefaultUpdateTracksHover, createDefaultUpdateViewInfo, createDefaultClearPleaseWait, copyUint8Array, asEsModule, formatBytes, } from './components.js';
3
3
  export { getValueTransformFunction, VALUE_TRANSFORM_OPTIONS, } from './gating.js';
4
4
  export { default as Pool } from './Pool.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,iCAAiC,EACjC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,cAAc,EACd,UAAU,EACV,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,iCAAiC,EACjC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,cAAc,EACd,UAAU,EACV,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC"}
package/dist-tsc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line react-refresh/only-export-components
2
- export { commaNumber, capitalize, pluralize, getLongestString, getNextScope, getNextScopeNumeric, createPrefixedGetNextScopeNumeric, getInitialCoordinationScopePrefix, getInitialCoordinationScopeName, } from './root.js';
2
+ export { commaNumber, capitalize, pluralize, cleanFeatureId, getLongestString, getNextScope, getNextScopeNumeric, createPrefixedGetNextScopeNumeric, getInitialCoordinationScopePrefix, getInitialCoordinationScopeName, } from './root.js';
3
3
  // eslint-disable-next-line react-refresh/only-export-components
4
4
  export { DEFAULT_DARK_COLOR, DEFAULT_LIGHT_COLOR, getDefaultColor, PALETTE, VIEWER_PALETTE, PATHOLOGY_PALETTE, LARGE_PATHOLOGY_PALETTE, COLORMAP_OPTIONS, DEFAULT_GL_OPTIONS, createDefaultUpdateStatus, createDefaultUpdateCellsSelection, createDefaultUpdateCellsHover, createDefaultUpdateGenesHover, createDefaultUpdateTracksHover, createDefaultUpdateViewInfo, createDefaultClearPleaseWait, copyUint8Array, asEsModule, formatBytes, } from './components.js';
5
5
  export { getValueTransformFunction, VALUE_TRANSFORM_OPTIONS, } from './gating.js';
@@ -17,6 +17,13 @@ export declare function pluralize(word: string, count?: number | null): any;
17
17
  * @returns The longest string.
18
18
  */
19
19
  export declare function getLongestString(strings: string[]): string;
20
+ /**
21
+ * Try to clean up a gene ID.
22
+ * For example, remove the version number from an ENSG ID.
23
+ * @param {string} featureName A gene ID.
24
+ * @returns {string} The cleaned gene ID.
25
+ */
26
+ export declare function cleanFeatureId(featureName: string): string;
20
27
  /**
21
28
  * Generate a new scope name which does not
22
29
  * conflict / overlap with a previous scope name.
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.ts"],"names":[],"mappings":"AAOA,wBAAgB,WAAW,CAAC,CAAC,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AE,MAAM,EAAE,UAqChD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,UAQvD;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,MAAM,gBAC1C,MAAM,EAAE,YAS7B;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAGrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAE,MAAM,GAAG,IAAW,UAI9D"}
package/dist-tsc/root.js CHANGED
@@ -31,6 +31,19 @@ export function pluralize(word, count = null) {
31
31
  export function getLongestString(strings) {
32
32
  return strings.reduce((prevLongest, currentValue) => (prevLongest.length > currentValue.length ? prevLongest : currentValue));
33
33
  }
34
+ /**
35
+ * Try to clean up a gene ID.
36
+ * For example, remove the version number from an ENSG ID.
37
+ * @param {string} featureName A gene ID.
38
+ * @returns {string} The cleaned gene ID.
39
+ */
40
+ export function cleanFeatureId(featureName) {
41
+ if (featureName.startsWith('ENSG')) {
42
+ // Strip the version number from the ENSG ID.
43
+ return featureName.split('.')[0];
44
+ }
45
+ return featureName;
46
+ }
34
47
  /**
35
48
  * Generate a new scope name which does not
36
49
  * conflict / overlap with a previous scope name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/utils",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export {
3
3
  commaNumber,
4
4
  capitalize,
5
5
  pluralize,
6
+ cleanFeatureId,
6
7
  getLongestString,
7
8
  getNextScope,
8
9
  getNextScopeNumeric,
package/src/root.ts CHANGED
@@ -41,6 +41,20 @@ export function getLongestString(strings: string[]) {
41
41
  );
42
42
  }
43
43
 
44
+ /**
45
+ * Try to clean up a gene ID.
46
+ * For example, remove the version number from an ENSG ID.
47
+ * @param {string} featureName A gene ID.
48
+ * @returns {string} The cleaned gene ID.
49
+ */
50
+ export function cleanFeatureId(featureName: string) {
51
+ if (featureName.startsWith('ENSG')) {
52
+ // Strip the version number from the ENSG ID.
53
+ return featureName.split('.')[0];
54
+ }
55
+ return featureName;
56
+ }
57
+
44
58
  /**
45
59
  * Generate a new scope name which does not
46
60
  * conflict / overlap with a previous scope name.