@genobank/biofs 3.22.0 → 3.23.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/CHANGELOG.md +32 -0
- package/dist/abi/sequentia/ConsentGrant.json +1909 -0
- package/dist/commands/admin/verify-lab.js +1 -1
- package/dist/commands/admin/verify-lab.js.map +1 -1
- package/dist/commands/alphagenome/index.d.ts +26 -0
- package/dist/commands/alphagenome/index.d.ts.map +1 -0
- package/dist/commands/alphagenome/index.js +72 -0
- package/dist/commands/alphagenome/index.js.map +1 -0
- package/dist/commands/annotate/signed_headers.d.ts +5 -0
- package/dist/commands/annotate/signed_headers.d.ts.map +1 -0
- package/dist/commands/annotate/signed_headers.js +10 -0
- package/dist/commands/annotate/signed_headers.js.map +1 -0
- package/dist/commands/annotate/status.d.ts.map +1 -1
- package/dist/commands/annotate/status.js +4 -0
- package/dist/commands/annotate/status.js.map +1 -1
- package/dist/commands/annotate/submit.d.ts +4 -1
- package/dist/commands/annotate/submit.d.ts.map +1 -1
- package/dist/commands/annotate/submit.js +41 -12
- package/dist/commands/annotate/submit.js.map +1 -1
- package/dist/commands/biofiles.d.ts.map +1 -1
- package/dist/commands/biofiles.js +10 -2
- package/dist/commands/biofiles.js.map +1 -1
- package/dist/commands/clawbio/submit.d.ts +24 -0
- package/dist/commands/clawbio/submit.d.ts.map +1 -0
- package/dist/commands/clawbio/submit.js +175 -0
- package/dist/commands/clawbio/submit.js.map +1 -0
- package/dist/commands/consent.d.ts +1 -0
- package/dist/commands/consent.d.ts.map +1 -1
- package/dist/commands/consent.js +3 -2
- package/dist/commands/consent.js.map +1 -1
- package/dist/commands/context/create.d.ts.map +1 -1
- package/dist/commands/context/create.js +40 -5
- package/dist/commands/context/create.js.map +1 -1
- package/dist/commands/crypt4gh.d.ts +24 -0
- package/dist/commands/crypt4gh.d.ts.map +1 -0
- package/dist/commands/crypt4gh.js +220 -0
- package/dist/commands/crypt4gh.js.map +1 -0
- package/dist/commands/fluency/index.d.ts +6 -0
- package/dist/commands/fluency/index.d.ts.map +1 -1
- package/dist/commands/fluency/index.js +64 -0
- package/dist/commands/fluency/index.js.map +1 -1
- package/dist/commands/fourier-score.d.ts +2 -0
- package/dist/commands/fourier-score.d.ts.map +1 -1
- package/dist/commands/fourier-score.js +201 -107
- package/dist/commands/fourier-score.js.map +1 -1
- package/dist/commands/fusion-evidence/index.d.ts +25 -0
- package/dist/commands/fusion-evidence/index.d.ts.map +1 -0
- package/dist/commands/fusion-evidence/index.js +136 -0
- package/dist/commands/fusion-evidence/index.js.map +1 -0
- package/dist/commands/governance.d.ts +46 -0
- package/dist/commands/governance.d.ts.map +1 -0
- package/dist/commands/governance.js +126 -0
- package/dist/commands/governance.js.map +1 -0
- package/dist/commands/humanmark.d.ts +68 -0
- package/dist/commands/humanmark.d.ts.map +1 -0
- package/dist/commands/humanmark.js +278 -0
- package/dist/commands/humanmark.js.map +1 -0
- package/dist/commands/imaging/compare.d.ts +1 -0
- package/dist/commands/imaging/compare.d.ts.map +1 -1
- package/dist/commands/imaging/compare.js +1 -0
- package/dist/commands/imaging/compare.js.map +1 -1
- package/dist/commands/imaging/lesions.d.ts +1 -0
- package/dist/commands/imaging/lesions.d.ts.map +1 -1
- package/dist/commands/imaging/lesions.js +2 -1
- package/dist/commands/imaging/lesions.js.map +1 -1
- package/dist/commands/imaging/register.d.ts +1 -0
- package/dist/commands/imaging/register.d.ts.map +1 -1
- package/dist/commands/imaging/register.js +24 -0
- package/dist/commands/imaging/register.js.map +1 -1
- package/dist/commands/imaging/trajectory.d.ts +1 -0
- package/dist/commands/imaging/trajectory.d.ts.map +1 -1
- package/dist/commands/imaging/trajectory.js +2 -1
- package/dist/commands/imaging/trajectory.js.map +1 -1
- package/dist/commands/imaging/twin.d.ts +1 -0
- package/dist/commands/imaging/twin.d.ts.map +1 -1
- package/dist/commands/imaging/twin.js +1 -0
- package/dist/commands/imaging/twin.js.map +1 -1
- package/dist/commands/inventory-register-sqlite.d.ts +10 -0
- package/dist/commands/inventory-register-sqlite.d.ts.map +1 -1
- package/dist/commands/inventory-register-sqlite.js +62 -8
- package/dist/commands/inventory-register-sqlite.js.map +1 -1
- package/dist/commands/job/submit-clara.d.ts.map +1 -1
- package/dist/commands/job/submit-clara.js +71 -50
- package/dist/commands/job/submit-clara.js.map +1 -1
- package/dist/commands/kiosk/canon.d.ts +95 -0
- package/dist/commands/kiosk/canon.d.ts.map +1 -0
- package/dist/commands/kiosk/canon.js +120 -0
- package/dist/commands/kiosk/canon.js.map +1 -0
- package/dist/commands/kiosk/cli.d.ts +12 -0
- package/dist/commands/kiosk/cli.d.ts.map +1 -0
- package/dist/commands/kiosk/cli.js +784 -0
- package/dist/commands/kiosk/cli.js.map +1 -0
- package/dist/commands/kiosk/client.d.ts +32 -0
- package/dist/commands/kiosk/client.d.ts.map +1 -0
- package/dist/commands/kiosk/client.js +179 -0
- package/dist/commands/kiosk/client.js.map +1 -0
- package/dist/commands/kiosk/cryptobox.d.ts +41 -0
- package/dist/commands/kiosk/cryptobox.d.ts.map +1 -0
- package/dist/commands/kiosk/cryptobox.js +126 -0
- package/dist/commands/kiosk/cryptobox.js.map +1 -0
- package/dist/commands/kiosk/gate.d.ts +13 -0
- package/dist/commands/kiosk/gate.d.ts.map +1 -0
- package/dist/commands/kiosk/gate.js +174 -0
- package/dist/commands/kiosk/gate.js.map +1 -0
- package/dist/commands/kiosk/home.d.ts +80 -0
- package/dist/commands/kiosk/home.d.ts.map +1 -0
- package/dist/commands/kiosk/home.js +265 -0
- package/dist/commands/kiosk/home.js.map +1 -0
- package/dist/commands/kiosk/hooks.d.ts +24 -0
- package/dist/commands/kiosk/hooks.d.ts.map +1 -0
- package/dist/commands/kiosk/hooks.js +305 -0
- package/dist/commands/kiosk/hooks.js.map +1 -0
- package/dist/commands/kiosk/invitemail.d.ts +17 -0
- package/dist/commands/kiosk/invitemail.d.ts.map +1 -0
- package/dist/commands/kiosk/invitemail.js +58 -0
- package/dist/commands/kiosk/invitemail.js.map +1 -0
- package/dist/commands/kiosk/main.d.ts +7 -0
- package/dist/commands/kiosk/main.d.ts.map +1 -0
- package/dist/commands/kiosk/main.js +20 -0
- package/dist/commands/kiosk/main.js.map +1 -0
- package/dist/commands/kiosk/mcp.d.ts +28 -0
- package/dist/commands/kiosk/mcp.d.ts.map +1 -0
- package/dist/commands/kiosk/mcp.js +304 -0
- package/dist/commands/kiosk/mcp.js.map +1 -0
- package/dist/commands/kiosk/pairing.d.ts +28 -0
- package/dist/commands/kiosk/pairing.d.ts.map +1 -0
- package/dist/commands/kiosk/pairing.js +147 -0
- package/dist/commands/kiosk/pairing.js.map +1 -0
- package/dist/commands/kiosk/presence.d.ts +11 -0
- package/dist/commands/kiosk/presence.d.ts.map +1 -0
- package/dist/commands/kiosk/presence.js +105 -0
- package/dist/commands/kiosk/presence.js.map +1 -0
- package/dist/commands/kiosk/profile.d.ts +59 -0
- package/dist/commands/kiosk/profile.d.ts.map +1 -0
- package/dist/commands/kiosk/profile.js +266 -0
- package/dist/commands/kiosk/profile.js.map +1 -0
- package/dist/commands/kiosk/room.d.ts +252 -0
- package/dist/commands/kiosk/room.d.ts.map +1 -0
- package/dist/commands/kiosk/room.js +1057 -0
- package/dist/commands/kiosk/room.js.map +1 -0
- package/dist/commands/mirror.d.ts +16 -0
- package/dist/commands/mirror.d.ts.map +1 -0
- package/dist/commands/mirror.js +172 -0
- package/dist/commands/mirror.js.map +1 -0
- package/dist/commands/neoantigen/align.d.ts +15 -0
- package/dist/commands/neoantigen/align.d.ts.map +1 -0
- package/dist/commands/neoantigen/align.js +74 -0
- package/dist/commands/neoantigen/align.js.map +1 -0
- package/dist/commands/neoantigen/fabricate.d.ts +20 -0
- package/dist/commands/neoantigen/fabricate.d.ts.map +1 -0
- package/dist/commands/neoantigen/fabricate.js +119 -0
- package/dist/commands/neoantigen/fabricate.js.map +1 -0
- package/dist/commands/neoantigen/ingest.d.ts +14 -0
- package/dist/commands/neoantigen/ingest.d.ts.map +1 -0
- package/dist/commands/neoantigen/ingest.js +62 -0
- package/dist/commands/neoantigen/ingest.js.map +1 -0
- package/dist/commands/neoantigen/status.d.ts +4 -0
- package/dist/commands/neoantigen/status.d.ts.map +1 -0
- package/dist/commands/neoantigen/status.js +69 -0
- package/dist/commands/neoantigen/status.js.map +1 -0
- package/dist/commands/neoantigen-pipeline/index.d.ts +146 -2
- package/dist/commands/neoantigen-pipeline/index.d.ts.map +1 -1
- package/dist/commands/neoantigen-pipeline/index.js +413 -1
- package/dist/commands/neoantigen-pipeline/index.js.map +1 -1
- package/dist/commands/onramp/huggingface.d.ts +33 -0
- package/dist/commands/onramp/huggingface.d.ts.map +1 -0
- package/dist/commands/onramp/huggingface.js +124 -0
- package/dist/commands/onramp/huggingface.js.map +1 -0
- package/dist/commands/parabricks/index.d.ts +3 -1
- package/dist/commands/parabricks/index.d.ts.map +1 -1
- package/dist/commands/parabricks/index.js +16 -6
- package/dist/commands/parabricks/index.js.map +1 -1
- package/dist/commands/parabricks/registry.json +105 -3
- package/dist/commands/protein-impact/benchmark.d.ts +34 -0
- package/dist/commands/protein-impact/benchmark.d.ts.map +1 -0
- package/dist/commands/protein-impact/benchmark.js +75 -0
- package/dist/commands/protein-impact/benchmark.js.map +1 -0
- package/dist/commands/protein-impact/benchmark_v1.json +1 -0
- package/dist/commands/protein-impact/constants.d.ts +54 -0
- package/dist/commands/protein-impact/constants.d.ts.map +1 -0
- package/dist/commands/protein-impact/constants.js +47 -0
- package/dist/commands/protein-impact/constants.js.map +1 -0
- package/dist/commands/protein-impact/core.d.ts +145 -0
- package/dist/commands/protein-impact/core.d.ts.map +1 -0
- package/dist/commands/protein-impact/core.js +288 -0
- package/dist/commands/protein-impact/core.js.map +1 -0
- package/dist/commands/protein-impact/domain_table.json +23 -0
- package/dist/commands/protein-impact/domains.d.ts +9 -0
- package/dist/commands/protein-impact/domains.d.ts.map +1 -0
- package/dist/commands/protein-impact/domains.js +29 -0
- package/dist/commands/protein-impact/domains.js.map +1 -0
- package/dist/commands/protein-impact/estimate.d.ts +48 -0
- package/dist/commands/protein-impact/estimate.d.ts.map +1 -0
- package/dist/commands/protein-impact/estimate.js +101 -0
- package/dist/commands/protein-impact/estimate.js.map +1 -0
- package/dist/commands/protein-impact/exec.d.ts +60 -0
- package/dist/commands/protein-impact/exec.d.ts.map +1 -0
- package/dist/commands/protein-impact/exec.js +227 -0
- package/dist/commands/protein-impact/exec.js.map +1 -0
- package/dist/commands/protein-impact/features.d.ts +24 -0
- package/dist/commands/protein-impact/features.d.ts.map +1 -0
- package/dist/commands/protein-impact/features.js +93 -0
- package/dist/commands/protein-impact/features.js.map +1 -0
- package/dist/commands/protein-impact/gate.d.ts +94 -0
- package/dist/commands/protein-impact/gate.d.ts.map +1 -0
- package/dist/commands/protein-impact/gate.js +120 -0
- package/dist/commands/protein-impact/gate.js.map +1 -0
- package/dist/commands/protein-impact/gate_rules.json +10 -0
- package/dist/commands/protein-impact/guard.d.ts +44 -0
- package/dist/commands/protein-impact/guard.d.ts.map +1 -0
- package/dist/commands/protein-impact/guard.js +189 -0
- package/dist/commands/protein-impact/guard.js.map +1 -0
- package/dist/commands/protein-impact/metrics.d.ts +44 -0
- package/dist/commands/protein-impact/metrics.d.ts.map +1 -0
- package/dist/commands/protein-impact/metrics.js +178 -0
- package/dist/commands/protein-impact/metrics.js.map +1 -0
- package/dist/commands/protein-impact/numbering.d.ts +33 -0
- package/dist/commands/protein-impact/numbering.d.ts.map +1 -0
- package/dist/commands/protein-impact/numbering.js +115 -0
- package/dist/commands/protein-impact/numbering.js.map +1 -0
- package/dist/commands/protein-impact/register.d.ts +6 -0
- package/dist/commands/protein-impact/register.d.ts.map +1 -0
- package/dist/commands/protein-impact/register.js +139 -0
- package/dist/commands/protein-impact/register.js.map +1 -0
- package/dist/commands/protein-impact/request.d.ts +14 -0
- package/dist/commands/protein-impact/request.d.ts.map +1 -0
- package/dist/commands/protein-impact/request.js +73 -0
- package/dist/commands/protein-impact/request.js.map +1 -0
- package/dist/commands/protein-impact/submit.d.ts +117 -0
- package/dist/commands/protein-impact/submit.d.ts.map +1 -0
- package/dist/commands/protein-impact/submit.js +460 -0
- package/dist/commands/protein-impact/submit.js.map +1 -0
- package/dist/commands/protein-impact/tools.lock.json +53 -0
- package/dist/commands/protein-impact/tools_lock.d.ts +41 -0
- package/dist/commands/protein-impact/tools_lock.d.ts.map +1 -0
- package/dist/commands/protein-impact/tools_lock.js +52 -0
- package/dist/commands/protein-impact/tools_lock.js.map +1 -0
- package/dist/commands/psm-consensus.d.ts.map +1 -1
- package/dist/commands/psm-consensus.js +65 -26
- package/dist/commands/psm-consensus.js.map +1 -1
- package/dist/commands/reconcile-owners.d.ts +21 -0
- package/dist/commands/reconcile-owners.d.ts.map +1 -0
- package/dist/commands/reconcile-owners.js +86 -0
- package/dist/commands/reconcile-owners.js.map +1 -0
- package/dist/commands/reference-register/index.d.ts +8 -0
- package/dist/commands/reference-register/index.d.ts.map +1 -0
- package/dist/commands/reference-register/index.js +58 -0
- package/dist/commands/reference-register/index.js.map +1 -0
- package/dist/commands/register-derived-file.d.ts +9 -0
- package/dist/commands/register-derived-file.d.ts.map +1 -0
- package/dist/commands/register-derived-file.js +101 -0
- package/dist/commands/register-derived-file.js.map +1 -0
- package/dist/commands/rrm-consensus.d.ts.map +1 -1
- package/dist/commands/rrm-consensus.js +65 -26
- package/dist/commands/rrm-consensus.js.map +1 -1
- package/dist/commands/rrm-validate.d.ts +22 -0
- package/dist/commands/rrm-validate.d.ts.map +1 -0
- package/dist/commands/rrm-validate.js +109 -0
- package/dist/commands/rrm-validate.js.map +1 -0
- package/dist/commands/tele.d.ts +1 -0
- package/dist/commands/tele.d.ts.map +1 -1
- package/dist/commands/tele.js +37 -2
- package/dist/commands/tele.js.map +1 -1
- package/dist/commands/tokenize.d.ts.map +1 -1
- package/dist/commands/tokenize.js +35 -0
- package/dist/commands/tokenize.js.map +1 -1
- package/dist/commands/upload.d.ts +28 -1
- package/dist/commands/upload.d.ts.map +1 -1
- package/dist/commands/upload.js +174 -31
- package/dist/commands/upload.js.map +1 -1
- package/dist/commands/vault/mount.d.ts.map +1 -1
- package/dist/commands/vault/mount.js +6 -0
- package/dist/commands/vault/mount.js.map +1 -1
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +16 -4
- package/dist/commands/workspace.js.map +1 -1
- package/dist/commands/x402/submit.d.ts.map +1 -1
- package/dist/commands/x402/submit.js +7 -4
- package/dist/commands/x402/submit.js.map +1 -1
- package/dist/index.js +810 -31
- package/dist/index.js.map +1 -1
- package/dist/lib/api/bionft-client.d.ts.map +1 -1
- package/dist/lib/api/bionft-client.js +1 -1
- package/dist/lib/api/bionft-client.js.map +1 -1
- package/dist/lib/api/fuse-client.d.ts.map +1 -1
- package/dist/lib/api/fuse-client.js +8 -1
- package/dist/lib/api/fuse-client.js.map +1 -1
- package/dist/lib/biofiles/resolver.d.ts.map +1 -1
- package/dist/lib/biofiles/resolver.js +5 -2
- package/dist/lib/biofiles/resolver.js.map +1 -1
- package/dist/lib/crypt4gh/bind.d.ts +51 -0
- package/dist/lib/crypt4gh/bind.d.ts.map +1 -0
- package/dist/lib/crypt4gh/bind.js +140 -0
- package/dist/lib/crypt4gh/bind.js.map +1 -0
- package/dist/lib/crypt4gh/index.d.ts +45 -0
- package/dist/lib/crypt4gh/index.d.ts.map +1 -0
- package/dist/lib/crypt4gh/index.js +391 -0
- package/dist/lib/crypt4gh/index.js.map +1 -0
- package/dist/lib/gene-map.d.ts.map +1 -1
- package/dist/lib/gene-map.js +13 -0
- package/dist/lib/gene-map.js.map +1 -1
- package/dist/lib/rrm_fft.py +555 -0
- package/dist/lib/sequentia/BioPIL.js +1 -1
- package/dist/lib/sequentia/BioPIL.js.map +1 -1
- package/dist/lib/sequentia/ConsentManager.js +1 -1
- package/dist/lib/sequentia/ConsentManager.js.map +1 -1
- package/dist/lib/sequentia/OpenCravatJobs.js +1 -1
- package/dist/lib/sequentia/OpenCravatJobs.js.map +1 -1
- package/dist/lib/sequentia/PaymentRouter.js +1 -1
- package/dist/lib/sequentia/PaymentRouter.js.map +1 -1
- package/dist/lib/sequentia/consent-grant-c2pa.d.ts +134 -0
- package/dist/lib/sequentia/consent-grant-c2pa.d.ts.map +1 -0
- package/dist/lib/sequentia/consent-grant-c2pa.js +218 -0
- package/dist/lib/sequentia/consent-grant-c2pa.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical JSON, request hash and job id for protein-impact. An identical request always yields the
|
|
4
|
+
* same hash and job id, so a rerun finds its per-stage cache and does zero compute.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.canonicalJson = canonicalJson;
|
|
41
|
+
exports.sha256Hex = sha256Hex;
|
|
42
|
+
exports.requestHash = requestHash;
|
|
43
|
+
exports.jobIdFor = jobIdFor;
|
|
44
|
+
const crypto = __importStar(require("crypto"));
|
|
45
|
+
function canonicalJson(v) {
|
|
46
|
+
if (Array.isArray(v))
|
|
47
|
+
return `[${v.map(canonicalJson).join(',')}]`;
|
|
48
|
+
if (v && typeof v === 'object') {
|
|
49
|
+
const o = v;
|
|
50
|
+
return `{${Object.keys(o).sort().filter(k => o[k] !== undefined).map(k => `${JSON.stringify(k)}:${canonicalJson(o[k])}`).join(',')}}`;
|
|
51
|
+
}
|
|
52
|
+
return JSON.stringify(v);
|
|
53
|
+
}
|
|
54
|
+
function sha256Hex(s) {
|
|
55
|
+
return crypto.createHash('sha256').update(s).digest('hex');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The approval block never enters the hash: approving a GPU estimate must not change which job it is.
|
|
59
|
+
* Substitutions and genes are sorted so order does not matter.
|
|
60
|
+
*/
|
|
61
|
+
function requestHash(req) {
|
|
62
|
+
const { approval: _approval, ...rest } = req;
|
|
63
|
+
const targets = [...rest.targets]
|
|
64
|
+
.map(t => ({ ...t, subs: [...t.subs].sort((a, b) => a.pos - b.pos || a.alt.localeCompare(b.alt)) }))
|
|
65
|
+
.sort((a, b) => a.gene.localeCompare(b.gene));
|
|
66
|
+
const layers = [...rest.layers].sort();
|
|
67
|
+
const sources = rest.sources ? [...rest.sources].sort() : undefined;
|
|
68
|
+
return sha256Hex(canonicalJson({ ...rest, targets, layers, sources }));
|
|
69
|
+
}
|
|
70
|
+
function jobIdFor(req) {
|
|
71
|
+
return `pi-${req.mode}-${req.serial || 'public'}-${requestHash(req).slice(0, 12)}`;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/commands/protein-impact/request.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,sCAOC;AAED,8BAEC;AAMD,kCAQC;AAED,4BAEC;AAhCD,+CAAiC;AAGjC,SAAgB,aAAa,CAAC,CAAU;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACnE,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,CAA4B,CAAC;QACvC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACxI,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,SAAS,CAAC,CAAkB;IAC1C,OAAO,MAAM,CAAC,UAAU,CA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AAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* biofs protein-impact fetch | apply | probe | gate-sign | results
|
|
3
|
+
*
|
|
4
|
+
* CLIENT verbs for the protein-level impact pipeline. Research-grade analysis of KNOWN missense
|
|
5
|
+
* substitutions in ITGA2B and ITGB3 (Glanzmann thrombasthenia genes). The verb cannot design anything:
|
|
6
|
+
* the only input is (gene, ref, pos, alt) tuples, and a free sequence, FASTA, SMILES or structure is refused
|
|
7
|
+
* by the no-design guard.
|
|
8
|
+
*
|
|
9
|
+
* Dispatch is the protocol path (POST /api_biofs_node/job -> biofs-node -> an executor), never a raw
|
|
10
|
+
* curl. `apply` reads the sample's variants through the gated variants API (the sqlite never leaves the
|
|
11
|
+
* server), refuses a variant the sample does not carry, and will not run without a passing, signed gate
|
|
12
|
+
* document. GPU layers refuse to start without `--approve <estimate_id> --max-usd N` from `--estimate`.
|
|
13
|
+
*/
|
|
14
|
+
import { FuseVariantRow } from '../../lib/api/fuse-client';
|
|
15
|
+
import { Layer } from './constants';
|
|
16
|
+
import { Estimate } from './estimate';
|
|
17
|
+
import { GateDocument } from './gate';
|
|
18
|
+
import { ProteinImpactRequest, RequestTarget } from './guard';
|
|
19
|
+
import { Substitution } from './numbering';
|
|
20
|
+
/** Parse and group `GENE:p.Leu225Arg` strings into request targets. Duplicates collapse. */
|
|
21
|
+
export declare function groupTargets(variants: string[]): {
|
|
22
|
+
targets: RequestTarget[];
|
|
23
|
+
subs: Substitution[];
|
|
24
|
+
};
|
|
25
|
+
export declare function parseLayers(csv: string | undefined, fallback: Layer[]): Layer[];
|
|
26
|
+
export declare function parseGenes(csv: string | undefined): string[];
|
|
27
|
+
export interface ApplyBuild {
|
|
28
|
+
serial: string;
|
|
29
|
+
variants: string[];
|
|
30
|
+
sources: string[];
|
|
31
|
+
layers: Layer[];
|
|
32
|
+
gate: GateDocument;
|
|
33
|
+
approval?: {
|
|
34
|
+
estimate_id: string;
|
|
35
|
+
max_usd: number;
|
|
36
|
+
};
|
|
37
|
+
diagnosisAssumption?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function buildApplyRequest(o: ApplyBuild): ProteinImpactRequest;
|
|
40
|
+
export declare function buildProbeRequest(genes: string[], approval?: {
|
|
41
|
+
estimate_id: string;
|
|
42
|
+
max_usd: number;
|
|
43
|
+
}): ProteinImpactRequest;
|
|
44
|
+
export declare function buildValidateRequest(genes: string[], layers: Layer[], approval?: {
|
|
45
|
+
estimate_id: string;
|
|
46
|
+
max_usd: number;
|
|
47
|
+
}): ProteinImpactRequest;
|
|
48
|
+
export declare function buildFetchRequest(genes: string[]): ProteinImpactRequest;
|
|
49
|
+
/** Which requested substitutions the sample's annotated missense variants actually carry. */
|
|
50
|
+
export declare function carrierMatches(rows: FuseVariantRow[], requested: Substitution[]): {
|
|
51
|
+
found: Substitution[];
|
|
52
|
+
missing: Substitution[];
|
|
53
|
+
};
|
|
54
|
+
export interface JobSpec {
|
|
55
|
+
jobId: string;
|
|
56
|
+
biosampleId: string;
|
|
57
|
+
inputType: string;
|
|
58
|
+
proteinImpactRequest: ProteinImpactRequest;
|
|
59
|
+
proteinImpactGate?: GateDocument;
|
|
60
|
+
manifestUri: string;
|
|
61
|
+
methylBiocid: '';
|
|
62
|
+
creatorWallet: string;
|
|
63
|
+
creatorSig: string;
|
|
64
|
+
outputBucket: string;
|
|
65
|
+
refBucket: string;
|
|
66
|
+
batchId: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function buildJobSpec(req: ProteinImpactRequest, gate: GateDocument | undefined, creds: {
|
|
69
|
+
wallet_address: string;
|
|
70
|
+
user_signature: string;
|
|
71
|
+
}, today: string): JobSpec;
|
|
72
|
+
export declare function renderEstimate(e: Estimate): string;
|
|
73
|
+
export interface FetchOptions {
|
|
74
|
+
genes?: string;
|
|
75
|
+
json?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare function fetchCommand(o: FetchOptions): Promise<void>;
|
|
78
|
+
export interface ValidateOptions {
|
|
79
|
+
genes?: string;
|
|
80
|
+
layers?: string;
|
|
81
|
+
approve?: string;
|
|
82
|
+
maxUsd?: string;
|
|
83
|
+
estimate?: boolean;
|
|
84
|
+
json?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare function validateCommand(o: ValidateOptions): Promise<void>;
|
|
87
|
+
export interface ProbeOptions {
|
|
88
|
+
genes?: string;
|
|
89
|
+
approve?: string;
|
|
90
|
+
maxUsd?: string;
|
|
91
|
+
estimate?: boolean;
|
|
92
|
+
json?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export declare function probeCommand(o: ProbeOptions): Promise<void>;
|
|
95
|
+
export interface ApplyOptions {
|
|
96
|
+
variant: string[];
|
|
97
|
+
source: string[];
|
|
98
|
+
gateFile: string;
|
|
99
|
+
layers?: string;
|
|
100
|
+
approve?: string;
|
|
101
|
+
maxUsd?: string;
|
|
102
|
+
estimate?: boolean;
|
|
103
|
+
diagnosisAssumption?: string;
|
|
104
|
+
json?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export declare function applyCommand(serial: string, o: ApplyOptions): Promise<void>;
|
|
107
|
+
export interface GateSignOptions {
|
|
108
|
+
yes?: boolean;
|
|
109
|
+
out?: string;
|
|
110
|
+
}
|
|
111
|
+
export declare function gateSignCommand(file: string, o: GateSignOptions): Promise<void>;
|
|
112
|
+
export interface ResultsOptions {
|
|
113
|
+
out?: string;
|
|
114
|
+
json?: boolean;
|
|
115
|
+
}
|
|
116
|
+
export declare function resultsCommand(jobId: string, o: ResultsOptions): Promise<void>;
|
|
117
|
+
//# sourceMappingURL=submit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../src/commands/protein-impact/submit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,EAAiB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E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eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BrF;AAED,MAAM,WAAW,cAAc;IAAG,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAEhE,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCpF"}
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* biofs protein-impact fetch | apply | probe | gate-sign | results
|
|
4
|
+
*
|
|
5
|
+
* CLIENT verbs for the protein-level impact pipeline. Research-grade analysis of KNOWN missense
|
|
6
|
+
* substitutions in ITGA2B and ITGB3 (Glanzmann thrombasthenia genes). The verb cannot design anything:
|
|
7
|
+
* the only input is (gene, ref, pos, alt) tuples, and a free sequence, FASTA, SMILES or structure is refused
|
|
8
|
+
* by the no-design guard.
|
|
9
|
+
*
|
|
10
|
+
* Dispatch is the protocol path (POST /api_biofs_node/job -> biofs-node -> an executor), never a raw
|
|
11
|
+
* curl. `apply` reads the sample's variants through the gated variants API (the sqlite never leaves the
|
|
12
|
+
* server), refuses a variant the sample does not carry, and will not run without a passing, signed gate
|
|
13
|
+
* document. GPU layers refuse to start without `--approve <estimate_id> --max-usd N` from `--estimate`.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.groupTargets = groupTargets;
|
|
53
|
+
exports.parseLayers = parseLayers;
|
|
54
|
+
exports.parseGenes = parseGenes;
|
|
55
|
+
exports.buildApplyRequest = buildApplyRequest;
|
|
56
|
+
exports.buildProbeRequest = buildProbeRequest;
|
|
57
|
+
exports.buildValidateRequest = buildValidateRequest;
|
|
58
|
+
exports.buildFetchRequest = buildFetchRequest;
|
|
59
|
+
exports.carrierMatches = carrierMatches;
|
|
60
|
+
exports.buildJobSpec = buildJobSpec;
|
|
61
|
+
exports.renderEstimate = renderEstimate;
|
|
62
|
+
exports.fetchCommand = fetchCommand;
|
|
63
|
+
exports.validateCommand = validateCommand;
|
|
64
|
+
exports.probeCommand = probeCommand;
|
|
65
|
+
exports.applyCommand = applyCommand;
|
|
66
|
+
exports.gateSignCommand = gateSignCommand;
|
|
67
|
+
exports.resultsCommand = resultsCommand;
|
|
68
|
+
const fs = __importStar(require("fs"));
|
|
69
|
+
const path = __importStar(require("path"));
|
|
70
|
+
const axios_1 = __importDefault(require("axios"));
|
|
71
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
72
|
+
const ora_1 = __importDefault(require("ora"));
|
|
73
|
+
const credentials_1 = require("../../lib/auth/credentials");
|
|
74
|
+
const fuse_client_1 = require("../../lib/api/fuse-client");
|
|
75
|
+
const constants_1 = require("../../lib/config/constants");
|
|
76
|
+
const logger_1 = require("../../lib/utils/logger");
|
|
77
|
+
const constants_2 = require("./constants");
|
|
78
|
+
const estimate_1 = require("./estimate");
|
|
79
|
+
const gate_1 = require("./gate");
|
|
80
|
+
const guard_1 = require("./guard");
|
|
81
|
+
const numbering_1 = require("./numbering");
|
|
82
|
+
const request_1 = require("./request");
|
|
83
|
+
const tools_lock_1 = require("./tools_lock");
|
|
84
|
+
// ---- pure helpers (unit tested) ---------------------------------------------------------------
|
|
85
|
+
const oneLetter = (s) => (0, numbering_1.formatVariant)(s, 'one');
|
|
86
|
+
/** Parse and group `GENE:p.Leu225Arg` strings into request targets. Duplicates collapse. */
|
|
87
|
+
function groupTargets(variants) {
|
|
88
|
+
const subs = variants.map(numbering_1.parseVariant);
|
|
89
|
+
const byGene = new Map();
|
|
90
|
+
for (const s of subs) {
|
|
91
|
+
if (!byGene.has(s.gene))
|
|
92
|
+
byGene.set(s.gene, new Map());
|
|
93
|
+
byGene.get(s.gene).set(`${s.pos}${s.ref}${s.alt}`, s);
|
|
94
|
+
}
|
|
95
|
+
const targets = [...byGene.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([gene, m]) => ({
|
|
96
|
+
gene,
|
|
97
|
+
uniprot: constants_2.GENES[gene].uniprot,
|
|
98
|
+
subs: [...m.values()].sort((a, b) => a.pos - b.pos || a.alt.localeCompare(b.alt)).map(s => ({ pos: s.pos, ref: s.ref, alt: s.alt })),
|
|
99
|
+
}));
|
|
100
|
+
return { targets, subs: [...byGene.values()].flatMap(m => [...m.values()]) };
|
|
101
|
+
}
|
|
102
|
+
function parseLayers(csv, fallback) {
|
|
103
|
+
if (!csv)
|
|
104
|
+
return fallback;
|
|
105
|
+
const out = csv.split(',').map(s => s.trim()).filter(Boolean);
|
|
106
|
+
for (const l of out)
|
|
107
|
+
if (!constants_2.LAYERS.includes(l))
|
|
108
|
+
throw new Error(`unknown layer "${l}" (layers: ${constants_2.LAYERS.join(', ')})`);
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
function parseGenes(csv) {
|
|
112
|
+
const genes = (csv || Object.keys(constants_2.GENES).join(',')).split(',').map(s => s.trim().toUpperCase()).filter(Boolean);
|
|
113
|
+
for (const g of genes)
|
|
114
|
+
if (!constants_2.GENES[g])
|
|
115
|
+
throw new Error(`gene not supported: ${g} (supported: ${Object.keys(constants_2.GENES).join(', ')})`);
|
|
116
|
+
return [...new Set(genes)];
|
|
117
|
+
}
|
|
118
|
+
/** A well-formed placeholder so a GPU request can be built and priced before it is approved. */
|
|
119
|
+
const PLACEHOLDER_APPROVAL = { estimate_id: '0000000000000000', max_usd: 1 };
|
|
120
|
+
function buildApplyRequest(o) {
|
|
121
|
+
const { targets } = groupTargets(o.variants);
|
|
122
|
+
const gpu = o.layers.some(l => constants_2.GPU_LAYERS.includes(l));
|
|
123
|
+
const req = {
|
|
124
|
+
schema: constants_2.SCHEMA_REQUEST,
|
|
125
|
+
mode: 'apply',
|
|
126
|
+
serial: o.serial,
|
|
127
|
+
sources: o.sources,
|
|
128
|
+
targets,
|
|
129
|
+
layers: o.layers,
|
|
130
|
+
gate: (0, gate_1.gateId)(o.gate),
|
|
131
|
+
};
|
|
132
|
+
if (gpu)
|
|
133
|
+
req.approval = o.approval ?? PLACEHOLDER_APPROVAL;
|
|
134
|
+
if (o.diagnosisAssumption)
|
|
135
|
+
req.diagnosis_assumption = o.diagnosisAssumption;
|
|
136
|
+
return (0, guard_1.validateRequest)(req);
|
|
137
|
+
}
|
|
138
|
+
function buildProbeRequest(genes, approval) {
|
|
139
|
+
return (0, guard_1.validateRequest)({
|
|
140
|
+
schema: constants_2.SCHEMA_REQUEST,
|
|
141
|
+
mode: 'probe',
|
|
142
|
+
targets: genes.map(g => ({ gene: g, uniprot: constants_2.GENES[g].uniprot, subs: [] })),
|
|
143
|
+
layers: ['probe'],
|
|
144
|
+
approval: approval ?? PLACEHOLDER_APPROVAL,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function buildValidateRequest(genes, layers, approval) {
|
|
148
|
+
const gpu = layers.some(l => constants_2.GPU_LAYERS.includes(l));
|
|
149
|
+
const req = {
|
|
150
|
+
schema: constants_2.SCHEMA_REQUEST,
|
|
151
|
+
mode: 'validate',
|
|
152
|
+
targets: genes.map(g => ({ gene: g, uniprot: constants_2.GENES[g].uniprot, subs: [] })),
|
|
153
|
+
layers,
|
|
154
|
+
};
|
|
155
|
+
if (gpu)
|
|
156
|
+
req.approval = approval ?? PLACEHOLDER_APPROVAL;
|
|
157
|
+
return (0, guard_1.validateRequest)(req);
|
|
158
|
+
}
|
|
159
|
+
function buildFetchRequest(genes) {
|
|
160
|
+
return (0, guard_1.validateRequest)({
|
|
161
|
+
schema: constants_2.SCHEMA_REQUEST,
|
|
162
|
+
mode: 'fetch',
|
|
163
|
+
targets: genes.map(g => ({ gene: g, uniprot: constants_2.GENES[g].uniprot, subs: [] })),
|
|
164
|
+
layers: ['fetch'],
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/** Which requested substitutions the sample's annotated missense variants actually carry. */
|
|
168
|
+
function carrierMatches(rows, requested) {
|
|
169
|
+
const present = new Set();
|
|
170
|
+
for (const r of rows) {
|
|
171
|
+
const gene = String(r.base__hugo || '').toUpperCase();
|
|
172
|
+
const ach = String(r.base__achange || '').trim();
|
|
173
|
+
if (!gene || !ach)
|
|
174
|
+
continue;
|
|
175
|
+
try {
|
|
176
|
+
const s = (0, numbering_1.parseVariant)(`${gene}:${ach}`);
|
|
177
|
+
present.add(`${s.gene}:${s.pos}${s.ref}${s.alt}`);
|
|
178
|
+
}
|
|
179
|
+
catch (_) { /* not a missense change in a supported gene */ }
|
|
180
|
+
}
|
|
181
|
+
const found = [];
|
|
182
|
+
const missing = [];
|
|
183
|
+
for (const s of requested)
|
|
184
|
+
(present.has(`${s.gene}:${s.pos}${s.ref}${s.alt}`) ? found : missing).push(s);
|
|
185
|
+
return { found, missing };
|
|
186
|
+
}
|
|
187
|
+
function buildJobSpec(req, gate, creds, today) {
|
|
188
|
+
const jobId = (0, request_1.jobIdFor)(req);
|
|
189
|
+
const outputBucket = 'genobank-parabricks-output';
|
|
190
|
+
const gpu = req.layers.some(l => constants_2.GPU_LAYERS.includes(l));
|
|
191
|
+
return {
|
|
192
|
+
jobId,
|
|
193
|
+
biosampleId: req.serial ?? 'public',
|
|
194
|
+
inputType: gpu ? constants_2.INPUT_TYPE_GPU : constants_2.INPUT_TYPE_CPU,
|
|
195
|
+
proteinImpactRequest: req,
|
|
196
|
+
...(gate ? { proteinImpactGate: gate } : {}),
|
|
197
|
+
manifestUri: `gs://${outputBucket}/biowallet/${creds.wallet_address.toLowerCase()}/protein-impact/${jobId}/manifest.json`,
|
|
198
|
+
methylBiocid: '',
|
|
199
|
+
creatorWallet: creds.wallet_address,
|
|
200
|
+
creatorSig: creds.user_signature,
|
|
201
|
+
outputBucket,
|
|
202
|
+
refBucket: 'genobank-references',
|
|
203
|
+
batchId: `protein-impact-${today}`,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function renderEstimate(e) {
|
|
207
|
+
const rows = e.lines.map(l => ` ${l.layer.padEnd(10)} ${l.machine.padEnd(20)} ${String(l.hours).padStart(7)} h ${('$' + l.usd.toFixed(2)).padStart(9)} ${l.note}`);
|
|
208
|
+
return [
|
|
209
|
+
...rows,
|
|
210
|
+
` ${'total'.padEnd(10)} ${''.padEnd(20)} ${String(e.total_hours).padStart(7)} h ${('$' + e.total_usd.toFixed(2)).padStart(9)}`,
|
|
211
|
+
'',
|
|
212
|
+
` estimate_id ${e.estimate_id} (valid until ${e.valid_until_utc})`,
|
|
213
|
+
...e.assumptions.map(a => ` note ${a}`),
|
|
214
|
+
].join('\n');
|
|
215
|
+
}
|
|
216
|
+
// ---- network commands ---------------------------------------------------------------------------
|
|
217
|
+
const BIOFS_NODE_BASE = process.env.BIOFS_NODE_URL
|
|
218
|
+
|| `${process.env.GENOBANK_API_URL || 'https://genobank.app'}/api_biofs_node`;
|
|
219
|
+
async function postJob(spec, label, json) {
|
|
220
|
+
const spinner = (0, ora_1.default)(`Submitting ${label} to biofs-node...`).start();
|
|
221
|
+
const r = await axios_1.default.post(`${constants_1.CONFIG.API_BASE_URL}/api_biofs_node/job`, spec, { timeout: 300000 });
|
|
222
|
+
spinner.succeed(chalk_1.default.green(`${label} submitted to biofs-node`));
|
|
223
|
+
if (json) {
|
|
224
|
+
console.log(JSON.stringify(r.data, null, 2));
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
console.log();
|
|
228
|
+
console.log(` ${chalk_1.default.cyan('Job ID:')} ${r.data.jobId || spec.jobId}`);
|
|
229
|
+
console.log(` ${chalk_1.default.cyan('Mode:')} ${spec.proteinImpactRequest.mode} (${spec.inputType})`);
|
|
230
|
+
console.log(` ${chalk_1.default.cyan('Layers:')} ${spec.proteinImpactRequest.layers.join(', ')}`);
|
|
231
|
+
console.log(` ${chalk_1.default.cyan('Status:')} ${r.data.status || 'accepted'}`);
|
|
232
|
+
console.log(` ${chalk_1.default.cyan('Result:')} ${spec.manifestUri}`);
|
|
233
|
+
console.log();
|
|
234
|
+
console.log(chalk_1.default.gray('Monitor: ') + chalk_1.default.cyan(`biofs job status ${r.data.jobId || spec.jobId}`));
|
|
235
|
+
console.log(chalk_1.default.gray('Fetch: ') + chalk_1.default.cyan(`biofs protein-impact results ${r.data.jobId || spec.jobId}`));
|
|
236
|
+
console.log();
|
|
237
|
+
}
|
|
238
|
+
function failWith(spinnerLabel, error) {
|
|
239
|
+
if (error.response)
|
|
240
|
+
logger_1.Logger.error(`${spinnerLabel}: server error (${error.response.status}): ${error.response.data?.error || error.response.data?.message || error.message}`);
|
|
241
|
+
else
|
|
242
|
+
logger_1.Logger.error(`${spinnerLabel}: ${error.message}`);
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
function approvalFrom(o) {
|
|
246
|
+
if (!o.approve && !o.maxUsd)
|
|
247
|
+
return undefined;
|
|
248
|
+
if (!o.approve || !o.maxUsd)
|
|
249
|
+
throw new Error('--approve <estimate_id> and --max-usd <N> go together');
|
|
250
|
+
const max = Number(o.maxUsd);
|
|
251
|
+
if (!Number.isFinite(max))
|
|
252
|
+
throw new Error('--max-usd must be a number');
|
|
253
|
+
return { estimate_id: o.approve, max_usd: max };
|
|
254
|
+
}
|
|
255
|
+
/** Print the price of a GPU request; true when the caller should stop (estimate-only, or approval missing). */
|
|
256
|
+
function priceGate(req, o) {
|
|
257
|
+
const e = (0, estimate_1.estimate)(req);
|
|
258
|
+
if (!e.gpu) {
|
|
259
|
+
if (!o.estimate)
|
|
260
|
+
return false;
|
|
261
|
+
console.log(chalk_1.default.bold('CPU only, no approval needed:\n') + renderEstimate(e));
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
console.log(chalk_1.default.bold('GPU estimate (a planning figure; the node stops a job at 1.5 x the approved total):\n'));
|
|
265
|
+
console.log(renderEstimate(e));
|
|
266
|
+
console.log();
|
|
267
|
+
if (o.estimate)
|
|
268
|
+
return true;
|
|
269
|
+
if (!o.approve) {
|
|
270
|
+
console.log(chalk_1.default.yellow('No job was submitted. To run it, repeat the command with:'));
|
|
271
|
+
console.log(chalk_1.default.cyan(` --approve ${e.estimate_id} --max-usd ${Math.ceil(e.total_usd)}`));
|
|
272
|
+
process.exitCode = 1;
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
async function fetchCommand(o) {
|
|
278
|
+
try {
|
|
279
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
280
|
+
if (!creds)
|
|
281
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
282
|
+
const req = buildFetchRequest(parseGenes(o.genes));
|
|
283
|
+
await postJob(buildJobSpec(req, undefined, creds, new Date().toISOString().slice(0, 10)), 'protein-impact fetch', o.json);
|
|
284
|
+
}
|
|
285
|
+
catch (e) {
|
|
286
|
+
failWith('protein-impact fetch failed', e);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async function validateCommand(o) {
|
|
290
|
+
try {
|
|
291
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
292
|
+
if (!creds)
|
|
293
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
294
|
+
const genes = parseGenes(o.genes);
|
|
295
|
+
const layers = parseLayers(o.layers, ['plm']);
|
|
296
|
+
if (priceGate(buildValidateRequest(genes, layers), o))
|
|
297
|
+
return;
|
|
298
|
+
const req = buildValidateRequest(genes, layers, approvalFrom(o));
|
|
299
|
+
(0, estimate_1.verifyApproval)(req);
|
|
300
|
+
await postJob(buildJobSpec(req, undefined, creds, new Date().toISOString().slice(0, 10)), 'protein-impact validate', o.json);
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
failWith('protein-impact validate failed', e);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async function probeCommand(o) {
|
|
307
|
+
try {
|
|
308
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
309
|
+
if (!creds)
|
|
310
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
311
|
+
const genes = parseGenes(o.genes);
|
|
312
|
+
if (priceGate(buildProbeRequest(genes), o))
|
|
313
|
+
return;
|
|
314
|
+
const req = buildProbeRequest(genes, approvalFrom(o));
|
|
315
|
+
(0, estimate_1.verifyApproval)(req);
|
|
316
|
+
await postJob(buildJobSpec(req, undefined, creds, new Date().toISOString().slice(0, 10)), 'protein-impact probe', o.json);
|
|
317
|
+
}
|
|
318
|
+
catch (e) {
|
|
319
|
+
failWith('protein-impact probe failed', e);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async function applyCommand(serial, o) {
|
|
323
|
+
try {
|
|
324
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
325
|
+
if (!creds)
|
|
326
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
327
|
+
if (!o.variant || o.variant.length === 0)
|
|
328
|
+
throw new Error('at least one --variant GENE:p.Leu225Arg is required');
|
|
329
|
+
if (!o.source || o.source.length === 0 || o.source.length > constants_2.MAX_SOURCES)
|
|
330
|
+
throw new Error(`--source <biocid> is required (1 to ${constants_2.MAX_SOURCES}): the biocid(s) the variants were read from`);
|
|
331
|
+
for (const s of o.source)
|
|
332
|
+
if (!constants_2.BIOCID_RE.test(s))
|
|
333
|
+
throw new Error(`--source is not a biocid: ${s}`);
|
|
334
|
+
if (!o.source.some(s => s.includes(serial)))
|
|
335
|
+
logger_1.Logger.warn(`none of the --source biocids mentions ${serial}; check that they belong to this sample`);
|
|
336
|
+
const gate = JSON.parse(fs.readFileSync(o.gateFile, 'utf8'));
|
|
337
|
+
const { targets, subs } = groupTargets(o.variant);
|
|
338
|
+
const layers = parseLayers(o.layers, ['features']);
|
|
339
|
+
// the gate must pass before anything is sent
|
|
340
|
+
(0, gate_1.verifyGateForApply)(gate, (0, gate_1.loadRules)(), { tools_lock_sha256: (0, tools_lock_1.toolsLockSha256)(), variants: subs.map(oneLetter) });
|
|
341
|
+
// the sample must carry every variant (read through the gated variants API; the sqlite stays on the server)
|
|
342
|
+
const api = new fuse_client_1.FuseAPIClient();
|
|
343
|
+
const spinner = (0, ora_1.default)('Checking that the sample carries the variants (gated API, no download)...').start();
|
|
344
|
+
const rows = [];
|
|
345
|
+
for (const t of targets) {
|
|
346
|
+
const r = await api.variantsPolled(serial, creds.wallet_address, creds.user_signature, { gene: t.gene, so: 'MIS', maxAf: '1', limit: 500 });
|
|
347
|
+
rows.push(...r.rows);
|
|
348
|
+
}
|
|
349
|
+
const { missing } = carrierMatches(rows, subs);
|
|
350
|
+
if (missing.length) {
|
|
351
|
+
spinner.fail(chalk_1.default.red('Variant not found in the sample'));
|
|
352
|
+
throw new Error(`${missing.map(s => (0, numbering_1.formatVariant)(s)).join(', ')} not among the annotated missense variants of ${serial}; nothing was submitted`);
|
|
353
|
+
}
|
|
354
|
+
spinner.succeed(chalk_1.default.green(`Sample ${serial} carries all ${subs.length} requested variant(s)`));
|
|
355
|
+
const base = { serial, variants: o.variant, sources: o.source, layers, gate, diagnosisAssumption: o.diagnosisAssumption };
|
|
356
|
+
if (priceGate(buildApplyRequest(base), o))
|
|
357
|
+
return;
|
|
358
|
+
const req = buildApplyRequest({ ...base, approval: approvalFrom(o) });
|
|
359
|
+
(0, estimate_1.verifyApproval)(req);
|
|
360
|
+
await postJob(buildJobSpec(req, gate, creds, new Date().toISOString().slice(0, 10)), 'protein-impact apply', o.json);
|
|
361
|
+
}
|
|
362
|
+
catch (e) {
|
|
363
|
+
if (e instanceof gate_1.GateBlockedError) {
|
|
364
|
+
logger_1.Logger.error(e.message);
|
|
365
|
+
process.exit(8);
|
|
366
|
+
}
|
|
367
|
+
failWith('protein-impact apply failed', e);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
async function gateSignCommand(file, o) {
|
|
371
|
+
try {
|
|
372
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
373
|
+
if (!creds)
|
|
374
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
375
|
+
const doc = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
376
|
+
const rules = (0, gate_1.loadRules)();
|
|
377
|
+
const ev = (0, gate_1.evaluateGate)(rules, doc.metrics);
|
|
378
|
+
const m = doc.metrics;
|
|
379
|
+
console.log(chalk_1.default.bold('Gate document'));
|
|
380
|
+
console.log(` benchmark ${m.n_pos} damaging, ${m.n_neg} tolerated`);
|
|
381
|
+
console.log(` AUROC (pooled) ${m.pooled_auroc.point} 95% CI ${m.pooled_auroc.ci_low} to ${m.pooled_auroc.ci_high}`);
|
|
382
|
+
console.log(` best baseline ${m.best_baseline.name} ${m.best_baseline.auroc}`);
|
|
383
|
+
console.log(` by domain ${Object.entries(m.domain_auroc).map(([k, v]) => `${k} ${v} (${m.domain_n?.[k]?.pos ?? '?'} damaging, ${m.domain_n?.[k]?.neg ?? '?'} tolerated)`).join(', ')}`);
|
|
384
|
+
console.log(` shuffled labels 95% CI ${m.shuffled_label.ci_low} to ${m.shuffled_label.ci_high}`);
|
|
385
|
+
console.log(` verdict ${ev.pass ? chalk_1.default.green('PASS') : chalk_1.default.red('FAIL')}`);
|
|
386
|
+
for (const r of ev.reasons)
|
|
387
|
+
console.log(chalk_1.default.red(` ${r}`));
|
|
388
|
+
if (doc.rules_sha256 !== (0, gate_1.rulesSha256)(rules))
|
|
389
|
+
throw new Error('the gate was computed against different rules than gate_rules.json; it cannot be signed');
|
|
390
|
+
if (doc.tools_lock_sha256 !== (0, tools_lock_1.toolsLockSha256)())
|
|
391
|
+
throw new Error('the gate was computed with different tool versions than tools.lock.json; re-validate');
|
|
392
|
+
if (!ev.pass)
|
|
393
|
+
throw new Error('the gate does not pass; it is not signed');
|
|
394
|
+
if (!o.yes) {
|
|
395
|
+
console.log(chalk_1.default.yellow('\nReview the numbers above, then repeat with --yes to sign.'));
|
|
396
|
+
process.exitCode = 2;
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const signed = (0, gate_1.signGate)(doc, creds.wallet_address.toLowerCase(), new Date().toISOString());
|
|
400
|
+
const out = o.out || file.replace(/\.json$/, '') + '.signed.json';
|
|
401
|
+
fs.writeFileSync(out, JSON.stringify(signed, null, 2));
|
|
402
|
+
console.log(chalk_1.default.green(`\nSigned by ${signed.signed_off.by} at ${signed.signed_off.at}`));
|
|
403
|
+
console.log(` file ${path.resolve(out)}`);
|
|
404
|
+
console.log(` gate id ${(0, gate_1.gateId)(signed)}`);
|
|
405
|
+
}
|
|
406
|
+
catch (e) {
|
|
407
|
+
failWith('protein-impact gate-sign failed', e);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async function resultsCommand(jobId, o) {
|
|
411
|
+
try {
|
|
412
|
+
const creds = await (0, credentials_1.getCredentials)();
|
|
413
|
+
if (!creds)
|
|
414
|
+
throw new Error('Not authenticated. Run "biofs login" first.');
|
|
415
|
+
if (!/^pi-[a-z]+-[A-Za-z0-9]+-[a-f0-9]{12}$/.test(jobId))
|
|
416
|
+
throw new Error(`not a protein-impact job id: ${jobId}`);
|
|
417
|
+
const r = await axios_1.default.get(`${BIOFS_NODE_BASE}/protein_impact_result`, {
|
|
418
|
+
params: { job_id: jobId },
|
|
419
|
+
headers: { 'X-Biofs-Wallet': creds.wallet_address, 'X-Biofs-Signature': creds.user_signature },
|
|
420
|
+
timeout: 60000,
|
|
421
|
+
validateStatus: s => s < 600,
|
|
422
|
+
});
|
|
423
|
+
if (r.status === 404)
|
|
424
|
+
throw new Error('no result yet (the job may still be running, or the node does not have the result endpoint)');
|
|
425
|
+
if (r.status >= 400)
|
|
426
|
+
throw new Error(`${r.status}: ${r.data?.error || 'unknown'}`);
|
|
427
|
+
const out = o.out || `protein-impact-${jobId}.json`;
|
|
428
|
+
fs.writeFileSync(out, JSON.stringify(r.data, null, 2));
|
|
429
|
+
let gateFile = null;
|
|
430
|
+
if (r.data.gate_document) {
|
|
431
|
+
gateFile = out.replace(/\.json$/, '') + '.gate.json';
|
|
432
|
+
fs.writeFileSync(gateFile, JSON.stringify(r.data.gate_document, null, 2));
|
|
433
|
+
}
|
|
434
|
+
if (o.json) {
|
|
435
|
+
console.log(JSON.stringify(r.data, null, 2));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const m = r.data;
|
|
439
|
+
console.log(chalk_1.default.bold(`protein-impact ${m.jobId} ${m.status}`));
|
|
440
|
+
console.log(chalk_1.default.gray(m.research_banner || ''));
|
|
441
|
+
for (const s of m.stages || [])
|
|
442
|
+
console.log(` stage ${String(s.layer).padEnd(10)} ${s.status}${s.error ? ' ' + s.error : ''}`);
|
|
443
|
+
for (const v of m.results || [])
|
|
444
|
+
console.log(` ${v.variant} mature ${v.mature_pos} layers: ${Object.keys(v.layers).join(', ') || 'none'}`);
|
|
445
|
+
for (const e of m.errors || [])
|
|
446
|
+
console.log(chalk_1.default.red(` ${e}`));
|
|
447
|
+
if (r.data.gate_document) {
|
|
448
|
+
const g = r.data.gate_document;
|
|
449
|
+
console.log(` gate document: ${g.pass ? chalk_1.default.green('PASS') : chalk_1.default.red('FAIL')}${(g.reasons || []).map((x) => '\n ' + x).join('')}`);
|
|
450
|
+
}
|
|
451
|
+
console.log(`\n saved ${path.resolve(out)}`);
|
|
452
|
+
if (gateFile)
|
|
453
|
+
console.log(` gate ${path.resolve(gateFile)} (review it, then: biofs protein-impact gate-sign ${gateFile} --yes)`);
|
|
454
|
+
console.log(chalk_1.default.gray(' To file it with lineage: ') + chalk_1.default.cyan(`biofs register-derived ${out} --type protein-impact-report --parent <source biocid>`));
|
|
455
|
+
}
|
|
456
|
+
catch (e) {
|
|
457
|
+
failWith('protein-impact results failed', e);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
//# sourceMappingURL=submit.js.map
|