@platforma-open/milaboratories.top-antibodies 4.3.1 → 4.3.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.
@@ -3,6 +3,6 @@
3
3
  "id": {
4
4
  "organization": "milaboratories",
5
5
  "name": "top-antibodies",
6
- "version": "4.3.1"
6
+ "version": "4.3.3"
7
7
  }
8
8
  }
package/block-pack/ui.tgz CHANGED
Binary file
package/dist/index.js CHANGED
@@ -13809,6 +13809,13 @@ function isProducedByLeadSelection(spec) {
13809
13809
  const trace = readAnnotationJson(spec, Annotation.Trace);
13810
13810
  return Array.isArray(trace) && trace.length > 0 && trace[trace.length - 1]?.type === LEAD_SELECTION_TRACE_TYPE;
13811
13811
  }
13812
+ /** Repertoire-labeling emits one such column per label. `PColumnName` has no entry for it. */
13813
+ const LABELING_TAG_COLUMN_NAME = "pl7.app/tag";
13814
+ /** `pl7.app/isSubset` marks both a dataset restriction and a presence-only column. A labeling
13815
+ * tag is only the second, so the dataset picker must not offer it. */
13816
+ function isDatasetScopingSubset(spec) {
13817
+ return isPColumnSpec(spec) && spec.name !== LABELING_TAG_COLUMN_NAME;
13818
+ }
13812
13819
  /**
13813
13820
  * True when a column carries no readable value. Presence is the whole signal.
13814
13821
  *
@@ -13996,13 +14003,57 @@ function computeDefaultFilters(scores, anchorRef) {
13996
14003
  }
13997
14004
  return defaultFilters;
13998
14005
  }
14006
+ /**
14007
+ * Which pipeline produced the anchor's records, from the run-id key on its record axis:
14008
+ *
14009
+ * pl7.app/peptide/extractionRunId peptide-extraction
14010
+ * pl7.app/repertoire/extractionRunId synthetic-repertoire-profiler
14011
+ * pl7.app/vdj/clonotypingRunId MiXCR, and import-vdj-data's imported sets
14012
+ *
14013
+ * Reads the domain, not the axis name: clonotypeKey and scClonotypeKey are migrating to
14014
+ * pl7.app/variantKey, after which the name discriminates nothing. The axis-name checks below are
14015
+ * a fallback for producers that have not migrated yet.
14016
+ *
14017
+ * Does not say how a receptor dataset arrived. Uploaded sequences and MiXCR output are both
14018
+ * `vdj`. Whether specific columns exist is a separate question — see {@link hasGeneCalls}.
14019
+ */
14020
+ function recordSource(anchorSpec) {
14021
+ const keyAxis = anchorSpec.axesSpec[1];
14022
+ if (keyAxis === void 0) return "unknown";
14023
+ const domain = keyAxis.domain ?? {};
14024
+ if (domain["pl7.app/peptide/extractionRunId"] !== void 0) return "peptide";
14025
+ if (domain["pl7.app/repertoire/extractionRunId"] !== void 0) return "amplicon";
14026
+ if (domain["pl7.app/vdj/clonotypingRunId"] !== void 0) return "vdj";
14027
+ if (keyAxis.name === "pl7.app/vdj/clonotypeKey" || keyAxis.name === "pl7.app/vdj/scClonotypeKey") return "vdj";
14028
+ return "unknown";
14029
+ }
14030
+ /** True for the two producers whose records are peptides or synthetic variants, not receptors. */
14031
+ function isPeptideOrAmplicon(anchorSpec) {
14032
+ const source = recordSource(anchorSpec);
14033
+ return source === "peptide" || source === "amplicon";
14034
+ }
14035
+ /**
14036
+ * Whether the dataset carries V/J gene calls — needed by CDR3 V Spectratype, V/J Gene Usage and
14037
+ * Kabat renumbering.
14038
+ *
14039
+ * Separate from {@link recordSource} on purpose: an uploaded set and a MiXCR set are both `vdj`,
14040
+ * but only MiXCR's has gene calls.
14041
+ *
14042
+ * TEMPORARY. This infers from the axis, and no variantKey producer emits gene calls today. When
14043
+ * MiXCR migrates to that axis this returns false for MiXCR too and both sections silently
14044
+ * disappear. Nothing structural separates the cases then — same axis name, same
14045
+ * clonotypingRunId — so replace it with a result-pool query for the gene columns.
14046
+ */
14047
+ function hasGeneCalls(anchorSpec) {
14048
+ return anchorSpec.axesSpec[1]?.name !== "pl7.app/variantKey";
14049
+ }
13999
14050
  function computePresets(scores, defaultFilters, anchorRef, anchorSpec) {
14000
- const isPeptide = anchorSpec.axesSpec[1]?.name === "pl7.app/variantKey";
14051
+ const usesPeptidePreset = isPeptideOrAmplicon(anchorSpec);
14001
14052
  const repertoireScore = scores.find((s) => s.getSpec().name === REPERTOIRE_SCORE_COLUMN_NAME);
14002
14053
  const hasRepertoireScore = repertoireScore !== void 0;
14003
14054
  const isEnrichmentColumn = (name) => name.startsWith("pl7.app/enrichment") || name.startsWith("pl7.app/vdj/enrichment");
14004
14055
  const hasEnrichmentScores = scores.some((s) => isEnrichmentColumn(s.getSpec().name));
14005
- const detectedPreset = isPeptide ? "peptide" : hasRepertoireScore ? "in-vivo" : hasEnrichmentScores ? "in-vitro" : void 0;
14056
+ const detectedPreset = usesPeptidePreset ? "peptide" : hasRepertoireScore ? "in-vivo" : hasEnrichmentScores ? "in-vitro" : void 0;
14006
14057
  const defaultRankingOrder = scores.filter((s) => s.getSpec().valueType !== "String").filter((s) => !hasRepertoireScore || s.getSpec().name !== "pl7.app/vdj/repertoireScore").filter((s) => !hasRepertoireScore || !IN_VIVO_MUTATION_COLUMNS.has(s.getSpec().name)).map((s) => ({
14007
14058
  id: `default-rank-${s.id}`,
14008
14059
  value: matchToColumnId(s, anchorRef),
@@ -14560,14 +14611,17 @@ const platforma$1 = BlockModelV3.create({
14560
14611
  diversificationColumn: data.diversificationColumn
14561
14612
  };
14562
14613
  }).output("datasetOptions", (ctx) => {
14563
- const opts = buildDatasetOptions(ctx, { primary: (spec) => {
14564
- if (!isPColumnSpec(spec)) return false;
14565
- if (spec.annotations?.[Annotation.IsAnchor] !== "true") return false;
14566
- if (spec.axesSpec.length < 2) return false;
14567
- if (spec.axesSpec[0]?.name !== "pl7.app/sampleId") return false;
14568
- const rowAxis = spec.axesSpec[1]?.name;
14569
- return rowAxis === "pl7.app/vdj/clonotypeKey" || rowAxis === "pl7.app/vdj/scClonotypeKey" || rowAxis === "pl7.app/variantKey";
14570
- } });
14614
+ const opts = buildDatasetOptions(ctx, {
14615
+ primary: (spec) => {
14616
+ if (!isPColumnSpec(spec)) return false;
14617
+ if (spec.annotations?.[Annotation.IsAnchor] !== "true") return false;
14618
+ if (spec.axesSpec.length < 2) return false;
14619
+ if (spec.axesSpec[0]?.name !== "pl7.app/sampleId") return false;
14620
+ const rowAxis = spec.axesSpec[1]?.name;
14621
+ return rowAxis === "pl7.app/vdj/clonotypeKey" || rowAxis === "pl7.app/vdj/scClonotypeKey" || rowAxis === "pl7.app/variantKey";
14622
+ },
14623
+ filter: isDatasetScopingSubset
14624
+ });
14571
14625
  if (!opts) return opts;
14572
14626
  const selfBlockId = ctx.outputs?.resolve({
14573
14627
  field: "selfBlockId",
@@ -14587,7 +14641,7 @@ const platforma$1 = BlockModelV3.create({
14587
14641
  }, { retentive: true }).output("modality", (ctx) => {
14588
14642
  const spec = getSpecByRef(getInputAnchorRef(ctx.data));
14589
14643
  if (!spec) return void 0;
14590
- return spec.axesSpec[1]?.name === "pl7.app/variantKey" ? "peptide" : "antibody_tcr";
14644
+ return isPeptideOrAmplicon(spec) ? "peptide" : "antibody_tcr";
14591
14645
  }, { retentive: true }).output("filterConfig", (ctx) => {
14592
14646
  const inputAnchor = getInputAnchorRef(ctx.data);
14593
14647
  const result = buildCollection(inputAnchor);
@@ -14871,9 +14925,9 @@ const platforma$1 = BlockModelV3.create({
14871
14925
  if (numbered === 0) return "Kabat numbering could not be applied to any clonotype. The framework regions may be too divergent from known germline sequences. Kabat sequence columns will be empty.";
14872
14926
  return `Kabat numbering was applied to ${numbered.toLocaleString()} clonotype${numbered === 1 ? "" : "s"}. Clonotypes that could not be numbered will have empty Kabat sequence columns.`;
14873
14927
  }).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title(() => "Lead Selection").subtitle((ctx) => ctx.data.customBlockLabel || ctx.data.defaultBlockLabel).sections((ctx) => {
14874
- const keyAxis = getSpecByRef(getInputAnchorRef(ctx.data))?.axesSpec[1];
14875
- const isPeptide = keyAxis?.name === "pl7.app/variantKey";
14876
- const spaceLabel = isPeptide && keyAxis?.domain?.["pl7.app/repertoire/extractionRunId"] !== void 0 ? "Variant Space" : isPeptide ? "Peptide Space" : "Clonotype Space";
14928
+ const anchorSpec = getSpecByRef(getInputAnchorRef(ctx.data));
14929
+ const source = anchorSpec !== void 0 ? recordSource(anchorSpec) : "unknown";
14930
+ const spaceLabel = source === "amplicon" ? "Variant Space" : source === "peptide" ? "Peptide Space" : "Clonotype Space";
14877
14931
  const sections = [
14878
14932
  {
14879
14933
  type: "link",
@@ -14891,7 +14945,7 @@ const platforma$1 = BlockModelV3.create({
14891
14945
  label: "Selection Plot"
14892
14946
  }
14893
14947
  ];
14894
- if (!isPeptide) sections.push({
14948
+ if (anchorSpec !== void 0 && hasGeneCalls(anchorSpec)) sections.push({
14895
14949
  type: "link",
14896
14950
  href: "/spectratype",
14897
14951
  label: "CDR3 V Spectratype"