@vitessce/csv 3.3.3 → 3.3.5

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.
Files changed (2) hide show
  1. package/dist/index.js +133 -132
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -298,6 +298,7 @@ const FileType$1 = {
298
298
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
299
299
  // AnnData
300
300
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
301
+ OBS_FEATURE_COLUMNS_ANNDATA_ZARR: "obsFeatureColumns.anndata.zarr",
301
302
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
302
303
  OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
303
304
  OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
@@ -861,9 +862,6 @@ var pluralizeExports = pluralize.exports;
861
862
  const plur = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
862
863
  plur.addPluralRule("glomerulus", "glomeruli");
863
864
  plur.addPluralRule("interstitium", "interstitia");
864
- function fromEntries(iterable) {
865
- return [...iterable].reduce((obj, { 0: key, 1: val }) => Object.assign(obj, { [key]: val }), {});
866
- }
867
865
  function capitalize(word) {
868
866
  return word ? word.charAt(0).toUpperCase() + word.slice(1) : "";
869
867
  }
@@ -907,6 +905,134 @@ const PALETTE = [
907
905
  [136, 34, 85],
908
906
  [170, 68, 153]
909
907
  ];
908
+ class CoordinationLevel {
909
+ constructor(value) {
910
+ this.value = value;
911
+ this.cachedValue = null;
912
+ }
913
+ setCached(processedLevel) {
914
+ this.cachedValue = processedLevel;
915
+ }
916
+ getCached() {
917
+ return this.cachedValue;
918
+ }
919
+ isCached() {
920
+ return this.cachedValue !== null;
921
+ }
922
+ }
923
+ function CL(value) {
924
+ return new CoordinationLevel(value);
925
+ }
926
+ class ObsSpotsCsvLoader extends CsvLoader {
927
+ loadFromCache(data) {
928
+ if (this.cachedResult) {
929
+ return this.cachedResult;
930
+ }
931
+ const { obsIndex: indexCol, obsSpots: [xCol, yCol] } = this.options;
932
+ const obsIndex = data.map((d) => String(d[indexCol]));
933
+ const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
934
+ const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
935
+ const obsSpots = {
936
+ data: [obsLocationsX, obsLocationsY],
937
+ shape: [2, obsLocationsX.length]
938
+ };
939
+ this.cachedResult = { obsIndex, obsSpots };
940
+ return this.cachedResult;
941
+ }
942
+ async load() {
943
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
944
+ if (payload instanceof AbstractLoaderError) {
945
+ return Promise.reject(payload);
946
+ }
947
+ const coordinationValues = {
948
+ spotLayer: CL({
949
+ obsType: "spot",
950
+ // obsColorEncoding: 'spatialLayerColor',
951
+ // spatialLayerColor: [255, 255, 255],
952
+ spatialLayerVisible: true,
953
+ spatialLayerOpacity: 1,
954
+ spatialSpotRadius: 10
955
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
956
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
957
+ // featureValueColormapRange: [0, 1],
958
+ // obsHighlight: null,
959
+ // obsSetColor: null,
960
+ // obsSetSelection: null,
961
+ // additionalObsSets: null,
962
+ })
963
+ };
964
+ const { data, url } = payload;
965
+ const result = this.loadFromCache(data);
966
+ return Promise.resolve(new LoaderResult(
967
+ result,
968
+ url,
969
+ coordinationValues
970
+ ));
971
+ }
972
+ }
973
+ class ObsPointsCsvLoader extends CsvLoader {
974
+ loadFromCache(data) {
975
+ if (this.cachedResult) {
976
+ return this.cachedResult;
977
+ }
978
+ const { obsIndex: indexCol, obsPoints: [xCol, yCol] } = this.options;
979
+ const obsIndex = data.map((d) => String(d[indexCol]));
980
+ const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
981
+ const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
982
+ const obsPoints = {
983
+ data: [obsLocationsX, obsLocationsY],
984
+ shape: [2, obsLocationsX.length]
985
+ };
986
+ this.cachedResult = { obsIndex, obsPoints };
987
+ return this.cachedResult;
988
+ }
989
+ async load() {
990
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
991
+ if (payload instanceof AbstractLoaderError) {
992
+ return Promise.reject(payload);
993
+ }
994
+ const coordinationValues = {
995
+ pointLayer: CL({
996
+ obsType: "point",
997
+ // obsColorEncoding: 'spatialLayerColor',
998
+ // spatialLayerColor: [255, 255, 255],
999
+ spatialLayerVisible: true,
1000
+ spatialLayerOpacity: 1
1001
+ // TODO: support a point radius?
1002
+ // featureValueColormapRange: [0, 1],
1003
+ // obsHighlight: null,
1004
+ // obsSetColor: null,
1005
+ // obsSetSelection: null,
1006
+ // additionalObsSets: null,
1007
+ // obsLabelsType: null,
1008
+ })
1009
+ };
1010
+ const { data, url } = payload;
1011
+ const result = this.loadFromCache(data);
1012
+ return Promise.resolve(new LoaderResult(
1013
+ result,
1014
+ url,
1015
+ coordinationValues
1016
+ ));
1017
+ }
1018
+ }
1019
+ class ObsLocationsCsvLoader extends CsvLoader {
1020
+ loadFromCache(data) {
1021
+ if (this.cachedResult) {
1022
+ return this.cachedResult;
1023
+ }
1024
+ const { obsIndex: indexCol, obsLocations: [xCol, yCol] } = this.options;
1025
+ const obsIndex = data.map((d) => String(d[indexCol]));
1026
+ const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
1027
+ const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
1028
+ const obsLocations = {
1029
+ data: [obsLocationsX, obsLocationsY],
1030
+ shape: [2, obsLocationsX.length]
1031
+ };
1032
+ this.cachedResult = { obsIndex, obsLocations };
1033
+ return this.cachedResult;
1034
+ }
1035
+ }
910
1036
  let getRandomValues;
911
1037
  const rnds8 = new Uint8Array(16);
912
1038
  function rng() {
@@ -9474,7 +9600,7 @@ function configSchemaToVersion(zodSchema) {
9474
9600
  return zodSchema.shape.version._def.value;
9475
9601
  }
9476
9602
  ({
9477
- ...fromEntries(SCHEMA_HANDLERS.map(([zodSchema]) => {
9603
+ ...Object.fromEntries(SCHEMA_HANDLERS.map(([zodSchema]) => {
9478
9604
  const version = configSchemaToVersion(zodSchema);
9479
9605
  return [version, zodSchema];
9480
9606
  })),
@@ -9550,6 +9676,9 @@ const annDataObsSets = z.array(z.object({
9550
9676
  ]),
9551
9677
  scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
9552
9678
  }));
9679
+ z.array(z.object({
9680
+ path: z.string()
9681
+ }));
9553
9682
  const annDataObsSpots = annDataObsm;
9554
9683
  const annDataObsPoints = annDataObsm;
9555
9684
  const annDataObsLocations = annDataObsm;
@@ -16440,134 +16569,6 @@ function interpolateSequentialMulti(range2) {
16440
16569
  }
16441
16570
  interpolateRgbBasis(schemeRdBu);
16442
16571
  interpolateSequentialMulti(schemePlasma);
16443
- class CoordinationLevel {
16444
- constructor(value) {
16445
- this.value = value;
16446
- this.cachedValue = null;
16447
- }
16448
- setCached(processedLevel) {
16449
- this.cachedValue = processedLevel;
16450
- }
16451
- getCached() {
16452
- return this.cachedValue;
16453
- }
16454
- isCached() {
16455
- return this.cachedValue !== null;
16456
- }
16457
- }
16458
- function CL(value) {
16459
- return new CoordinationLevel(value);
16460
- }
16461
- class ObsSpotsCsvLoader extends CsvLoader {
16462
- loadFromCache(data) {
16463
- if (this.cachedResult) {
16464
- return this.cachedResult;
16465
- }
16466
- const { obsIndex: indexCol, obsSpots: [xCol, yCol] } = this.options;
16467
- const obsIndex = data.map((d) => String(d[indexCol]));
16468
- const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
16469
- const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
16470
- const obsSpots = {
16471
- data: [obsLocationsX, obsLocationsY],
16472
- shape: [2, obsLocationsX.length]
16473
- };
16474
- this.cachedResult = { obsIndex, obsSpots };
16475
- return this.cachedResult;
16476
- }
16477
- async load() {
16478
- const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
16479
- if (payload instanceof AbstractLoaderError) {
16480
- return Promise.reject(payload);
16481
- }
16482
- const coordinationValues = {
16483
- spotLayer: CL({
16484
- obsType: "spot",
16485
- // obsColorEncoding: 'spatialLayerColor',
16486
- // spatialLayerColor: [255, 255, 255],
16487
- spatialLayerVisible: true,
16488
- spatialLayerOpacity: 1,
16489
- spatialSpotRadius: 10
16490
- // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
16491
- // after resolving https://github.com/vitessce/vitessce/issues/1760
16492
- // featureValueColormapRange: [0, 1],
16493
- // obsHighlight: null,
16494
- // obsSetColor: null,
16495
- // obsSetSelection: null,
16496
- // additionalObsSets: null,
16497
- })
16498
- };
16499
- const { data, url } = payload;
16500
- const result = this.loadFromCache(data);
16501
- return Promise.resolve(new LoaderResult(
16502
- result,
16503
- url,
16504
- coordinationValues
16505
- ));
16506
- }
16507
- }
16508
- class ObsPointsCsvLoader extends CsvLoader {
16509
- loadFromCache(data) {
16510
- if (this.cachedResult) {
16511
- return this.cachedResult;
16512
- }
16513
- const { obsIndex: indexCol, obsPoints: [xCol, yCol] } = this.options;
16514
- const obsIndex = data.map((d) => String(d[indexCol]));
16515
- const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
16516
- const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
16517
- const obsPoints = {
16518
- data: [obsLocationsX, obsLocationsY],
16519
- shape: [2, obsLocationsX.length]
16520
- };
16521
- this.cachedResult = { obsIndex, obsPoints };
16522
- return this.cachedResult;
16523
- }
16524
- async load() {
16525
- const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
16526
- if (payload instanceof AbstractLoaderError) {
16527
- return Promise.reject(payload);
16528
- }
16529
- const coordinationValues = {
16530
- pointLayer: CL({
16531
- obsType: "point",
16532
- // obsColorEncoding: 'spatialLayerColor',
16533
- // spatialLayerColor: [255, 255, 255],
16534
- spatialLayerVisible: true,
16535
- spatialLayerOpacity: 1
16536
- // TODO: support a point radius?
16537
- // featureValueColormapRange: [0, 1],
16538
- // obsHighlight: null,
16539
- // obsSetColor: null,
16540
- // obsSetSelection: null,
16541
- // additionalObsSets: null,
16542
- // obsLabelsType: null,
16543
- })
16544
- };
16545
- const { data, url } = payload;
16546
- const result = this.loadFromCache(data);
16547
- return Promise.resolve(new LoaderResult(
16548
- result,
16549
- url,
16550
- coordinationValues
16551
- ));
16552
- }
16553
- }
16554
- class ObsLocationsCsvLoader extends CsvLoader {
16555
- loadFromCache(data) {
16556
- if (this.cachedResult) {
16557
- return this.cachedResult;
16558
- }
16559
- const { obsIndex: indexCol, obsLocations: [xCol, yCol] } = this.options;
16560
- const obsIndex = data.map((d) => String(d[indexCol]));
16561
- const obsLocationsX = Float32Array.from(data.map((d) => d[xCol]));
16562
- const obsLocationsY = Float32Array.from(data.map((d) => d[yCol]));
16563
- const obsLocations = {
16564
- data: [obsLocationsX, obsLocationsY],
16565
- shape: [2, obsLocationsX.length]
16566
- };
16567
- this.cachedResult = { obsIndex, obsLocations };
16568
- return this.cachedResult;
16569
- }
16570
- }
16571
16572
  class ObsSetsCsvLoader extends CsvLoader {
16572
16573
  loadFromCache(data) {
16573
16574
  if (this.cachedResult) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/csv",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,10 +18,10 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "d3-dsv": "^1.1.1",
21
- "@vitessce/constants-internal": "3.3.3",
22
- "@vitessce/sets-utils": "3.3.3",
23
- "@vitessce/vit-s": "3.3.3",
24
- "@vitessce/config": "3.3.3"
21
+ "@vitessce/constants-internal": "3.3.5",
22
+ "@vitessce/vit-s": "3.3.5",
23
+ "@vitessce/config": "3.3.5",
24
+ "@vitessce/sets-utils": "3.3.5"
25
25
  },
26
26
  "scripts": {
27
27
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",