@platforma-open/milaboratories.sequence-properties.model 1.1.1 → 1.1.2

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": "@platforma-open/milaboratories.sequence-properties.model",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -55,6 +55,13 @@ export const platforma = BlockModelV3.create(blockDataModel)
55
55
  if (ctx.data.inputAnchor === undefined) return undefined;
56
56
  const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
57
57
  if (ownCols === undefined) return undefined;
58
+ // `coverageTier` is set in workflow/main.tpl.tengo and surfaced via the
59
+ // `info` JSON resource. Allowed values are defined in types.ts::WorkflowInfo.
60
+ // Gate on `info` so the table renders consistently with the chosen aa
61
+ // column rather than briefly without it while `info` is still resolving.
62
+ const info = ctx.outputs?.resolve("info")?.getDataAsJson<WorkflowInfo>();
63
+ if (info === undefined) return undefined;
64
+ const tier = info.coverageTier;
58
65
 
59
66
  // Build sources explicitly: upstream cols from the result pool minus
60
67
  // anything traced back to this block, plus this block's own cols from
@@ -78,12 +85,48 @@ export const platforma = BlockModelV3.create(blockDataModel)
78
85
  anchors: { main: ctx.data.inputAnchor },
79
86
  selector: { mode: "enrichment" },
80
87
  },
81
- // UX policy (not in spec): default-show only this block's columns;
82
- // demote upstream cols to optional to keep the table uncluttered.
83
- // This block's cols fall through unmatched and keep the visibility
84
- // stamped at workflow-time (`pl7.app/table/visibility`).
88
+ // Default-visible: this block's columns + a single source amino-acid
89
+ // sequence column matching the analysed coverage tier. Reviewer asked
90
+ // for one sequence next to the properties full-chain VDJRegion when
91
+ // available (it contains the CDR3); CDR3 alone when that is all the
92
+ // input has; peptide for peptide mode. Chain A (heavy / alpha / gamma)
93
+ // only — chain B stays available via the column picker. Other upstream
94
+ // cols → optional. This block's cols fall through unmatched and keep
95
+ // their workflow-time `pl7.app/table/visibility` annotation.
85
96
  displayOptions: {
86
97
  visibility: [
98
+ {
99
+ match: (spec) => {
100
+ if (spec.domain?.["pl7.app/vdj/scClonotypeChain/index"] === "secondary") {
101
+ return false;
102
+ }
103
+ if (spec.domain?.["pl7.app/alphabet"] !== "aminoacid") return false;
104
+
105
+ const isVdj = spec.name === "pl7.app/vdj/sequence";
106
+ const isUniversal = spec.name === "pl7.app/sequence";
107
+ if (!isVdj && !isUniversal) return false;
108
+
109
+ const feature = isVdj
110
+ ? spec.domain?.["pl7.app/vdj/feature"]
111
+ : spec.domain?.["pl7.app/feature"];
112
+
113
+ if (tier === "peptide") {
114
+ return isUniversal && feature === "peptide";
115
+ }
116
+
117
+ const chain = spec.domain?.["pl7.app/vdj/scClonotypeChain"];
118
+ if (chain !== undefined && chain !== "A") return false;
119
+
120
+ if (tier === "full_chain") {
121
+ return feature === "VDJRegion" || feature === "VDJRegionInFrame";
122
+ }
123
+ if (tier === "cdr3_only" || tier === "partial") {
124
+ return feature === "CDR3";
125
+ }
126
+ return false;
127
+ },
128
+ visibility: "default",
129
+ },
87
130
  {
88
131
  match: (spec) =>
89
132
  !spec.annotations?.[Annotation.Trace]?.includes(