@genobank/biofs 3.1.0 → 3.18.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 +663 -462
- package/dist/abi/USDC.json +33 -0
- package/dist/abi/sequentia/BioAgentRegistry.json +20 -0
- package/dist/abi/sequentia/BioCIDRegistry.json +139 -0
- package/dist/abi/sequentia/BioPIL.json +130 -0
- package/dist/abi/sequentia/ConsentManager.json +620 -0
- package/dist/abi/sequentia/OpenCravatJobs.json +988 -0
- package/dist/abi/sequentia/PaymentRouter.json +638 -0
- package/dist/commands/agent/list-sequentia.d.ts +17 -0
- package/dist/commands/agent/list-sequentia.d.ts.map +1 -0
- package/dist/commands/agent/list-sequentia.js +87 -0
- package/dist/commands/agent/list-sequentia.js.map +1 -0
- package/dist/commands/agent/register-sequentia.d.ts +33 -0
- package/dist/commands/agent/register-sequentia.d.ts.map +1 -0
- package/dist/commands/agent/register-sequentia.js +145 -0
- package/dist/commands/agent/register-sequentia.js.map +1 -0
- package/dist/commands/align-shard/exec.d.ts +45 -0
- package/dist/commands/align-shard/exec.d.ts.map +1 -0
- package/dist/commands/align-shard/exec.js +549 -0
- package/dist/commands/align-shard/exec.js.map +1 -0
- package/dist/commands/align-shard/submit.d.ts +37 -0
- package/dist/commands/align-shard/submit.d.ts.map +1 -0
- package/dist/commands/align-shard/submit.js +117 -0
- package/dist/commands/align-shard/submit.js.map +1 -0
- package/dist/commands/ancestry/ingest.d.ts +34 -0
- package/dist/commands/ancestry/ingest.d.ts.map +1 -0
- package/dist/commands/ancestry/ingest.js +175 -0
- package/dist/commands/ancestry/ingest.js.map +1 -0
- package/dist/commands/ancestry/share.d.ts +33 -0
- package/dist/commands/ancestry/share.d.ts.map +1 -0
- package/dist/commands/ancestry/share.js +154 -0
- package/dist/commands/ancestry/share.js.map +1 -0
- package/dist/commands/ancestry/somos.d.ts +34 -0
- package/dist/commands/ancestry/somos.d.ts.map +1 -0
- package/dist/commands/ancestry/somos.js +151 -0
- package/dist/commands/ancestry/somos.js.map +1 -0
- package/dist/commands/ancestry/status.d.ts +14 -0
- package/dist/commands/ancestry/status.d.ts.map +1 -0
- package/dist/commands/ancestry/status.js +74 -0
- package/dist/commands/ancestry/status.js.map +1 -0
- package/dist/commands/annotate/status.d.ts +11 -4
- package/dist/commands/annotate/status.d.ts.map +1 -1
- package/dist/commands/annotate/status.js +66 -99
- package/dist/commands/annotate/status.js.map +1 -1
- package/dist/commands/annotate/submit.d.ts +15 -5
- package/dist/commands/annotate/submit.d.ts.map +1 -1
- package/dist/commands/annotate/submit.js +86 -266
- package/dist/commands/annotate/submit.js.map +1 -1
- package/dist/commands/benchmark.d.ts +50 -0
- package/dist/commands/benchmark.d.ts.map +1 -0
- package/dist/commands/benchmark.js +608 -0
- package/dist/commands/benchmark.js.map +1 -0
- package/dist/commands/biofiles.d.ts +1 -0
- package/dist/commands/biofiles.d.ts.map +1 -1
- package/dist/commands/biofiles.js +19 -6
- package/dist/commands/biofiles.js.map +1 -1
- package/dist/commands/biowallet/bind.d.ts +12 -0
- package/dist/commands/biowallet/bind.d.ts.map +1 -0
- package/dist/commands/biowallet/bind.js +85 -0
- package/dist/commands/biowallet/bind.js.map +1 -0
- package/dist/commands/biowallet/create.d.ts +40 -0
- package/dist/commands/biowallet/create.d.ts.map +1 -0
- package/dist/commands/biowallet/create.js +191 -0
- package/dist/commands/biowallet/create.js.map +1 -0
- package/dist/commands/biowallet/family.d.ts +48 -0
- package/dist/commands/biowallet/family.d.ts.map +1 -0
- package/dist/commands/biowallet/family.js +310 -0
- package/dist/commands/biowallet/family.js.map +1 -0
- package/dist/commands/biowallet/list.d.ts +15 -0
- package/dist/commands/biowallet/list.d.ts.map +1 -0
- package/dist/commands/biowallet/list.js +81 -0
- package/dist/commands/biowallet/list.js.map +1 -0
- package/dist/commands/bode.d.ts +34 -0
- package/dist/commands/bode.d.ts.map +1 -0
- package/dist/commands/bode.js +257 -0
- package/dist/commands/bode.js.map +1 -0
- package/dist/commands/claim.d.ts +32 -0
- package/dist/commands/claim.d.ts.map +1 -0
- package/dist/commands/claim.js +138 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/clinical.d.ts +49 -0
- package/dist/commands/clinical.d.ts.map +1 -0
- package/dist/commands/clinical.js +273 -0
- package/dist/commands/clinical.js.map +1 -0
- package/dist/commands/cohort-acmg.d.ts +42 -0
- package/dist/commands/cohort-acmg.d.ts.map +1 -0
- package/dist/commands/cohort-acmg.js +319 -0
- package/dist/commands/cohort-acmg.js.map +1 -0
- package/dist/commands/cohort-fourier-score.d.ts +57 -0
- package/dist/commands/cohort-fourier-score.d.ts.map +1 -0
- package/dist/commands/cohort-fourier-score.js +390 -0
- package/dist/commands/cohort-fourier-score.js.map +1 -0
- package/dist/commands/cohort-pipeline.d.ts +49 -0
- package/dist/commands/cohort-pipeline.d.ts.map +1 -0
- package/dist/commands/cohort-pipeline.js +308 -0
- package/dist/commands/cohort-pipeline.js.map +1 -0
- package/dist/commands/cohort-train.d.ts +45 -0
- package/dist/commands/cohort-train.d.ts.map +1 -0
- package/dist/commands/cohort-train.js +308 -0
- package/dist/commands/cohort-train.js.map +1 -0
- package/dist/commands/comethyl/exec.d.ts +40 -0
- package/dist/commands/comethyl/exec.d.ts.map +1 -0
- package/dist/commands/comethyl/exec.js +493 -0
- package/dist/commands/comethyl/exec.js.map +1 -0
- package/dist/commands/comethyl/submit.d.ts +35 -0
- package/dist/commands/comethyl/submit.d.ts.map +1 -0
- package/dist/commands/comethyl/submit.js +98 -0
- package/dist/commands/comethyl/submit.js.map +1 -0
- package/dist/commands/consent.d.ts +10 -0
- package/dist/commands/consent.d.ts.map +1 -0
- package/dist/commands/consent.js +114 -0
- package/dist/commands/consent.js.map +1 -0
- package/dist/commands/dipcall/exec.d.ts +25 -0
- package/dist/commands/dipcall/exec.d.ts.map +1 -0
- package/dist/commands/dipcall/exec.js +207 -0
- package/dist/commands/dipcall/exec.js.map +1 -0
- package/dist/commands/dipcall/submit.d.ts +22 -0
- package/dist/commands/dipcall/submit.d.ts.map +1 -0
- package/dist/commands/dipcall/submit.js +81 -0
- package/dist/commands/dipcall/submit.js.map +1 -0
- package/dist/commands/download-with-consent.d.ts +1 -0
- package/dist/commands/download-with-consent.d.ts.map +1 -1
- package/dist/commands/download-with-consent.js +32 -0
- package/dist/commands/download-with-consent.js.map +1 -1
- package/dist/commands/download.d.ts +2 -0
- package/dist/commands/download.d.ts.map +1 -1
- package/dist/commands/download.js +31 -0
- package/dist/commands/download.js.map +1 -1
- package/dist/commands/duet.d.ts +39 -0
- package/dist/commands/duet.d.ts.map +1 -0
- package/dist/commands/duet.js +323 -0
- package/dist/commands/duet.js.map +1 -0
- package/dist/commands/erase.d.ts +29 -0
- package/dist/commands/erase.d.ts.map +1 -0
- package/dist/commands/erase.js +136 -0
- package/dist/commands/erase.js.map +1 -0
- package/dist/commands/family-status.d.ts +3 -0
- package/dist/commands/family-status.d.ts.map +1 -1
- package/dist/commands/family-status.js +279 -166
- package/dist/commands/family-status.js.map +1 -1
- package/dist/commands/fingerprint.d.ts +2 -0
- package/dist/commands/fingerprint.d.ts.map +1 -1
- package/dist/commands/fingerprint.js +4 -0
- package/dist/commands/fingerprint.js.map +1 -1
- package/dist/commands/fluency/index.d.ts +7 -0
- package/dist/commands/fluency/index.d.ts.map +1 -0
- package/dist/commands/fluency/index.js +122 -0
- package/dist/commands/fluency/index.js.map +1 -0
- package/dist/commands/fourier-score.d.ts +36 -0
- package/dist/commands/fourier-score.d.ts.map +1 -0
- package/dist/commands/fourier-score.js +713 -0
- package/dist/commands/fourier-score.js.map +1 -0
- package/dist/commands/fuse.d.ts.map +1 -1
- package/dist/commands/fuse.js +29 -7
- package/dist/commands/fuse.js.map +1 -1
- package/dist/commands/hifi-align/exec.d.ts +23 -0
- package/dist/commands/hifi-align/exec.d.ts.map +1 -0
- package/dist/commands/hifi-align/exec.js +224 -0
- package/dist/commands/hifi-align/exec.js.map +1 -0
- package/dist/commands/hifi-align/submit.d.ts +22 -0
- package/dist/commands/hifi-align/submit.d.ts.map +1 -0
- package/dist/commands/hifi-align/submit.js +82 -0
- package/dist/commands/hifi-align/submit.js.map +1 -0
- package/dist/commands/hifi-deepvariant/exec.d.ts +29 -0
- package/dist/commands/hifi-deepvariant/exec.d.ts.map +1 -0
- package/dist/commands/hifi-deepvariant/exec.js +280 -0
- package/dist/commands/hifi-deepvariant/exec.js.map +1 -0
- package/dist/commands/hifi-deepvariant/submit.d.ts +23 -0
- package/dist/commands/hifi-deepvariant/submit.d.ts.map +1 -0
- package/dist/commands/hifi-deepvariant/submit.js +80 -0
- package/dist/commands/hifi-deepvariant/submit.js.map +1 -0
- package/dist/commands/hifi-methyl/exec.d.ts +25 -0
- package/dist/commands/hifi-methyl/exec.d.ts.map +1 -0
- package/dist/commands/hifi-methyl/exec.js +243 -0
- package/dist/commands/hifi-methyl/exec.js.map +1 -0
- package/dist/commands/hifi-methyl/submit.d.ts +22 -0
- package/dist/commands/hifi-methyl/submit.d.ts.map +1 -0
- package/dist/commands/hifi-methyl/submit.js +78 -0
- package/dist/commands/hifi-methyl/submit.js.map +1 -0
- package/dist/commands/htsget.d.ts +6 -0
- package/dist/commands/htsget.d.ts.map +1 -1
- package/dist/commands/htsget.js +31 -6
- package/dist/commands/htsget.js.map +1 -1
- package/dist/commands/imaging/attribute.d.ts +19 -0
- package/dist/commands/imaging/attribute.d.ts.map +1 -0
- package/dist/commands/imaging/attribute.js +102 -0
- package/dist/commands/imaging/attribute.js.map +1 -0
- package/dist/commands/imaging/characterize.d.ts +20 -0
- package/dist/commands/imaging/characterize.d.ts.map +1 -0
- package/dist/commands/imaging/characterize.js +105 -0
- package/dist/commands/imaging/characterize.js.map +1 -0
- package/dist/commands/imaging/compare.d.ts +33 -0
- package/dist/commands/imaging/compare.d.ts.map +1 -0
- package/dist/commands/imaging/compare.js +129 -0
- package/dist/commands/imaging/compare.js.map +1 -0
- package/dist/commands/imaging/enrich.d.ts +28 -0
- package/dist/commands/imaging/enrich.d.ts.map +1 -0
- package/dist/commands/imaging/enrich.js +130 -0
- package/dist/commands/imaging/enrich.js.map +1 -0
- package/dist/commands/imaging/findings.d.ts +21 -0
- package/dist/commands/imaging/findings.d.ts.map +1 -0
- package/dist/commands/imaging/findings.js +134 -0
- package/dist/commands/imaging/findings.js.map +1 -0
- package/dist/commands/imaging/lesions.d.ts +21 -0
- package/dist/commands/imaging/lesions.d.ts.map +1 -0
- package/dist/commands/imaging/lesions.js +131 -0
- package/dist/commands/imaging/lesions.js.map +1 -0
- package/dist/commands/imaging/submit.d.ts +32 -0
- package/dist/commands/imaging/submit.d.ts.map +1 -0
- package/dist/commands/imaging/submit.js +118 -0
- package/dist/commands/imaging/submit.js.map +1 -0
- package/dist/commands/imaging/trajectory.d.ts +23 -0
- package/dist/commands/imaging/trajectory.d.ts.map +1 -0
- package/dist/commands/imaging/trajectory.js +134 -0
- package/dist/commands/imaging/trajectory.js.map +1 -0
- package/dist/commands/imaging/twin.d.ts +32 -0
- package/dist/commands/imaging/twin.d.ts.map +1 -0
- package/dist/commands/imaging/twin.js +168 -0
- package/dist/commands/imaging/twin.js.map +1 -0
- package/dist/commands/ingest-rna-tpm.d.ts +33 -0
- package/dist/commands/ingest-rna-tpm.d.ts.map +1 -0
- package/dist/commands/ingest-rna-tpm.js +104 -0
- package/dist/commands/ingest-rna-tpm.js.map +1 -0
- package/dist/commands/interpret/status.d.ts +14 -0
- package/dist/commands/interpret/status.d.ts.map +1 -0
- package/dist/commands/interpret/status.js +83 -0
- package/dist/commands/interpret/status.js.map +1 -0
- package/dist/commands/interpret/submit.d.ts +22 -0
- package/dist/commands/interpret/submit.d.ts.map +1 -0
- package/dist/commands/interpret/submit.js +103 -0
- package/dist/commands/interpret/submit.js.map +1 -0
- package/dist/commands/inventory/cohort.d.ts +29 -0
- package/dist/commands/inventory/cohort.d.ts.map +1 -0
- package/dist/commands/inventory/cohort.js +136 -0
- package/dist/commands/inventory/cohort.js.map +1 -0
- package/dist/commands/inventory-register-sqlite.d.ts +36 -0
- package/dist/commands/inventory-register-sqlite.d.ts.map +1 -0
- package/dist/commands/inventory-register-sqlite.js +178 -0
- package/dist/commands/inventory-register-sqlite.js.map +1 -0
- package/dist/commands/job/recall.d.ts +6 -0
- package/dist/commands/job/recall.d.ts.map +1 -0
- package/dist/commands/job/recall.js +59 -0
- package/dist/commands/job/recall.js.map +1 -0
- package/dist/commands/job/reconcile.d.ts +19 -0
- package/dist/commands/job/reconcile.d.ts.map +1 -0
- package/dist/commands/job/reconcile.js +67 -0
- package/dist/commands/job/reconcile.js.map +1 -0
- package/dist/commands/lab/refreshCoverage.d.ts +53 -0
- package/dist/commands/lab/refreshCoverage.d.ts.map +1 -0
- package/dist/commands/lab/refreshCoverage.js +244 -0
- package/dist/commands/lab/refreshCoverage.js.map +1 -0
- package/dist/commands/liftover/exec.d.ts +27 -0
- package/dist/commands/liftover/exec.d.ts.map +1 -0
- package/dist/commands/liftover/exec.js +258 -0
- package/dist/commands/liftover/exec.js.map +1 -0
- package/dist/commands/liftover/submit.d.ts +22 -0
- package/dist/commands/liftover/submit.d.ts.map +1 -0
- package/dist/commands/liftover/submit.js +79 -0
- package/dist/commands/liftover/submit.js.map +1 -0
- package/dist/commands/lineage.d.ts +6 -0
- package/dist/commands/lineage.d.ts.map +1 -0
- package/dist/commands/lineage.js +126 -0
- package/dist/commands/lineage.js.map +1 -0
- package/dist/commands/methyl/exec.d.ts +47 -0
- package/dist/commands/methyl/exec.d.ts.map +1 -0
- package/dist/commands/methyl/exec.js +565 -0
- package/dist/commands/methyl/exec.js.map +1 -0
- package/dist/commands/methyl/submit.d.ts +25 -0
- package/dist/commands/methyl/submit.d.ts.map +1 -0
- package/dist/commands/methyl/submit.js +98 -0
- package/dist/commands/methyl/submit.js.map +1 -0
- package/dist/commands/mount.d.ts +17 -2
- package/dist/commands/mount.d.ts.map +1 -1
- package/dist/commands/mount.js +158 -6
- package/dist/commands/mount.js.map +1 -1
- package/dist/commands/myvariant.d.ts +60 -0
- package/dist/commands/myvariant.d.ts.map +1 -0
- package/dist/commands/myvariant.js +433 -0
- package/dist/commands/myvariant.js.map +1 -0
- package/dist/commands/ont-variants/exec.d.ts +24 -0
- package/dist/commands/ont-variants/exec.d.ts.map +1 -0
- package/dist/commands/ont-variants/exec.js +230 -0
- package/dist/commands/ont-variants/exec.js.map +1 -0
- package/dist/commands/ont-variants/submit.d.ts +22 -0
- package/dist/commands/ont-variants/submit.d.ts.map +1 -0
- package/dist/commands/ont-variants/submit.js +78 -0
- package/dist/commands/ont-variants/submit.js.map +1 -0
- package/dist/commands/pbsv/exec.d.ts +24 -0
- package/dist/commands/pbsv/exec.d.ts.map +1 -0
- package/dist/commands/pbsv/exec.js +231 -0
- package/dist/commands/pbsv/exec.js.map +1 -0
- package/dist/commands/pbsv/submit.d.ts +22 -0
- package/dist/commands/pbsv/submit.d.ts.map +1 -0
- package/dist/commands/pbsv/submit.js +78 -0
- package/dist/commands/pbsv/submit.js.map +1 -0
- package/dist/commands/phase/exec.d.ts +26 -0
- package/dist/commands/phase/exec.d.ts.map +1 -0
- package/dist/commands/phase/exec.js +246 -0
- package/dist/commands/phase/exec.js.map +1 -0
- package/dist/commands/phase/submit.d.ts +24 -0
- package/dist/commands/phase/submit.d.ts.map +1 -0
- package/dist/commands/phase/submit.js +83 -0
- package/dist/commands/phase/submit.js.map +1 -0
- package/dist/commands/pipe.d.ts +4 -2
- package/dist/commands/pipe.d.ts.map +1 -1
- package/dist/commands/pipe.js +55 -50
- package/dist/commands/pipe.js.map +1 -1
- package/dist/commands/pipeline/runWes.d.ts +28 -0
- package/dist/commands/pipeline/runWes.d.ts.map +1 -0
- package/dist/commands/pipeline/runWes.js +276 -0
- package/dist/commands/pipeline/runWes.js.map +1 -0
- package/dist/commands/profile.d.ts +8 -0
- package/dist/commands/profile.d.ts.map +1 -0
- package/dist/commands/profile.js +193 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/psm-consensus.d.ts +72 -0
- package/dist/commands/psm-consensus.d.ts.map +1 -0
- package/dist/commands/psm-consensus.js +338 -0
- package/dist/commands/psm-consensus.js.map +1 -0
- package/dist/commands/qc/exec.d.ts +32 -0
- package/dist/commands/qc/exec.d.ts.map +1 -0
- package/dist/commands/qc/exec.js +350 -0
- package/dist/commands/qc/exec.js.map +1 -0
- package/dist/commands/qc/submit.d.ts +23 -0
- package/dist/commands/qc/submit.d.ts.map +1 -0
- package/dist/commands/qc/submit.js +88 -0
- package/dist/commands/qc/submit.js.map +1 -0
- package/dist/commands/query.d.ts +37 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +170 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/repeat-genotype/exec.d.ts +26 -0
- package/dist/commands/repeat-genotype/exec.d.ts.map +1 -0
- package/dist/commands/repeat-genotype/exec.js +245 -0
- package/dist/commands/repeat-genotype/exec.js.map +1 -0
- package/dist/commands/repeat-genotype/submit.d.ts +23 -0
- package/dist/commands/repeat-genotype/submit.d.ts.map +1 -0
- package/dist/commands/repeat-genotype/submit.js +82 -0
- package/dist/commands/repeat-genotype/submit.js.map +1 -0
- package/dist/commands/researcher/passport.d.ts +15 -0
- package/dist/commands/researcher/passport.d.ts.map +1 -0
- package/dist/commands/researcher/passport.js +98 -0
- package/dist/commands/researcher/passport.js.map +1 -0
- package/dist/commands/researcher/register.d.ts +18 -0
- package/dist/commands/researcher/register.d.ts.map +1 -0
- package/dist/commands/researcher/register.js +277 -0
- package/dist/commands/researcher/register.js.map +1 -0
- package/dist/commands/researcher/status.d.ts +6 -0
- package/dist/commands/researcher/status.d.ts.map +1 -0
- package/dist/commands/researcher/status.js +111 -0
- package/dist/commands/researcher/status.js.map +1 -0
- package/dist/commands/room.d.ts +31 -0
- package/dist/commands/room.d.ts.map +1 -0
- package/dist/commands/room.js +486 -0
- package/dist/commands/room.js.map +1 -0
- package/dist/commands/route/anchor.d.ts +42 -0
- package/dist/commands/route/anchor.d.ts.map +1 -0
- package/dist/commands/route/anchor.js +213 -0
- package/dist/commands/route/anchor.js.map +1 -0
- package/dist/commands/route/index.d.ts +27 -0
- package/dist/commands/route/index.d.ts.map +1 -0
- package/dist/commands/route/index.js +82 -0
- package/dist/commands/route/index.js.map +1 -0
- package/dist/commands/rrm-consensus.d.ts +74 -0
- package/dist/commands/rrm-consensus.d.ts.map +1 -0
- package/dist/commands/rrm-consensus.js +334 -0
- package/dist/commands/rrm-consensus.js.map +1 -0
- package/dist/commands/rrm-distribution.d.ts +34 -0
- package/dist/commands/rrm-distribution.d.ts.map +1 -0
- package/dist/commands/rrm-distribution.js +743 -0
- package/dist/commands/rrm-distribution.js.map +1 -0
- package/dist/commands/rrm-train.d.ts +33 -0
- package/dist/commands/rrm-train.d.ts.map +1 -0
- package/dist/commands/rrm-train.js +549 -0
- package/dist/commands/rrm-train.js.map +1 -0
- package/dist/commands/samples.d.ts +25 -0
- package/dist/commands/samples.d.ts.map +1 -0
- package/dist/commands/samples.js +184 -0
- package/dist/commands/samples.js.map +1 -0
- package/dist/commands/score-protein.d.ts +13 -0
- package/dist/commands/score-protein.d.ts.map +1 -0
- package/dist/commands/score-protein.js +360 -0
- package/dist/commands/score-protein.js.map +1 -0
- package/dist/commands/stream.d.ts +7 -0
- package/dist/commands/stream.d.ts.map +1 -1
- package/dist/commands/stream.js +26 -41
- package/dist/commands/stream.js.map +1 -1
- package/dist/commands/sv-call/exec.d.ts +23 -0
- package/dist/commands/sv-call/exec.d.ts.map +1 -0
- package/dist/commands/sv-call/exec.js +233 -0
- package/dist/commands/sv-call/exec.js.map +1 -0
- package/dist/commands/sv-call/submit.d.ts +21 -0
- package/dist/commands/sv-call/submit.d.ts.map +1 -0
- package/dist/commands/sv-call/submit.js +77 -0
- package/dist/commands/sv-call/submit.js.map +1 -0
- package/dist/commands/tele.d.ts +42 -0
- package/dist/commands/tele.d.ts.map +1 -0
- package/dist/commands/tele.js +559 -0
- package/dist/commands/tele.js.map +1 -0
- package/dist/commands/tokenize-spectrum.d.ts +58 -0
- package/dist/commands/tokenize-spectrum.d.ts.map +1 -0
- package/dist/commands/tokenize-spectrum.js +297 -0
- package/dist/commands/tokenize-spectrum.js.map +1 -0
- package/dist/commands/umount.d.ts.map +1 -1
- package/dist/commands/umount.js +42 -1
- package/dist/commands/umount.js.map +1 -1
- package/dist/commands/variants.d.ts +42 -0
- package/dist/commands/variants.d.ts.map +1 -0
- package/dist/commands/variants.js +237 -0
- package/dist/commands/variants.js.map +1 -0
- package/dist/commands/verkko/exec.d.ts +27 -0
- package/dist/commands/verkko/exec.d.ts.map +1 -0
- package/dist/commands/verkko/exec.js +223 -0
- package/dist/commands/verkko/exec.js.map +1 -0
- package/dist/commands/verkko/submit.d.ts +24 -0
- package/dist/commands/verkko/submit.d.ts.map +1 -0
- package/dist/commands/verkko/submit.js +96 -0
- package/dist/commands/verkko/submit.js.map +1 -0
- package/dist/commands/wavelet-consensus.d.ts +69 -0
- package/dist/commands/wavelet-consensus.d.ts.map +1 -0
- package/dist/commands/wavelet-consensus.js +338 -0
- package/dist/commands/wavelet-consensus.js.map +1 -0
- package/dist/commands/workspace.d.ts +59 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +419 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/commands/x402/index.d.ts +8 -0
- package/dist/commands/x402/index.d.ts.map +1 -1
- package/dist/commands/x402/index.js +100 -2
- package/dist/commands/x402/index.js.map +1 -1
- package/dist/commands/x402/pipeline-cancer-twin.d.ts +119 -0
- package/dist/commands/x402/pipeline-cancer-twin.d.ts.map +1 -0
- package/dist/commands/x402/pipeline-cancer-twin.js +326 -0
- package/dist/commands/x402/pipeline-cancer-twin.js.map +1 -0
- package/dist/commands/x402/submit.d.ts +72 -0
- package/dist/commands/x402/submit.d.ts.map +1 -0
- package/dist/commands/x402/submit.js +227 -0
- package/dist/commands/x402/submit.js.map +1 -0
- package/dist/commands/x402/verify-payment.d.ts +24 -0
- package/dist/commands/x402/verify-payment.d.ts.map +1 -0
- package/dist/commands/x402/verify-payment.js +113 -0
- package/dist/commands/x402/verify-payment.js.map +1 -0
- package/dist/index.js +2804 -196
- package/dist/index.js.map +1 -1
- package/dist/lib/api/client.d.ts +1 -0
- package/dist/lib/api/client.d.ts.map +1 -1
- package/dist/lib/api/client.js +22 -0
- package/dist/lib/api/client.js.map +1 -1
- package/dist/lib/api/fuse-client.d.ts +281 -0
- package/dist/lib/api/fuse-client.d.ts.map +1 -1
- package/dist/lib/api/fuse-client.js +428 -0
- package/dist/lib/api/fuse-client.js.map +1 -1
- package/dist/lib/biofiles/resolver.d.ts +1 -1
- package/dist/lib/biofiles/resolver.d.ts.map +1 -1
- package/dist/lib/biofiles/resolver.js +173 -138
- package/dist/lib/biofiles/resolver.js.map +1 -1
- package/dist/lib/config/constants.d.ts +1 -0
- package/dist/lib/config/constants.d.ts.map +1 -1
- package/dist/lib/config/constants.js +1 -0
- package/dist/lib/config/constants.js.map +1 -1
- package/dist/lib/config/paths.d.ts +6 -6
- package/dist/lib/config/paths.d.ts.map +1 -1
- package/dist/lib/config/paths.js +56 -17
- package/dist/lib/config/paths.js.map +1 -1
- package/dist/lib/gene-map.d.ts +24 -0
- package/dist/lib/gene-map.d.ts.map +1 -0
- package/dist/lib/gene-map.js +114 -0
- package/dist/lib/gene-map.js.map +1 -0
- package/dist/lib/htsget/client.d.ts +28 -5
- package/dist/lib/htsget/client.d.ts.map +1 -1
- package/dist/lib/htsget/client.js +96 -18
- package/dist/lib/htsget/client.js.map +1 -1
- package/dist/lib/sequentia/BioAgentRegistry.d.ts +98 -0
- package/dist/lib/sequentia/BioAgentRegistry.d.ts.map +1 -0
- package/dist/lib/sequentia/BioAgentRegistry.js +209 -0
- package/dist/lib/sequentia/BioAgentRegistry.js.map +1 -0
- package/dist/lib/tele/core.d.ts +71 -0
- package/dist/lib/tele/core.d.ts.map +1 -0
- package/dist/lib/tele/core.js +387 -0
- package/dist/lib/tele/core.js.map +1 -0
- package/dist/lib/x402/cancer-twin-agents.d.ts +65 -0
- package/dist/lib/x402/cancer-twin-agents.d.ts.map +1 -0
- package/dist/lib/x402/cancer-twin-agents.js +114 -0
- package/dist/lib/x402/cancer-twin-agents.js.map +1 -0
- package/dist/lib/x402/sequentia-pay.d.ts +51 -0
- package/dist/lib/x402/sequentia-pay.d.ts.map +1 -0
- package/dist/lib/x402/sequentia-pay.js +186 -0
- package/dist/lib/x402/sequentia-pay.js.map +1 -0
- package/dist/types/biofiles.d.ts +1 -1
- package/dist/types/biofiles.d.ts.map +1 -1
- package/dist/utils/errorReporter.d.ts +1 -0
- package/dist/utils/errorReporter.d.ts.map +1 -1
- package/dist/utils/errorReporter.js +39 -1
- package/dist/utils/errorReporter.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +20 -0
- package/dist/version.js.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* biofs benchmark <dataset.jsonl> — the ACMG evaluation harness.
|
|
4
|
+
*
|
|
5
|
+
* Tests the central scientific claim: does cross-vendor multi-agent debate
|
|
6
|
+
* reduce ACMG variant misclassification, relative to single-model and
|
|
7
|
+
* same-model-debate baselines? Three arms are run over a gold-standard set:
|
|
8
|
+
*
|
|
9
|
+
* single each model classifies alone (per-model accuracy)
|
|
10
|
+
* same-model one model debates itself for N rounds (final call)
|
|
11
|
+
* cross-vendor the panel debates, then a confidence-weighted consensus
|
|
12
|
+
*
|
|
13
|
+
* Every classification is written to the shared workspace as a signed,
|
|
14
|
+
* hash-chained turn, so the benchmark run is itself an auditable record.
|
|
15
|
+
* `--mock` exercises the full harness deterministically without spawning CLIs;
|
|
16
|
+
* live mode drives the subscription CLIs (claude -p / grok -p / gemini -p).
|
|
17
|
+
*
|
|
18
|
+
* The truth label is used ONLY for scoring; agents see gene/hgvs/protein only.
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
+
}) : function(o, v) {
|
|
34
|
+
o["default"] = v;
|
|
35
|
+
});
|
|
36
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
+
var ownKeys = function(o) {
|
|
38
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
+
var ar = [];
|
|
40
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
return ownKeys(o);
|
|
44
|
+
};
|
|
45
|
+
return function (mod) {
|
|
46
|
+
if (mod && mod.__esModule) return mod;
|
|
47
|
+
var result = {};
|
|
48
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.benchmarkCommand = benchmarkCommand;
|
|
58
|
+
exports.benchmarkPrepareCommand = benchmarkPrepareCommand;
|
|
59
|
+
const child_process_1 = require("child_process");
|
|
60
|
+
const fs = __importStar(require("fs"));
|
|
61
|
+
const path = __importStar(require("path"));
|
|
62
|
+
const os = __importStar(require("os"));
|
|
63
|
+
const readline = __importStar(require("readline"));
|
|
64
|
+
const zlib = __importStar(require("zlib"));
|
|
65
|
+
const crypto_1 = require("crypto");
|
|
66
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
67
|
+
const logger_1 = require("../lib/utils/logger");
|
|
68
|
+
const workspace_1 = require("./workspace");
|
|
69
|
+
const TIERS = ['P', 'LP', 'VUS', 'LB', 'B'];
|
|
70
|
+
const TIER_LABEL = { P: 'Pathogenic', LP: 'Likely pathogenic', VUS: 'VUS', LB: 'Likely benign', B: 'Benign' };
|
|
71
|
+
// Resolve via BIOFS_MCP_DIST or --mcp-dist; no machine-local absolute paths in the published package.
|
|
72
|
+
const DEFAULT_MCP_DIST = process.env.BIOFS_MCP_DIST || '';
|
|
73
|
+
// ---- classification normalization -----------------------------------------
|
|
74
|
+
function normTier(s) {
|
|
75
|
+
const t = String(s == null ? '' : s).toLowerCase().trim();
|
|
76
|
+
if (!t)
|
|
77
|
+
return null;
|
|
78
|
+
if (/benign/.test(t))
|
|
79
|
+
return /likely/.test(t) ? 'LB' : 'B';
|
|
80
|
+
if (/pathogenic/.test(t))
|
|
81
|
+
return /likely/.test(t) ? 'LP' : 'P';
|
|
82
|
+
if (/uncertain|^vus$|\bvus\b/.test(t))
|
|
83
|
+
return 'VUS';
|
|
84
|
+
const up = String(s).toUpperCase().trim();
|
|
85
|
+
return TIERS.includes(up) ? up : null;
|
|
86
|
+
}
|
|
87
|
+
function groupOf(c) {
|
|
88
|
+
if (c === 'P' || c === 'LP')
|
|
89
|
+
return 'PATH';
|
|
90
|
+
if (c === 'B' || c === 'LB')
|
|
91
|
+
return 'BENIGN';
|
|
92
|
+
if (c === 'VUS')
|
|
93
|
+
return 'VUS';
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const isActionable = (c) => c === 'P' || c === 'LP';
|
|
97
|
+
function buildModels(opts) {
|
|
98
|
+
return {
|
|
99
|
+
claude: {
|
|
100
|
+
key: 'claude', label: 'claude-code', modelId: 'claude-opus-4-8', bin: opts.claudeBin || 'claude',
|
|
101
|
+
args: (prompt, cfg) => ['-p', prompt, '--model', 'claude-opus-4-8', '--output-format', 'json', '--mcp-config', cfg, '--strict-mcp-config', '--allowedTools', 'mcp__biofs__*', '--permission-mode', 'acceptEdits'],
|
|
102
|
+
},
|
|
103
|
+
grok: {
|
|
104
|
+
key: 'grok', label: 'grok-build', modelId: 'grok-build', bin: opts.grokBin || 'grok',
|
|
105
|
+
args: (prompt) => ['-p', prompt, '-m', 'grok-build', '--output-format', 'json', '--always-approve', '--disallowed-tools', 'run_terminal_cmd,write_file,search_replace,create_file,delete_file,apply_patch,Agent'],
|
|
106
|
+
},
|
|
107
|
+
gemini: {
|
|
108
|
+
key: 'gemini', label: 'gemini-cli', modelId: opts.geminiModel || 'gemini-3-flash-preview', bin: opts.geminiBin || 'gemini',
|
|
109
|
+
args: (prompt) => ['-p', prompt, '-m', opts.geminiModel || 'gemini-3-flash-preview', '-o', 'json', '--approval-mode', 'yolo', '--allowed-mcp-server-names', 'biofs'],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function subscriptionEnv() {
|
|
114
|
+
const env = { ...process.env };
|
|
115
|
+
delete env.ANTHROPIC_API_KEY;
|
|
116
|
+
delete env.ANTHROPIC_AUTH_TOKEN;
|
|
117
|
+
delete env.XAI_API_KEY;
|
|
118
|
+
delete env.GROK_API_KEY;
|
|
119
|
+
return env;
|
|
120
|
+
}
|
|
121
|
+
function runCmd(bin, args, env, timeoutMs) {
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
const t0 = Date.now();
|
|
124
|
+
let stdout = '', stderr = '', done = false;
|
|
125
|
+
const child = (0, child_process_1.spawn)(bin, args, { env });
|
|
126
|
+
const finish = (r) => { if (done)
|
|
127
|
+
return; done = true; clearTimeout(timer); resolve(r); };
|
|
128
|
+
const timer = setTimeout(() => { try {
|
|
129
|
+
child.kill('SIGKILL');
|
|
130
|
+
}
|
|
131
|
+
catch { /* */ } finish({ code: 124, stdout, stderr: stderr + ' [timeout]', ms: Date.now() - t0 }); }, timeoutMs);
|
|
132
|
+
child.stdout.on('data', (d) => (stdout += d));
|
|
133
|
+
child.stderr.on('data', (d) => (stderr += d));
|
|
134
|
+
child.on('error', (e) => finish({ code: 127, stdout, stderr: stderr + String(e.message), ms: Date.now() - t0 }));
|
|
135
|
+
child.on('close', (code) => finish({ code: code ?? 0, stdout, stderr, ms: Date.now() - t0 }));
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function parseUsage(stdout) {
|
|
139
|
+
try {
|
|
140
|
+
const obj = JSON.parse((stdout || '').trim().split('\n').filter(Boolean).pop() || '{}');
|
|
141
|
+
const u = obj?.usage || obj?.usageMetadata || obj?.stats?.usage || {};
|
|
142
|
+
return { tokens_in: u.input_tokens ?? u.prompt_tokens ?? u.promptTokenCount ?? null, tokens_out: u.output_tokens ?? u.completion_tokens ?? u.candidatesTokenCount ?? null, cost_usd: obj?.total_cost_usd ?? null };
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function ensureClaudeCfg(nodeBase, mcpDist, biorouter) {
|
|
149
|
+
const dir = path.join(os.homedir(), '.biofs', 'duet');
|
|
150
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
151
|
+
const cfgPath = path.join(dir, 'claude.biofs.mcp.json');
|
|
152
|
+
fs.writeFileSync(cfgPath, JSON.stringify({ mcpServers: { biofs: { command: 'node', args: [mcpDist], env: { BIOFS_AGENT_ID: 'claude-code', BIOFS_NODE_BASE: nodeBase, BIOROUTER_URL: biorouter } } } }, null, 2));
|
|
153
|
+
return cfgPath;
|
|
154
|
+
}
|
|
155
|
+
// ---- deterministic mock ----------------------------------------------------
|
|
156
|
+
function det(s) { return parseInt((0, crypto_1.createHash)('sha256').update(s).digest('hex').slice(0, 8), 16); }
|
|
157
|
+
function mockCall(modelKey, v, errorRate) {
|
|
158
|
+
const h = det(`${v.variant_id}|${modelKey}`);
|
|
159
|
+
const errs = (h % 100) < errorRate;
|
|
160
|
+
if (!errs)
|
|
161
|
+
return { agent_id: modelKey, model: modelKey, tier: v.truth, raw: TIER_LABEL[v.truth], confidence: 0.82 + (h % 12) / 100 };
|
|
162
|
+
// deterministic plausible wrong neighbor
|
|
163
|
+
const order = ['P', 'LP', 'VUS', 'LB', 'B'];
|
|
164
|
+
const i = order.indexOf(v.truth);
|
|
165
|
+
const shift = (h % 2 === 0 ? 1 : -1) * (1 + (h % 2));
|
|
166
|
+
const wrong = order[Math.max(0, Math.min(order.length - 1, i + (i === 0 ? Math.abs(shift) : i === order.length - 1 ? -Math.abs(shift) : shift)))];
|
|
167
|
+
return { agent_id: modelKey, model: modelKey, tier: wrong, raw: TIER_LABEL[wrong], confidence: 0.5 + (h % 18) / 100 };
|
|
168
|
+
}
|
|
169
|
+
// ---- workspace helpers -----------------------------------------------------
|
|
170
|
+
async function emitClaim(caseId, agentId, modelId, v, tier, confidence, node) {
|
|
171
|
+
await (0, workspace_1.wsNode)('POST', '/workspace/append', { case_id: caseId, turn: { agent_id: agentId, model: { name: modelId, version: null }, role: 'classification', content: `${TIER_LABEL[tier]} for ${v.variant_id}`, claim: { subject: v.variant_id, classification: TIER_LABEL[tier], confidence, criteria: [] } } }, node);
|
|
172
|
+
}
|
|
173
|
+
async function readCallsForSubject(caseId, subject, node) {
|
|
174
|
+
const { data } = await (0, workspace_1.wsNode)('GET', `/workspace/consensus?case_id=${encodeURIComponent(caseId)}`, undefined, node);
|
|
175
|
+
const subj = (data?.subjects || []).find((s) => s.subject === subject);
|
|
176
|
+
if (!subj)
|
|
177
|
+
return [];
|
|
178
|
+
return (subj.calls || []).map((c) => ({ agent_id: c.agent_id, model: c.agent_id, tier: normTier(c.classification), raw: c.classification, confidence: typeof c.confidence === 'number' ? c.confidence : null }));
|
|
179
|
+
}
|
|
180
|
+
async function consensusCall(caseId, subject, node) {
|
|
181
|
+
const { data } = await (0, workspace_1.wsNode)('GET', `/workspace/consensus?case_id=${encodeURIComponent(caseId)}`, undefined, node);
|
|
182
|
+
const subj = (data?.subjects || []).find((s) => s.subject === subject);
|
|
183
|
+
const calls = subj ? (subj.calls || []).map((c) => ({ agent_id: c.agent_id, model: c.agent_id, tier: normTier(c.classification), raw: c.classification, confidence: typeof c.confidence === 'number' ? c.confidence : null })) : [];
|
|
184
|
+
return { tier: subj ? normTier(subj.consensus_call) : null, raw: subj ? subj.consensus_call : null, calls };
|
|
185
|
+
}
|
|
186
|
+
// ---- prompts ---------------------------------------------------------------
|
|
187
|
+
function classifyPrompt(v, agentLabel, debateNote) {
|
|
188
|
+
return [
|
|
189
|
+
`You are ${agentLabel}, classifying ONE germline variant under the ACMG/AMP 2015 guidelines (with ClinGen sequence-variant-interpretation refinements).`,
|
|
190
|
+
`Variant: gene ${v.gene}, ${v.hgvs}${v.protein ? ` (${v.protein})` : ''}.`,
|
|
191
|
+
debateNote || '',
|
|
192
|
+
`Use the biofs MCP. ${debateNote ? 'Call workspace_read first to see prior calls, then reconsider critically.' : ''} Call workspace_classify EXACTLY ONCE with: subject="${v.variant_id}", classification (one of Pathogenic, Likely pathogenic, VUS, Likely benign, Benign), the ACMG criteria you invoke, and a confidence between 0 and 1. Do not call any other tool. Then stop.`,
|
|
193
|
+
].filter(Boolean).join(' ');
|
|
194
|
+
}
|
|
195
|
+
function scoreArm(rows) {
|
|
196
|
+
const n = rows.length;
|
|
197
|
+
const c = (f) => rows.filter(f).length;
|
|
198
|
+
return {
|
|
199
|
+
n,
|
|
200
|
+
exact: n ? +(c((r) => r.exact) / n).toFixed(4) : null,
|
|
201
|
+
collapsed: n ? +(c((r) => r.collapsed) / n).toFixed(4) : null,
|
|
202
|
+
actionable: n ? +(c((r) => r.actionable) / n).toFixed(4) : null,
|
|
203
|
+
abstain: c((r) => r.final == null),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function mcnemar(aCorrect, bCorrect) {
|
|
207
|
+
let b = 0, cc = 0;
|
|
208
|
+
for (let i = 0; i < aCorrect.length; i++) {
|
|
209
|
+
if (aCorrect[i] && !bCorrect[i])
|
|
210
|
+
b++;
|
|
211
|
+
else if (!aCorrect[i] && bCorrect[i])
|
|
212
|
+
cc++;
|
|
213
|
+
}
|
|
214
|
+
const denom = b + cc;
|
|
215
|
+
const chi2 = denom > 0 ? Math.pow(Math.abs(b - cc) - 1, 2) / denom : 0;
|
|
216
|
+
// p-value approx from chi2 with 1 df (survival of chi-square)
|
|
217
|
+
const p = denom > 0 ? Math.exp(-chi2 / 2) : 1; // upper-tail approx for 1df (e^{-x/2})
|
|
218
|
+
return { b_only_a: b, c_only_b: cc, chi2: +chi2.toFixed(3), p_approx: +p.toFixed(4) };
|
|
219
|
+
}
|
|
220
|
+
// ===========================================================================
|
|
221
|
+
async function benchmarkCommand(datasetFile, options = {}) {
|
|
222
|
+
const nodeBase = (0, workspace_1.bioNodeBase)(options.node);
|
|
223
|
+
const biorouter = options.biorouter || process.env.BIOROUTER_URL || 'https://bioip.genobank.app';
|
|
224
|
+
const mcpDist = options.mcpDist || process.env.BIOFS_MCP_DIST || DEFAULT_MCP_DIST;
|
|
225
|
+
const order = (options.models || 'claude,grok,gemini').split(',').map((s) => s.trim()).filter(Boolean);
|
|
226
|
+
const arms = (options.arms || 'single,same-model,cross-vendor').split(',').map((s) => s.trim()).filter(Boolean);
|
|
227
|
+
const rounds = Math.max(1, Number(options.rounds) || 2);
|
|
228
|
+
const sameModelKey = options.sameModel || order[0] || 'claude';
|
|
229
|
+
const timeoutMs = Math.max(30, Number(options.timeout) || 300) * 1000;
|
|
230
|
+
const mockError = Math.max(0, Math.min(90, Number(options.mockError) || 22));
|
|
231
|
+
const MODELS = buildModels(options);
|
|
232
|
+
// load dataset
|
|
233
|
+
if (!fs.existsSync(datasetFile)) {
|
|
234
|
+
logger_1.Logger.error(`dataset not found: ${datasetFile}`);
|
|
235
|
+
process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
let variants = fs.readFileSync(datasetFile, 'utf8').split('\n').map((l) => l.trim()).filter(Boolean).map((l) => JSON.parse(l));
|
|
238
|
+
variants = variants.filter((v) => v.variant_id && v.hgvs && normTier(v.truth)).map((v) => ({ ...v, truth: normTier(v.truth) }));
|
|
239
|
+
if (options.limit)
|
|
240
|
+
variants = variants.slice(0, Number(options.limit));
|
|
241
|
+
if (!variants.length) {
|
|
242
|
+
logger_1.Logger.error('no usable variants in dataset');
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
// reachability
|
|
246
|
+
const probe = await (0, workspace_1.wsNode)('GET', '/workspace/read?case_id=__bench_preflight__&limit=1', undefined, options.node);
|
|
247
|
+
if (probe.status !== 200) {
|
|
248
|
+
logger_1.Logger.error(`biofs-node unreachable at ${nodeBase} (${probe.status})`);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
const runId = det(`${datasetFile}|${variants.length}|${Date.now()}`).toString(16);
|
|
252
|
+
const claudeCfg = ensureClaudeCfg(nodeBase, mcpDist, biorouter);
|
|
253
|
+
if (!options.json) {
|
|
254
|
+
console.log(chalk_1.default.bold(`biofs benchmark`) + chalk_1.default.gray(` ${variants.length} variants arms=[${arms.join(',')}] models=[${order.join(',')}] ${options.mock ? 'MOCK' : 'LIVE'} run=${runId}`));
|
|
255
|
+
console.log(chalk_1.default.gray(` node: ${nodeBase}`));
|
|
256
|
+
}
|
|
257
|
+
// produce one classification for a (model, variant) into a case (live or mock)
|
|
258
|
+
async function classifyInto(caseId, m, v, debateNote) {
|
|
259
|
+
if (options.mock) {
|
|
260
|
+
const mc = mockCall(m.key, v, mockError);
|
|
261
|
+
if (mc.tier)
|
|
262
|
+
await emitClaim(caseId, m.label, m.modelId, v, mc.tier, mc.confidence ?? 0.7, options.node);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const which = (0, child_process_1.spawnSync)('which', [m.bin], { encoding: 'utf8' });
|
|
266
|
+
if (which.status !== 0) {
|
|
267
|
+
logger_1.Logger.warn(`${m.bin} not found; skipping ${m.label}`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const prompt = classifyPrompt(v, m.label, debateNote);
|
|
271
|
+
await runCmd(m.bin, m.args(prompt, claudeCfg), subscriptionEnv(), timeoutMs);
|
|
272
|
+
}
|
|
273
|
+
const armResults = {};
|
|
274
|
+
for (const arm of arms) {
|
|
275
|
+
if (!options.json)
|
|
276
|
+
console.log(chalk_1.default.bold(`\n── arm: ${arm} ──`));
|
|
277
|
+
if (arm === 'single') {
|
|
278
|
+
const perModel = {};
|
|
279
|
+
for (const mk of order)
|
|
280
|
+
perModel[mk] = [];
|
|
281
|
+
for (let vi = 0; vi < variants.length; vi++) {
|
|
282
|
+
const v = variants[vi];
|
|
283
|
+
for (const mk of order) {
|
|
284
|
+
const m = MODELS[mk];
|
|
285
|
+
if (!m)
|
|
286
|
+
continue;
|
|
287
|
+
const caseId = `bench-${runId}-single-${mk}-${vi}`;
|
|
288
|
+
await (0, workspace_1.wsNode)('POST', '/workspace/open', { case_id: caseId, init: { title: `${arm}:${mk}:${v.variant_id}`, biocids: [] } }, options.node);
|
|
289
|
+
await classifyInto(caseId, m, v);
|
|
290
|
+
const calls = await readCallsForSubject(caseId, v.variant_id, options.node);
|
|
291
|
+
const mine = calls.find((c) => c.agent_id === m.label) || calls[0] || null;
|
|
292
|
+
const final = mine ? mine.tier : null;
|
|
293
|
+
perModel[mk].push({ variant_id: v.variant_id, truth: v.truth, final, exact: final === v.truth, collapsed: groupOf(final) === groupOf(v.truth), actionable: isActionable(final) === isActionable(v.truth), calls: mine ? [mine] : [] });
|
|
294
|
+
}
|
|
295
|
+
if (!options.json)
|
|
296
|
+
process.stdout.write(`\r classified ${vi + 1}/${variants.length} `);
|
|
297
|
+
}
|
|
298
|
+
if (!options.json)
|
|
299
|
+
process.stdout.write('\n');
|
|
300
|
+
// arm-level rows = best single model per variant is not "the arm"; single arm reports per-model.
|
|
301
|
+
armResults[arm] = { rows: [], perModel };
|
|
302
|
+
}
|
|
303
|
+
else if (arm === 'same-model') {
|
|
304
|
+
const m = MODELS[sameModelKey];
|
|
305
|
+
const rows = [];
|
|
306
|
+
if (m)
|
|
307
|
+
for (let vi = 0; vi < variants.length; vi++) {
|
|
308
|
+
const v = variants[vi];
|
|
309
|
+
const caseId = `bench-${runId}-same-${sameModelKey}-${vi}`;
|
|
310
|
+
await (0, workspace_1.wsNode)('POST', '/workspace/open', { case_id: caseId, init: { title: `${arm}:${v.variant_id}` } }, options.node);
|
|
311
|
+
for (let r = 1; r <= rounds; r++) {
|
|
312
|
+
await classifyInto(caseId, m, v, r > 1 ? `This is debate round ${r} of ${rounds}; you previously classified this variant.` : undefined);
|
|
313
|
+
}
|
|
314
|
+
const calls = await readCallsForSubject(caseId, v.variant_id, options.node);
|
|
315
|
+
const mine = calls.find((c) => c.agent_id === m.label) || calls[0] || null;
|
|
316
|
+
const final = mine ? mine.tier : null;
|
|
317
|
+
rows.push({ variant_id: v.variant_id, truth: v.truth, final, exact: final === v.truth, collapsed: groupOf(final) === groupOf(v.truth), actionable: isActionable(final) === isActionable(v.truth), calls: mine ? [mine] : [] });
|
|
318
|
+
if (!options.json)
|
|
319
|
+
process.stdout.write(`\r classified ${vi + 1}/${variants.length} `);
|
|
320
|
+
}
|
|
321
|
+
if (!options.json)
|
|
322
|
+
process.stdout.write('\n');
|
|
323
|
+
armResults[arm] = { rows };
|
|
324
|
+
}
|
|
325
|
+
else if (arm === 'cross-vendor') {
|
|
326
|
+
const rows = [];
|
|
327
|
+
for (let vi = 0; vi < variants.length; vi++) {
|
|
328
|
+
const v = variants[vi];
|
|
329
|
+
const caseId = `bench-${runId}-cross-${vi}`;
|
|
330
|
+
await (0, workspace_1.wsNode)('POST', '/workspace/open', { case_id: caseId, init: { title: `${arm}:${v.variant_id}` } }, options.node);
|
|
331
|
+
for (let r = 1; r <= rounds; r++) {
|
|
332
|
+
for (const mk of order) {
|
|
333
|
+
const m = MODELS[mk];
|
|
334
|
+
if (!m)
|
|
335
|
+
continue;
|
|
336
|
+
await classifyInto(caseId, m, v, r > 1 ? `Debate round ${r}; another AI may have classified this. Reconsider in light of the others.` : undefined);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const cons = await consensusCall(caseId, v.variant_id, options.node);
|
|
340
|
+
const final = cons.tier;
|
|
341
|
+
rows.push({ variant_id: v.variant_id, truth: v.truth, final, exact: final === v.truth, collapsed: groupOf(final) === groupOf(v.truth), actionable: isActionable(final) === isActionable(v.truth), calls: cons.calls });
|
|
342
|
+
if (!options.json)
|
|
343
|
+
process.stdout.write(`\r classified ${vi + 1}/${variants.length} `);
|
|
344
|
+
}
|
|
345
|
+
if (!options.json)
|
|
346
|
+
process.stdout.write('\n');
|
|
347
|
+
armResults[arm] = { rows };
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
logger_1.Logger.warn(`unknown arm "${arm}" (use single,same-model,cross-vendor)`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// ---- analysis ----
|
|
354
|
+
const summary = { dataset: datasetFile, n_variants: variants.length, run_id: runId, mock: !!options.mock, models: order, arms: {} };
|
|
355
|
+
// per-model (single)
|
|
356
|
+
if (armResults['single']?.perModel) {
|
|
357
|
+
summary.arms['single'] = { per_model: {} };
|
|
358
|
+
for (const mk of order)
|
|
359
|
+
summary.arms['single'].per_model[mk] = scoreArm(armResults['single'].perModel[mk]);
|
|
360
|
+
// best single by collapsed accuracy
|
|
361
|
+
let best = null, bestAcc = -1;
|
|
362
|
+
for (const mk of order) {
|
|
363
|
+
const a = summary.arms['single'].per_model[mk].collapsed ?? -1;
|
|
364
|
+
if (a > bestAcc) {
|
|
365
|
+
bestAcc = a;
|
|
366
|
+
best = mk;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
summary.arms['single'].best_model = best;
|
|
370
|
+
}
|
|
371
|
+
if (armResults['same-model'])
|
|
372
|
+
summary.arms['same-model'] = { model: sameModelKey, rounds, ...scoreArm(armResults['same-model'].rows) };
|
|
373
|
+
if (armResults['cross-vendor'])
|
|
374
|
+
summary.arms['cross-vendor'] = { rounds, ...scoreArm(armResults['cross-vendor'].rows) };
|
|
375
|
+
// comparison: cross-vendor vs best single
|
|
376
|
+
if (armResults['cross-vendor'] && armResults['single']?.perModel && summary.arms['single'].best_model) {
|
|
377
|
+
const cv = armResults['cross-vendor'].rows;
|
|
378
|
+
const bs = armResults['single'].perModel[summary.arms['single'].best_model];
|
|
379
|
+
const byId = (rows) => Object.fromEntries(rows.map((r) => [r.variant_id, r]));
|
|
380
|
+
const cvm = byId(cv), bsm = byId(bs);
|
|
381
|
+
let rescued = 0, harmed = 0;
|
|
382
|
+
const aCorrect = [], bCorrect = [];
|
|
383
|
+
for (const v of variants) {
|
|
384
|
+
const cr = cvm[v.variant_id], br = bsm[v.variant_id];
|
|
385
|
+
if (!cr || !br)
|
|
386
|
+
continue;
|
|
387
|
+
aCorrect.push(br.collapsed);
|
|
388
|
+
bCorrect.push(cr.collapsed);
|
|
389
|
+
if (!br.collapsed && cr.collapsed)
|
|
390
|
+
rescued++;
|
|
391
|
+
if (br.collapsed && !cr.collapsed)
|
|
392
|
+
harmed++;
|
|
393
|
+
}
|
|
394
|
+
summary.comparison = { cross_vs_best_single: summary.arms['single'].best_model, rescued_by_debate: rescued, broken_by_debate: harmed, net_errors_caught: rescued - harmed, mcnemar: mcnemar(aCorrect, bCorrect) };
|
|
395
|
+
}
|
|
396
|
+
// calibration (cross-vendor per-agent calls)
|
|
397
|
+
if (armResults['cross-vendor']) {
|
|
398
|
+
const bins = [[0, 0.5], [0.5, 0.7], [0.7, 0.9], [0.9, 1.01]];
|
|
399
|
+
const cal = bins.map(([lo, hi]) => {
|
|
400
|
+
let n = 0, correct = 0;
|
|
401
|
+
for (const r of armResults['cross-vendor'].rows)
|
|
402
|
+
for (const c of (r.calls || [])) {
|
|
403
|
+
if (c.confidence == null || c.tier == null)
|
|
404
|
+
continue;
|
|
405
|
+
if (c.confidence >= lo && c.confidence < hi) {
|
|
406
|
+
n++;
|
|
407
|
+
if (groupOf(c.tier) === groupOf(r.truth))
|
|
408
|
+
correct++;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return { range: `${lo}-${hi >= 1 ? 1 : hi}`, n, accuracy: n ? +(correct / n).toFixed(3) : null };
|
|
412
|
+
});
|
|
413
|
+
summary.calibration = cal;
|
|
414
|
+
}
|
|
415
|
+
// ---- output ----
|
|
416
|
+
const outDir = options.out || path.join('bench', `results-${runId}`);
|
|
417
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
418
|
+
const full = { summary, per_variant: { single: armResults['single']?.perModel, 'same-model': armResults['same-model']?.rows, 'cross-vendor': armResults['cross-vendor']?.rows } };
|
|
419
|
+
fs.writeFileSync(path.join(outDir, 'results.json'), JSON.stringify(full, null, 2));
|
|
420
|
+
fs.writeFileSync(path.join(outDir, 'report.md'), renderReport(summary));
|
|
421
|
+
if (options.json) {
|
|
422
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
console.log('\n' + renderReport(summary));
|
|
426
|
+
console.log(chalk_1.default.gray(`\nresults: ${path.join(outDir, 'results.json')} | report: ${path.join(outDir, 'report.md')}`));
|
|
427
|
+
}
|
|
428
|
+
function pct(x) { return x == null ? 'n/a' : (x * 100).toFixed(1) + '%'; }
|
|
429
|
+
function renderReport(s) {
|
|
430
|
+
const L = [];
|
|
431
|
+
L.push(`# BioFS benchmark report`);
|
|
432
|
+
L.push(``);
|
|
433
|
+
L.push(`Dataset: \`${s.dataset}\` · ${s.n_variants} variants · ${s.mock ? 'MOCK (deterministic, harness validation)' : 'LIVE (subscription CLIs)'} · run \`${s.run_id}\``);
|
|
434
|
+
L.push(``);
|
|
435
|
+
L.push(`## Accuracy by arm`);
|
|
436
|
+
L.push(``);
|
|
437
|
+
L.push(`| Arm | n | Exact (5-tier) | Collapsed (path/VUS/benign) | Actionable (P/LP vs not) |`);
|
|
438
|
+
L.push(`|---|---|---|---|---|`);
|
|
439
|
+
if (s.arms.single?.per_model) {
|
|
440
|
+
for (const mk of Object.keys(s.arms.single.per_model)) {
|
|
441
|
+
const a = s.arms.single.per_model[mk];
|
|
442
|
+
L.push(`| single: ${mk}${s.arms.single.best_model === mk ? ' (best)' : ''} | ${a.n} | ${pct(a.exact)} | ${pct(a.collapsed)} | ${pct(a.actionable)} |`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (s.arms['same-model']) {
|
|
446
|
+
const a = s.arms['same-model'];
|
|
447
|
+
L.push(`| same-model: ${a.model} ×${a.rounds} | ${a.n} | ${pct(a.exact)} | ${pct(a.collapsed)} | ${pct(a.actionable)} |`);
|
|
448
|
+
}
|
|
449
|
+
if (s.arms['cross-vendor']) {
|
|
450
|
+
const a = s.arms['cross-vendor'];
|
|
451
|
+
L.push(`| cross-vendor ×${a.rounds} | ${a.n} | ${pct(a.exact)} | ${pct(a.collapsed)} | ${pct(a.actionable)} |`);
|
|
452
|
+
}
|
|
453
|
+
L.push(``);
|
|
454
|
+
if (s.comparison) {
|
|
455
|
+
const c = s.comparison;
|
|
456
|
+
L.push(`## Cross-vendor vs best single (${c.cross_vs_best_single})`);
|
|
457
|
+
L.push(``);
|
|
458
|
+
L.push(`- Errors the debate **rescued** (best single wrong, cross-vendor right): **${c.rescued_by_debate}**`);
|
|
459
|
+
L.push(`- Errors the debate **introduced** (best single right, cross-vendor wrong): **${c.broken_by_debate}**`);
|
|
460
|
+
L.push(`- **Net errors caught: ${c.net_errors_caught}**`);
|
|
461
|
+
L.push(`- McNemar (paired): chi-square ${c.mcnemar.chi2}, p approx ${c.mcnemar.p_approx} (discordant b=${c.mcnemar.b_only_a}, c=${c.mcnemar.c_only_b})`);
|
|
462
|
+
L.push(``);
|
|
463
|
+
}
|
|
464
|
+
if (s.calibration) {
|
|
465
|
+
L.push(`## Confidence calibration (cross-vendor agent calls)`);
|
|
466
|
+
L.push(``);
|
|
467
|
+
L.push(`| Confidence | n | Collapsed accuracy |`);
|
|
468
|
+
L.push(`|---|---|---|`);
|
|
469
|
+
for (const b of s.calibration)
|
|
470
|
+
L.push(`| ${b.range} | ${b.n} | ${pct(b.accuracy)} |`);
|
|
471
|
+
L.push(``);
|
|
472
|
+
}
|
|
473
|
+
L.push(`Every classification is a signed, hash-chained turn; export any case with \`biofs ws export\` and re-verify with \`biofs ws verify\`.`);
|
|
474
|
+
return L.join('\n');
|
|
475
|
+
}
|
|
476
|
+
function clinvarStars(reviewStatus) {
|
|
477
|
+
const r = String(reviewStatus || '').toLowerCase();
|
|
478
|
+
if (r.includes('practice guideline'))
|
|
479
|
+
return 4;
|
|
480
|
+
if (r.includes('expert panel'))
|
|
481
|
+
return 3;
|
|
482
|
+
if (r.includes('multiple submitters') && r.includes('no conflict'))
|
|
483
|
+
return 2;
|
|
484
|
+
if (r.includes('conflict'))
|
|
485
|
+
return 1;
|
|
486
|
+
if (r.includes('single submitter'))
|
|
487
|
+
return 1;
|
|
488
|
+
return 0;
|
|
489
|
+
}
|
|
490
|
+
function clinvarTier(sig) {
|
|
491
|
+
const s = String(sig || '').toLowerCase().trim();
|
|
492
|
+
if (!s || s.includes('conflict'))
|
|
493
|
+
return null;
|
|
494
|
+
if (s.startsWith('pathogenic/likely pathogenic'))
|
|
495
|
+
return 'LP';
|
|
496
|
+
if (s.startsWith('likely pathogenic'))
|
|
497
|
+
return 'LP';
|
|
498
|
+
if (s.startsWith('pathogenic'))
|
|
499
|
+
return 'P';
|
|
500
|
+
if (s.startsWith('benign/likely benign'))
|
|
501
|
+
return 'LB';
|
|
502
|
+
if (s.startsWith('likely benign'))
|
|
503
|
+
return 'LB';
|
|
504
|
+
if (s.startsWith('benign'))
|
|
505
|
+
return 'B';
|
|
506
|
+
if (s.startsWith('uncertain significance'))
|
|
507
|
+
return 'VUS';
|
|
508
|
+
return null; // drug response, risk factor, association, protective, other, not provided
|
|
509
|
+
}
|
|
510
|
+
function parseClinvarName(name) {
|
|
511
|
+
// e.g. "NM_007294.4(BRCA1):c.68_69del (p.Glu23ValfsTer17)"
|
|
512
|
+
const m = String(name || '').match(/^([NXM_0-9.]+)\(([^)]+)\):(c\.[^ ]+)(?:\s*\(([^)]+)\))?/);
|
|
513
|
+
if (!m)
|
|
514
|
+
return null;
|
|
515
|
+
return { transcript: m[1].trim(), gene: m[2].trim(), cpart: m[3].trim(), protein: (m[4] || '').trim() };
|
|
516
|
+
}
|
|
517
|
+
async function benchmarkPrepareCommand(clinvarFile, options = {}) {
|
|
518
|
+
if (!fs.existsSync(clinvarFile)) {
|
|
519
|
+
logger_1.Logger.error(`file not found: ${clinvarFile}`);
|
|
520
|
+
process.exit(1);
|
|
521
|
+
}
|
|
522
|
+
const minStars = Math.max(0, Number(options.minStars) || 2);
|
|
523
|
+
const perTier = Math.max(1, Number(options.perTier) || 100);
|
|
524
|
+
const maxTotal = options.max ? Number(options.max) : Infinity;
|
|
525
|
+
const assembly = (options.assembly || 'GRCh38').toUpperCase();
|
|
526
|
+
const tierFilter = options.tiers ? new Set(options.tiers.split(',').map((s) => s.trim().toUpperCase())) : null;
|
|
527
|
+
const geneFilter = options.genes ? new Set(options.genes.split(',').map((s) => s.trim().toUpperCase())) : null;
|
|
528
|
+
const outFile = options.out || path.join('bench', 'clinvar.jsonl');
|
|
529
|
+
let stream = fs.createReadStream(clinvarFile);
|
|
530
|
+
if (/\.gz$/i.test(clinvarFile))
|
|
531
|
+
stream = stream.pipe(zlib.createGunzip());
|
|
532
|
+
const rl = readline.createInterface({ input: stream, crlfDelay: Infinity });
|
|
533
|
+
let header = null;
|
|
534
|
+
const idx = {};
|
|
535
|
+
const reservoir = { P: [], LP: [], VUS: [], LB: [], B: [] };
|
|
536
|
+
const seen = { P: 0, LP: 0, VUS: 0, LB: 0, B: 0 };
|
|
537
|
+
const dedup = new Set();
|
|
538
|
+
let scanned = 0;
|
|
539
|
+
for await (const line of rl) {
|
|
540
|
+
if (!line)
|
|
541
|
+
continue;
|
|
542
|
+
if (header === null) {
|
|
543
|
+
header = line.replace(/^#/, '').split('\t');
|
|
544
|
+
header.forEach((h, i) => { idx[h.trim()] = i; });
|
|
545
|
+
for (const need of ['Name', 'GeneSymbol', 'ClinicalSignificance', 'ReviewStatus']) {
|
|
546
|
+
if (!(need in idx)) {
|
|
547
|
+
logger_1.Logger.error(`ClinVar header missing column "${need}" (is this variant_summary.txt?)`);
|
|
548
|
+
process.exit(1);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
scanned++;
|
|
554
|
+
const cols = line.split('\t');
|
|
555
|
+
const asm = (cols[idx['Assembly']] || '').toUpperCase();
|
|
556
|
+
if (idx['Assembly'] !== undefined && asm && asm !== assembly)
|
|
557
|
+
continue;
|
|
558
|
+
if (clinvarStars(cols[idx['ReviewStatus']]) < minStars)
|
|
559
|
+
continue;
|
|
560
|
+
const tier = clinvarTier(cols[idx['ClinicalSignificance']]);
|
|
561
|
+
if (!tier)
|
|
562
|
+
continue;
|
|
563
|
+
if (tierFilter && !tierFilter.has(tier))
|
|
564
|
+
continue;
|
|
565
|
+
const parsed = parseClinvarName(cols[idx['Name']]);
|
|
566
|
+
if (!parsed)
|
|
567
|
+
continue;
|
|
568
|
+
const gene = (cols[idx['GeneSymbol']] || parsed.gene).trim();
|
|
569
|
+
if (!gene || gene === '-')
|
|
570
|
+
continue;
|
|
571
|
+
if (geneFilter && !geneFilter.has(gene.toUpperCase()))
|
|
572
|
+
continue;
|
|
573
|
+
const variant_id = `${gene}_${parsed.cpart.replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
574
|
+
if (dedup.has(variant_id))
|
|
575
|
+
continue;
|
|
576
|
+
dedup.add(variant_id);
|
|
577
|
+
const rec = { variant_id, gene, hgvs: `${parsed.transcript}:${parsed.cpart}`, protein: parsed.protein, truth: tier, note: `ClinVar ${cols[idx['ClinicalSignificance']]} (${cols[idx['ReviewStatus']]})` };
|
|
578
|
+
// deterministic reservoir sample per tier
|
|
579
|
+
seen[tier]++;
|
|
580
|
+
if (reservoir[tier].length < perTier)
|
|
581
|
+
reservoir[tier].push(rec);
|
|
582
|
+
else {
|
|
583
|
+
const j = det(`${variant_id}|${seen[tier]}`) % seen[tier];
|
|
584
|
+
if (j < perTier)
|
|
585
|
+
reservoir[tier][j] = rec;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
let out = [];
|
|
589
|
+
for (const t of TIERS)
|
|
590
|
+
out = out.concat(reservoir[t]);
|
|
591
|
+
if (out.length > maxTotal)
|
|
592
|
+
out = out.slice(0, maxTotal);
|
|
593
|
+
fs.mkdirSync(path.dirname(outFile), { recursive: true });
|
|
594
|
+
fs.writeFileSync(outFile, out.map((r) => JSON.stringify(r)).join('\n') + '\n');
|
|
595
|
+
const counts = {};
|
|
596
|
+
for (const r of out)
|
|
597
|
+
counts[r.truth] = (counts[r.truth] || 0) + 1;
|
|
598
|
+
const result = { input: clinvarFile, scanned, min_stars: minStars, assembly, per_tier: perTier, written: out.length, by_tier: counts, out: outFile };
|
|
599
|
+
if (options.json) {
|
|
600
|
+
console.log(JSON.stringify(result, null, 2));
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
console.log(chalk_1.default.bold('benchmark-prepare') + chalk_1.default.gray(` scanned ${scanned} rows ≥${minStars}★ ${assembly}`));
|
|
604
|
+
console.log(chalk_1.default.green(` wrote ${out.length} variants`) + chalk_1.default.gray(` to ${outFile}`));
|
|
605
|
+
console.log(chalk_1.default.gray(' by tier: ' + TIERS.map((t) => `${t}=${counts[t] || 0}`).join(' ')));
|
|
606
|
+
console.log(chalk_1.default.gray(` run: biofs benchmark ${outFile} --models claude,grok,gemini`));
|
|
607
|
+
}
|
|
608
|
+
//# sourceMappingURL=benchmark.js.map
|