@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,713 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* biofs fourier-score <variants>
|
|
4
|
+
*
|
|
5
|
+
* Compute the Cosic-RRM Discrete Fourier Transform of EIIP-encoded protein
|
|
6
|
+
* windows for one or more missense variants, returning the |ΔF| spectrum
|
|
7
|
+
* between wildtype and mutant sequence as a biophysical signal that complements
|
|
8
|
+
* REVEL / AlphaMissense / PrimateAI-3D.
|
|
9
|
+
*
|
|
10
|
+
* Pipeline:
|
|
11
|
+
* 1. Parse HGVS protein-level descriptors (e.g. ITGA2B:p.Val779Ala).
|
|
12
|
+
* 2. Fetch (and cache) the gene's canonical UniProt sequence.
|
|
13
|
+
* 3. Extract a sliding window of N residues centered on the mutation site.
|
|
14
|
+
* N defaults to 31 for the integrin headpiece, 51 for transmembrane
|
|
15
|
+
* regions (TM dominated by ~3.6-residue helical pitch).
|
|
16
|
+
* 4. Map residues to Electron-Ion Interaction Potential (Cosic 1994 Rydberg
|
|
17
|
+
* values). Out-of-range residues use 0.
|
|
18
|
+
* 5. Run rfft via numpy; magnitude spectrum on WT and MT; ΔF = | |X_WT| - |X_MT| |.
|
|
19
|
+
* Truncate to N/2+1 bins (one-sided real spectrum).
|
|
20
|
+
* 6. Output: ΔF vector, Σ|ΔF|, max-bin index, max |ΔF|, k=0 magnitude delta.
|
|
21
|
+
*
|
|
22
|
+
* Future (Sprint 2): characteristic-frequency f_c from ortholog consensus
|
|
23
|
+
* spectrum, E(f_c)_MT / E(f_c)_WT ratio, plot to PNG.
|
|
24
|
+
*/
|
|
25
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperty(o, k2, desc);
|
|
32
|
+
}) : (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
o[k2] = m[k];
|
|
35
|
+
}));
|
|
36
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
37
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
38
|
+
}) : function(o, v) {
|
|
39
|
+
o["default"] = v;
|
|
40
|
+
});
|
|
41
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
42
|
+
var ownKeys = function(o) {
|
|
43
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
44
|
+
var ar = [];
|
|
45
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
46
|
+
return ar;
|
|
47
|
+
};
|
|
48
|
+
return ownKeys(o);
|
|
49
|
+
};
|
|
50
|
+
return function (mod) {
|
|
51
|
+
if (mod && mod.__esModule) return mod;
|
|
52
|
+
var result = {};
|
|
53
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
54
|
+
__setModuleDefault(result, mod);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
})();
|
|
58
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.fourierScoreCommand = fourierScoreCommand;
|
|
63
|
+
const child_process_1 = require("child_process");
|
|
64
|
+
const fs = __importStar(require("fs"));
|
|
65
|
+
const path = __importStar(require("path"));
|
|
66
|
+
const os = __importStar(require("os"));
|
|
67
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
68
|
+
const UNIPROT_CACHE_DIR = path.join(os.homedir(), '.biofs', 'cache', 'uniprot');
|
|
69
|
+
// Electron-Ion Interaction Potential (Rydberg, Cosic 1994)
|
|
70
|
+
const EIIP = {
|
|
71
|
+
A: 0.0373, R: 0.0959, N: 0.0036, D: 0.1263, C: 0.0829,
|
|
72
|
+
E: 0.0058, Q: 0.0761, G: 0.0050, H: 0.0242, I: 0.0000,
|
|
73
|
+
L: 0.0000, K: 0.0371, M: 0.0823, F: 0.0946, P: 0.0198,
|
|
74
|
+
S: 0.0829, T: 0.0941, W: 0.0548, Y: 0.0516, V: 0.0057,
|
|
75
|
+
};
|
|
76
|
+
const AA_3_TO_1 = {
|
|
77
|
+
Ala: 'A', Arg: 'R', Asn: 'N', Asp: 'D', Cys: 'C',
|
|
78
|
+
Glu: 'E', Gln: 'Q', Gly: 'G', His: 'H', Ile: 'I',
|
|
79
|
+
Leu: 'L', Lys: 'K', Met: 'M', Phe: 'F', Pro: 'P',
|
|
80
|
+
Ser: 'S', Thr: 'T', Trp: 'W', Tyr: 'Y', Val: 'V',
|
|
81
|
+
Ter: '*', Stop: '*',
|
|
82
|
+
};
|
|
83
|
+
// Canonical UniProt accessions for genes we support out-of-the-box
|
|
84
|
+
const gene_map_1 = require("../lib/gene-map");
|
|
85
|
+
// UniProt-feature TM regions for known genes (inclusive 1-based residue ranges).
|
|
86
|
+
// Variants inside these ranges get the wider N=51 window by default.
|
|
87
|
+
const TM_REGIONS = {
|
|
88
|
+
ITGA2B: [988, 1009],
|
|
89
|
+
ITGB3: [716, 738],
|
|
90
|
+
// Tetraspanin-6 has four TM helices (UniProt O43657 feature lines)
|
|
91
|
+
TSPAN6: [12, 32], // TM1 (we annotate the first; runtime widening for any in the protein)
|
|
92
|
+
// COL27A1 is secreted, no TM
|
|
93
|
+
// NRCAM single-pass TM
|
|
94
|
+
NRCAM: [1117, 1137],
|
|
95
|
+
// PGAP1 is an ER-membrane multipass
|
|
96
|
+
PGAP1: [11, 31],
|
|
97
|
+
};
|
|
98
|
+
function parseHgvs(s, fallbackUniprot) {
|
|
99
|
+
// Accept any of:
|
|
100
|
+
// ITGA2B:p.Val779Ala
|
|
101
|
+
// ITGA2B p.Val779Ala
|
|
102
|
+
// ITGA2B:Val779Ala
|
|
103
|
+
// p.Val779Ala (gene from --uniprot)
|
|
104
|
+
const m = s.match(/^(?:([A-Za-z][A-Za-z0-9-]*)[:\s]+)?(?:p\.)?([A-Z][a-z]{2})(\d+)([A-Z][a-z]{2})$/);
|
|
105
|
+
if (!m)
|
|
106
|
+
throw new Error(`Cannot parse "${s}". Use ITGA2B:p.Val779Ala`);
|
|
107
|
+
const [, geneRaw, ref3, posStr, alt3] = m;
|
|
108
|
+
const ref = AA_3_TO_1[ref3];
|
|
109
|
+
const alt = AA_3_TO_1[alt3];
|
|
110
|
+
if (!ref || !alt)
|
|
111
|
+
throw new Error(`Unknown amino acid 3-letter code in "${s}"`);
|
|
112
|
+
const gene = geneRaw ? geneRaw.toUpperCase() : null;
|
|
113
|
+
let uniprot = null;
|
|
114
|
+
if (gene && gene_map_1.GENE_TO_UNIPROT[gene])
|
|
115
|
+
uniprot = gene_map_1.GENE_TO_UNIPROT[gene];
|
|
116
|
+
else if (fallbackUniprot)
|
|
117
|
+
uniprot = fallbackUniprot;
|
|
118
|
+
return { gene, uniprot, pos: parseInt(posStr, 10), ref, alt, original: s };
|
|
119
|
+
}
|
|
120
|
+
function fetchUniprotFasta(uniprot) {
|
|
121
|
+
fs.mkdirSync(UNIPROT_CACHE_DIR, { recursive: true });
|
|
122
|
+
const cachePath = path.join(UNIPROT_CACHE_DIR, `${uniprot}.fasta`);
|
|
123
|
+
if (fs.existsSync(cachePath)) {
|
|
124
|
+
return fs.readFileSync(cachePath, 'utf8');
|
|
125
|
+
}
|
|
126
|
+
const r = (0, child_process_1.spawnSync)('curl', ['-fsSL', `https://rest.uniprot.org/uniprotkb/${uniprot}.fasta`], { encoding: 'utf8' });
|
|
127
|
+
if (r.status !== 0 || !r.stdout.startsWith('>')) {
|
|
128
|
+
throw new Error(`UniProt FASTA fetch failed for ${uniprot}: ${r.stderr || 'no output'}`);
|
|
129
|
+
}
|
|
130
|
+
fs.writeFileSync(cachePath, r.stdout);
|
|
131
|
+
return r.stdout;
|
|
132
|
+
}
|
|
133
|
+
function fastaSequence(fasta) {
|
|
134
|
+
return fasta.split('\n').slice(1).join('').replace(/\s/g, '').toUpperCase();
|
|
135
|
+
}
|
|
136
|
+
function extractWindow(seq, center1, N) {
|
|
137
|
+
const flank = Math.floor(N / 2);
|
|
138
|
+
const start = center1 - 1 - flank;
|
|
139
|
+
const end = center1 - 1 + flank + 1;
|
|
140
|
+
let w = '';
|
|
141
|
+
for (let i = start; i < end; i++) {
|
|
142
|
+
w += i >= 0 && i < seq.length ? seq[i] : 'X';
|
|
143
|
+
}
|
|
144
|
+
return w;
|
|
145
|
+
}
|
|
146
|
+
function toEIIPVector(window) {
|
|
147
|
+
return Array.from(window).map(aa => EIIP[aa] ?? 0);
|
|
148
|
+
}
|
|
149
|
+
function computeFft(wtVec, mtVec) {
|
|
150
|
+
const py = `
|
|
151
|
+
import json, sys, numpy as np
|
|
152
|
+
d = json.loads(sys.stdin.read())
|
|
153
|
+
wt = np.array(d["wt"], dtype=float)
|
|
154
|
+
mt = np.array(d["mt"], dtype=float)
|
|
155
|
+
wt_dt = wt - wt.mean()
|
|
156
|
+
mt_dt = mt - mt.mean()
|
|
157
|
+
Xw = np.abs(np.fft.rfft(wt))
|
|
158
|
+
Xm = np.abs(np.fft.rfft(mt))
|
|
159
|
+
delta = np.abs(Xw - Xm)
|
|
160
|
+
Xw_dt = np.abs(np.fft.rfft(wt_dt))
|
|
161
|
+
Xm_dt = np.abs(np.fft.rfft(mt_dt))
|
|
162
|
+
delta_dt = np.abs(Xw_dt - Xm_dt)
|
|
163
|
+
energy_wt = float((Xw ** 2).sum())
|
|
164
|
+
energy_mt = float((Xm ** 2).sum())
|
|
165
|
+
no_dc = delta[1:] if len(delta) > 1 else delta
|
|
166
|
+
out = {
|
|
167
|
+
"wtMag": Xw.tolist(),
|
|
168
|
+
"mtMag": Xm.tolist(),
|
|
169
|
+
"deltaMag": delta.tolist(),
|
|
170
|
+
"deltaMagDetrended": delta_dt.tolist(),
|
|
171
|
+
"sumAbsDelta": float(delta.sum()),
|
|
172
|
+
"sumAbsDeltaNoDc": float(no_dc.sum()),
|
|
173
|
+
"sumAbsDeltaDetrended": float(delta_dt.sum()),
|
|
174
|
+
"maxAbsDelta": float(delta.max()),
|
|
175
|
+
"maxAbsDeltaBin": int(np.argmax(delta)),
|
|
176
|
+
"maxAbsDeltaNoDc": float(no_dc.max()) if len(no_dc) > 0 else 0.0,
|
|
177
|
+
"maxAbsDeltaBinNoDc": int(np.argmax(no_dc) + 1) if len(no_dc) > 0 else 0,
|
|
178
|
+
"k0Delta": float(delta[0]),
|
|
179
|
+
"energyChangeRatio": float((energy_mt - energy_wt) / energy_wt) if energy_wt > 0 else 0.0,
|
|
180
|
+
}
|
|
181
|
+
print(json.dumps(out))
|
|
182
|
+
`;
|
|
183
|
+
const result = (0, child_process_1.spawnSync)('python3', ['-c', py], {
|
|
184
|
+
encoding: 'utf8',
|
|
185
|
+
input: JSON.stringify({ wt: wtVec, mt: mtVec }),
|
|
186
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
187
|
+
});
|
|
188
|
+
if (result.status !== 0) {
|
|
189
|
+
throw new Error(`numpy FFT failed: ${result.stderr || result.stdout}\n(install: python3 -m pip install numpy)`);
|
|
190
|
+
}
|
|
191
|
+
return JSON.parse(result.stdout);
|
|
192
|
+
}
|
|
193
|
+
function isInTmRegion(gene, pos) {
|
|
194
|
+
if (!gene)
|
|
195
|
+
return false;
|
|
196
|
+
const range = TM_REGIONS[gene];
|
|
197
|
+
if (!range)
|
|
198
|
+
return false;
|
|
199
|
+
return pos >= range[0] && pos <= range[1];
|
|
200
|
+
}
|
|
201
|
+
function loadConsensus(gene) {
|
|
202
|
+
const cachePath = path.join(os.homedir(), '.biofs', 'cache', 'rrm', `${gene}.json`);
|
|
203
|
+
if (!fs.existsSync(cachePath)) {
|
|
204
|
+
throw new Error(`No consensus f_c cached for ${gene}. Run first: biofs rrm-consensus ${gene}\n` +
|
|
205
|
+
`(expected at ${cachePath})`);
|
|
206
|
+
}
|
|
207
|
+
return JSON.parse(fs.readFileSync(cachePath, 'utf8'));
|
|
208
|
+
}
|
|
209
|
+
function computeFullProteinFft(fullWt, fullMt, fcFreqNormalized, commonLength, consensusPeaks, consensusSpectrum) {
|
|
210
|
+
const py = `
|
|
211
|
+
import json, sys, numpy as np
|
|
212
|
+
|
|
213
|
+
EIIP = {
|
|
214
|
+
'A': 0.0373, 'R': 0.0959, 'N': 0.0036, 'D': 0.1263, 'C': 0.0829,
|
|
215
|
+
'E': 0.0058, 'Q': 0.0761, 'G': 0.0050, 'H': 0.0242, 'I': 0.0000,
|
|
216
|
+
'L': 0.0000, 'K': 0.0371, 'M': 0.0823, 'F': 0.0946, 'P': 0.0198,
|
|
217
|
+
'S': 0.0829, 'T': 0.0941, 'W': 0.0548, 'Y': 0.0516, 'V': 0.0057,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
d = json.loads(sys.stdin.read())
|
|
221
|
+
|
|
222
|
+
def encode(seq, target_len):
|
|
223
|
+
s = seq[:target_len]
|
|
224
|
+
if len(s) < target_len:
|
|
225
|
+
s = s + 'X' * (target_len - len(s))
|
|
226
|
+
v = np.array([EIIP.get(aa, 0.0) for aa in s], dtype=float)
|
|
227
|
+
return v - v.mean()
|
|
228
|
+
|
|
229
|
+
wt_eiip = encode(d['wt'], d['common_length'])
|
|
230
|
+
mt_eiip = encode(d['mt'], d['common_length'])
|
|
231
|
+
|
|
232
|
+
Xw = np.abs(np.fft.rfft(wt_eiip))
|
|
233
|
+
Xm = np.abs(np.fft.rfft(mt_eiip))
|
|
234
|
+
# Normalize each to unit total energy so the result is comparable to the
|
|
235
|
+
# consensus magnitudes (which were also unit-normalized).
|
|
236
|
+
if Xw.sum() > 0: Xw = Xw / Xw.sum()
|
|
237
|
+
if Xm.sum() > 0: Xm = Xm / Xm.sum()
|
|
238
|
+
|
|
239
|
+
# The consensus f_c was computed on a spectrum of length common_length // 2 + 1
|
|
240
|
+
# in the same normalization (cycles/residue). Our full-protein DFT has the
|
|
241
|
+
# same axis, so we look up the bin directly.
|
|
242
|
+
N = len(Xw)
|
|
243
|
+
fc_bin = int(round(d['fc_freq'] * 2 * (N - 1)))
|
|
244
|
+
fc_bin = max(0, min(N - 1, fc_bin))
|
|
245
|
+
|
|
246
|
+
# Multi-peak scoring: if the caller passed consensus_peaks, score at each.
|
|
247
|
+
multi_peak = []
|
|
248
|
+
weighted_num = 0.0
|
|
249
|
+
weighted_den = 0.0
|
|
250
|
+
consensus_peaks = d.get('consensus_peaks') or []
|
|
251
|
+
for p in consensus_peaks:
|
|
252
|
+
k = int(p['bin'])
|
|
253
|
+
if k >= N: continue
|
|
254
|
+
xw, xm = float(Xw[k]), float(Xm[k])
|
|
255
|
+
ratio = xm / xw if xw > 0 else 0.0
|
|
256
|
+
de = 100.0 * (xm*xm - xw*xw) / (xw*xw) if xw > 0 else 0.0
|
|
257
|
+
mag = float(p.get('magnitude', 0))
|
|
258
|
+
snr = float(p.get('snr', 0))
|
|
259
|
+
multi_peak.append({
|
|
260
|
+
'bin': k,
|
|
261
|
+
'period': 1.0 / (k / (2*(N-1))) if k > 0 else 0,
|
|
262
|
+
'consensusSnr': snr,
|
|
263
|
+
'consensusMagnitude': mag,
|
|
264
|
+
'wtMagnitude': xw,
|
|
265
|
+
'mtMagnitude': xm,
|
|
266
|
+
'ratio': ratio,
|
|
267
|
+
'energyChangePct': de,
|
|
268
|
+
})
|
|
269
|
+
weighted_num += mag * de
|
|
270
|
+
weighted_den += mag
|
|
271
|
+
|
|
272
|
+
weighted_agg = weighted_num / weighted_den if weighted_den > 0 else 0.0
|
|
273
|
+
|
|
274
|
+
# Full-spectrum integrated metrics (Cosic-style "informational spectrum distance")
|
|
275
|
+
spec_l1 = float(np.sum(np.abs(Xm - Xw)))
|
|
276
|
+
total_e_wt = float(np.sum(Xw**2))
|
|
277
|
+
total_e_mt = float(np.sum(Xm**2))
|
|
278
|
+
total_de_pct = 100.0 * (total_e_mt - total_e_wt) / total_e_wt if total_e_wt > 0 else 0.0
|
|
279
|
+
|
|
280
|
+
out = {
|
|
281
|
+
'wtMag': Xw.tolist(),
|
|
282
|
+
'mtMag': Xm.tolist(),
|
|
283
|
+
'wtAtFc': float(Xw[fc_bin]),
|
|
284
|
+
'mtAtFc': float(Xm[fc_bin]),
|
|
285
|
+
'fcBinInProteinSpectrum': fc_bin,
|
|
286
|
+
'multiPeakScores': multi_peak,
|
|
287
|
+
'weightedAggregateDeltaEPct': weighted_agg,
|
|
288
|
+
'fullSpectrumL1': spec_l1,
|
|
289
|
+
'totalEnergyChangePct': total_de_pct,
|
|
290
|
+
}
|
|
291
|
+
print(json.dumps(out))
|
|
292
|
+
`;
|
|
293
|
+
const r = (0, child_process_1.spawnSync)('python3', ['-c', py], {
|
|
294
|
+
encoding: 'utf8',
|
|
295
|
+
input: JSON.stringify({
|
|
296
|
+
wt: fullWt,
|
|
297
|
+
mt: fullMt,
|
|
298
|
+
common_length: commonLength,
|
|
299
|
+
fc_freq: fcFreqNormalized,
|
|
300
|
+
consensus_peaks: consensusPeaks || [],
|
|
301
|
+
}),
|
|
302
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
303
|
+
});
|
|
304
|
+
if (r.status !== 0) {
|
|
305
|
+
throw new Error(`Full-protein FFT failed: ${r.stderr || r.stdout}`);
|
|
306
|
+
}
|
|
307
|
+
return JSON.parse(r.stdout);
|
|
308
|
+
}
|
|
309
|
+
function scoreOne(parsed, opts) {
|
|
310
|
+
if (!parsed.uniprot) {
|
|
311
|
+
throw new Error(`No UniProt accession for "${parsed.original}". Pass --uniprot.`);
|
|
312
|
+
}
|
|
313
|
+
const fasta = fetchUniprotFasta(parsed.uniprot);
|
|
314
|
+
const seq = fastaSequence(fasta);
|
|
315
|
+
if (parsed.pos < 1 || parsed.pos > seq.length) {
|
|
316
|
+
throw new Error(`Position ${parsed.pos} out of range for ${parsed.uniprot} (length ${seq.length})`);
|
|
317
|
+
}
|
|
318
|
+
const observedRef = seq[parsed.pos - 1];
|
|
319
|
+
if (observedRef !== parsed.ref) {
|
|
320
|
+
throw new Error(`Reference mismatch at ${parsed.uniprot}:${parsed.pos} — sequence has "${observedRef}", HGVS expects "${parsed.ref}"`);
|
|
321
|
+
}
|
|
322
|
+
const inTm = isInTmRegion(parsed.gene, parsed.pos);
|
|
323
|
+
const defaultN = inTm ? 51 : 31;
|
|
324
|
+
const Nstr = inTm ? opts.windowTm : opts.window;
|
|
325
|
+
const N = Nstr ? parseInt(Nstr, 10) : defaultN;
|
|
326
|
+
if (N < 5 || N > 201 || N % 2 === 0) {
|
|
327
|
+
throw new Error(`Window N must be odd and 5≤N≤201, got ${N}`);
|
|
328
|
+
}
|
|
329
|
+
const wtSeq = extractWindow(seq, parsed.pos, N);
|
|
330
|
+
const mtSeq = wtSeq.slice(0, Math.floor(N / 2)) + parsed.alt + wtSeq.slice(Math.floor(N / 2) + 1);
|
|
331
|
+
const wtVec = toEIIPVector(wtSeq);
|
|
332
|
+
const mtVec = toEIIPVector(mtSeq);
|
|
333
|
+
const fft = computeFft(wtVec, mtVec);
|
|
334
|
+
const row = {
|
|
335
|
+
variant: parsed.original,
|
|
336
|
+
gene: parsed.gene,
|
|
337
|
+
pos: parsed.pos,
|
|
338
|
+
ref: parsed.ref,
|
|
339
|
+
alt: parsed.alt,
|
|
340
|
+
windowSize: N,
|
|
341
|
+
domainHint: inTm ? 'transmembrane' : 'extracellular',
|
|
342
|
+
refEIIP: EIIP[parsed.ref] ?? 0,
|
|
343
|
+
altEIIP: EIIP[parsed.alt] ?? 0,
|
|
344
|
+
deltaEIIP: Math.abs((EIIP[parsed.ref] ?? 0) - (EIIP[parsed.alt] ?? 0)),
|
|
345
|
+
sumAbsDeltaF: fft.sumAbsDelta,
|
|
346
|
+
sumAbsDeltaFNoDc: fft.sumAbsDeltaNoDc,
|
|
347
|
+
sumAbsDeltaFDetrended: fft.sumAbsDeltaDetrended,
|
|
348
|
+
maxAbsDeltaF: fft.maxAbsDelta,
|
|
349
|
+
maxBin: fft.maxAbsDeltaBin,
|
|
350
|
+
maxAbsDeltaFNoDc: fft.maxAbsDeltaNoDc,
|
|
351
|
+
maxBinNoDc: fft.maxAbsDeltaBinNoDc,
|
|
352
|
+
k0Delta: fft.k0Delta,
|
|
353
|
+
energyChangeRatio: fft.energyChangeRatio,
|
|
354
|
+
deltaVector: fft.deltaMag,
|
|
355
|
+
deltaVectorDetrended: fft.deltaMagDetrended,
|
|
356
|
+
wtSeq,
|
|
357
|
+
mtSeq,
|
|
358
|
+
};
|
|
359
|
+
// Cosic RRM canonical scoring at the family characteristic frequency
|
|
360
|
+
// (with multi-peak + full-spectrum integrated metrics).
|
|
361
|
+
if (opts.consensusFc) {
|
|
362
|
+
if (!parsed.gene) {
|
|
363
|
+
throw new Error(`--consensus-fc requires a gene name in the HGVS (e.g. ITGA2B:p.Val779Ala)`);
|
|
364
|
+
}
|
|
365
|
+
const cons = loadConsensus(parsed.gene);
|
|
366
|
+
const consensusSpectrum = cons.consensus_spectrum;
|
|
367
|
+
// Surface the top consensus peaks as scoring sites. If the cached file
|
|
368
|
+
// only has one (strict 3σ threshold filtered the rest), augment by
|
|
369
|
+
// walking the full consensus spectrum and grabbing the top-10 bins.
|
|
370
|
+
let peaksWithSnr = (cons.consensus_peak_bins || []).map(p => ({
|
|
371
|
+
bin: p.bin,
|
|
372
|
+
freq_normalized: p.freq_normalized,
|
|
373
|
+
magnitude: p.magnitude,
|
|
374
|
+
snr: 0,
|
|
375
|
+
}));
|
|
376
|
+
if (peaksWithSnr.length < 10 && consensusSpectrum) {
|
|
377
|
+
const ranked = consensusSpectrum
|
|
378
|
+
.map((m, k) => ({ k, m }))
|
|
379
|
+
.filter(({ k }) => k >= 2)
|
|
380
|
+
.sort((a, b) => b.m - a.m)
|
|
381
|
+
.slice(0, 10);
|
|
382
|
+
const N = consensusSpectrum.length;
|
|
383
|
+
const median = ((arr) => {
|
|
384
|
+
const s = [...arr].sort((a, b) => a - b);
|
|
385
|
+
return s.length % 2 === 0 ? (s[s.length / 2 - 1] + s[s.length / 2]) / 2 : s[(s.length - 1) / 2];
|
|
386
|
+
})(consensusSpectrum);
|
|
387
|
+
const mean = consensusSpectrum.reduce((a, b) => a + b, 0) / consensusSpectrum.length;
|
|
388
|
+
const sd = Math.sqrt(consensusSpectrum.reduce((a, b) => a + (b - mean) ** 2, 0) / consensusSpectrum.length);
|
|
389
|
+
peaksWithSnr = ranked.map(({ k, m }) => ({
|
|
390
|
+
bin: k,
|
|
391
|
+
freq_normalized: k / (2 * (N - 1)),
|
|
392
|
+
magnitude: m,
|
|
393
|
+
snr: (m - median) / (sd + 1e-12),
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
// Build the full mutant sequence by swapping the one residue at parsed.pos.
|
|
397
|
+
const mtFull = seq.slice(0, parsed.pos - 1) + parsed.alt + seq.slice(parsed.pos);
|
|
398
|
+
const full = computeFullProteinFft(seq, mtFull, cons.characteristic_frequency_normalized, cons.common_length, peaksWithSnr, consensusSpectrum);
|
|
399
|
+
row.fcBin = full.fcBinInProteinSpectrum;
|
|
400
|
+
row.fcFreqNormalized = cons.characteristic_frequency_normalized;
|
|
401
|
+
row.fcPeriodAa = cons.characteristic_frequency_period_aa;
|
|
402
|
+
row.fullXwtAtFc = full.wtAtFc;
|
|
403
|
+
row.fullXmtAtFc = full.mtAtFc;
|
|
404
|
+
row.fcRatio = full.wtAtFc > 0 ? full.mtAtFc / full.wtAtFc : 0;
|
|
405
|
+
row.fcDelta = full.wtAtFc - full.mtAtFc;
|
|
406
|
+
row.fcEnergyChangePct = full.wtAtFc > 0
|
|
407
|
+
? 100 * (full.mtAtFc * full.mtAtFc - full.wtAtFc * full.wtAtFc) / (full.wtAtFc * full.wtAtFc)
|
|
408
|
+
: 0;
|
|
409
|
+
row.fullSpectrumWt = full.wtMag;
|
|
410
|
+
row.fullSpectrumMt = full.mtMag;
|
|
411
|
+
row.multiPeakScores = full.multiPeakScores;
|
|
412
|
+
row.weightedAggregateDeltaEPct = full.weightedAggregateDeltaEPct;
|
|
413
|
+
row.fullSpectrumL1 = full.fullSpectrumL1;
|
|
414
|
+
row.totalEnergyChangePct = full.totalEnergyChangePct;
|
|
415
|
+
}
|
|
416
|
+
return row;
|
|
417
|
+
}
|
|
418
|
+
function renderFcSection(rows) {
|
|
419
|
+
if (!rows.some(r => r.fcRatio !== undefined))
|
|
420
|
+
return '';
|
|
421
|
+
const lines = [];
|
|
422
|
+
const sep = '━'.repeat(120);
|
|
423
|
+
lines.push('');
|
|
424
|
+
lines.push(chalk_1.default.magenta(sep));
|
|
425
|
+
lines.push(chalk_1.default.bold.magenta(' Cosic-RRM full-protein scoring at family characteristic frequency f_c'));
|
|
426
|
+
lines.push(chalk_1.default.magenta(sep));
|
|
427
|
+
lines.push(chalk_1.default.bold('variant'.padEnd(30) +
|
|
428
|
+
'f_c bin'.padEnd(10) +
|
|
429
|
+
'period (aa)'.padEnd(13) +
|
|
430
|
+
'|X_WT(f_c)|'.padEnd(14) +
|
|
431
|
+
'|X_MT(f_c)|'.padEnd(14) +
|
|
432
|
+
'ratio MT/WT'.padEnd(13) +
|
|
433
|
+
'ΔE @ f_c'));
|
|
434
|
+
lines.push(chalk_1.default.magenta('-'.repeat(120)));
|
|
435
|
+
for (const r of rows) {
|
|
436
|
+
if (r.fcRatio === undefined)
|
|
437
|
+
continue;
|
|
438
|
+
const ratio = r.fcRatio;
|
|
439
|
+
const ratioStr = ratio.toFixed(4);
|
|
440
|
+
const ratioColor = ratio < 0.8 ? chalk_1.default.red : ratio > 1.2 ? chalk_1.default.yellow : chalk_1.default.white;
|
|
441
|
+
lines.push(r.variant.padEnd(30) +
|
|
442
|
+
String(r.fcBin).padEnd(10) +
|
|
443
|
+
(r.fcPeriodAa ?? 0).toFixed(2).padEnd(13) +
|
|
444
|
+
(r.fullXwtAtFc ?? 0).toExponential(3).padEnd(14) +
|
|
445
|
+
(r.fullXmtAtFc ?? 0).toExponential(3).padEnd(14) +
|
|
446
|
+
ratioColor(ratioStr.padEnd(13)) +
|
|
447
|
+
((r.fcEnergyChangePct ?? 0).toFixed(2) + '%'));
|
|
448
|
+
}
|
|
449
|
+
lines.push(chalk_1.default.magenta(sep));
|
|
450
|
+
lines.push(chalk_1.default.gray(' ratio MT/WT <0.8 = significant loss of energy at characteristic frequency (LoF signature)'));
|
|
451
|
+
lines.push(chalk_1.default.gray(' ≈1.0 = no perturbation of family-conserved resonance'));
|
|
452
|
+
lines.push(chalk_1.default.gray(' >1.2 = energy gain (rare, may indicate altered specificity)'));
|
|
453
|
+
// Multi-peak + full-spectrum integrated metrics (Cosic's "informational spectrum distance")
|
|
454
|
+
for (const r of rows) {
|
|
455
|
+
const mps = r.multiPeakScores;
|
|
456
|
+
if (!mps || mps.length === 0)
|
|
457
|
+
continue;
|
|
458
|
+
lines.push('');
|
|
459
|
+
lines.push(chalk_1.default.magenta('-'.repeat(120)));
|
|
460
|
+
lines.push(chalk_1.default.bold(` Per-peak Cosic-RRM scoring ${r.variant}`));
|
|
461
|
+
lines.push(chalk_1.default.gray(' ' +
|
|
462
|
+
'k'.padStart(5) +
|
|
463
|
+
'period'.padStart(10) +
|
|
464
|
+
'SNR'.padStart(8) +
|
|
465
|
+
'|X_WT|'.padStart(14) +
|
|
466
|
+
'|X_MT|'.padStart(14) +
|
|
467
|
+
'ratio'.padStart(10) +
|
|
468
|
+
'ΔE%'.padStart(10)));
|
|
469
|
+
for (const p of mps.slice(0, 10)) {
|
|
470
|
+
const ratioStr = p.ratio.toFixed(4);
|
|
471
|
+
const deStr = (p.energyChangePct >= 0 ? '+' : '') + p.energyChangePct.toFixed(2) + '%';
|
|
472
|
+
const color = Math.abs(p.energyChangePct) > 5 ? chalk_1.default.red : Math.abs(p.energyChangePct) > 2 ? chalk_1.default.yellow : chalk_1.default.gray;
|
|
473
|
+
lines.push(' ' +
|
|
474
|
+
String(p.bin).padStart(5) +
|
|
475
|
+
p.period.toFixed(1).padStart(10) +
|
|
476
|
+
(p.consensusSnr.toFixed(2) + 'σ').padStart(8) +
|
|
477
|
+
p.wtMagnitude.toExponential(2).padStart(14) +
|
|
478
|
+
p.mtMagnitude.toExponential(2).padStart(14) +
|
|
479
|
+
color(ratioStr.padStart(10)) +
|
|
480
|
+
color(deStr.padStart(10)));
|
|
481
|
+
}
|
|
482
|
+
const wagg = r.weightedAggregateDeltaEPct;
|
|
483
|
+
const l1 = r.fullSpectrumL1;
|
|
484
|
+
const tde = r.totalEnergyChangePct;
|
|
485
|
+
if (wagg !== undefined) {
|
|
486
|
+
lines.push('');
|
|
487
|
+
lines.push(chalk_1.default.magenta(' Summary metrics:'));
|
|
488
|
+
lines.push(` weighted aggregate ΔE% (top-N peaks): ${(wagg >= 0 ? '+' : '') + wagg.toFixed(4)}%`);
|
|
489
|
+
lines.push(` full-spectrum L1 distance: ${l1.toExponential(4)}`);
|
|
490
|
+
lines.push(` total energy change: ${(tde >= 0 ? '+' : '') + tde.toFixed(4)}%`);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return lines.join('\n');
|
|
494
|
+
}
|
|
495
|
+
function renderTable(rows) {
|
|
496
|
+
const lines = [];
|
|
497
|
+
const sep = '─'.repeat(160);
|
|
498
|
+
lines.push(chalk_1.default.cyan(sep));
|
|
499
|
+
lines.push(chalk_1.default.bold('variant'.padEnd(28) +
|
|
500
|
+
'pos'.padEnd(6) +
|
|
501
|
+
'ref→alt'.padEnd(10) +
|
|
502
|
+
'ΔEIIP'.padEnd(10) +
|
|
503
|
+
'N'.padEnd(4) +
|
|
504
|
+
'domain'.padEnd(15) +
|
|
505
|
+
'Σ|ΔF|(k≥1)'.padEnd(13) +
|
|
506
|
+
'max|ΔF|(k≥1)'.padEnd(14) +
|
|
507
|
+
'max-bin'.padEnd(10) +
|
|
508
|
+
'Σ|ΔF|det'.padEnd(12) +
|
|
509
|
+
'ΔE%'));
|
|
510
|
+
lines.push(chalk_1.default.cyan(sep));
|
|
511
|
+
for (const r of rows) {
|
|
512
|
+
lines.push(r.variant.padEnd(28) +
|
|
513
|
+
String(r.pos).padEnd(6) +
|
|
514
|
+
`${r.ref}→${r.alt}`.padEnd(10) +
|
|
515
|
+
r.deltaEIIP.toFixed(4).padEnd(10) +
|
|
516
|
+
String(r.windowSize).padEnd(4) +
|
|
517
|
+
r.domainHint.padEnd(15) +
|
|
518
|
+
r.sumAbsDeltaFNoDc.toFixed(4).padEnd(13) +
|
|
519
|
+
r.maxAbsDeltaFNoDc.toFixed(4).padEnd(14) +
|
|
520
|
+
String(r.maxBinNoDc).padEnd(10) +
|
|
521
|
+
r.sumAbsDeltaFDetrended.toFixed(4).padEnd(12) +
|
|
522
|
+
(r.energyChangeRatio * 100).toFixed(2) + '%');
|
|
523
|
+
lines.push(chalk_1.default.gray(` WT: ${r.wtSeq}`));
|
|
524
|
+
lines.push(chalk_1.default.gray(` MT: ${r.mtSeq}`));
|
|
525
|
+
}
|
|
526
|
+
lines.push(chalk_1.default.cyan(sep));
|
|
527
|
+
lines.push(chalk_1.default.gray(' Σ|ΔF|(k≥1) = total spectral disruption with DC excluded'));
|
|
528
|
+
lines.push(chalk_1.default.gray(' max|ΔF|(k≥1) = strongest non-DC bin (biophysical signature)'));
|
|
529
|
+
lines.push(chalk_1.default.gray(' Σ|ΔF|det = detrended spectrum (both signals zero-mean before DFT)'));
|
|
530
|
+
lines.push(chalk_1.default.gray(' ΔE% = (E_MT − E_WT) / E_WT × 100, total spectral energy change'));
|
|
531
|
+
return lines.join('\n');
|
|
532
|
+
}
|
|
533
|
+
function renderTsv(rows) {
|
|
534
|
+
const headers = ['variant', 'gene', 'pos', 'ref', 'alt', 'window', 'domain', 'refEIIP', 'altEIIP', 'deltaEIIP', 'sumAbsDeltaF', 'maxAbsDeltaF', 'maxBin', 'k0Delta', 'wtSeq', 'mtSeq', 'deltaVector'];
|
|
535
|
+
const lines = [headers.join('\t')];
|
|
536
|
+
for (const r of rows) {
|
|
537
|
+
lines.push([
|
|
538
|
+
r.variant,
|
|
539
|
+
r.gene ?? '',
|
|
540
|
+
r.pos,
|
|
541
|
+
r.ref,
|
|
542
|
+
r.alt,
|
|
543
|
+
r.windowSize,
|
|
544
|
+
r.domainHint,
|
|
545
|
+
r.refEIIP.toFixed(4),
|
|
546
|
+
r.altEIIP.toFixed(4),
|
|
547
|
+
r.deltaEIIP.toFixed(6),
|
|
548
|
+
r.sumAbsDeltaF.toFixed(6),
|
|
549
|
+
r.maxAbsDeltaF.toFixed(6),
|
|
550
|
+
r.maxBin,
|
|
551
|
+
r.k0Delta.toFixed(6),
|
|
552
|
+
r.wtSeq,
|
|
553
|
+
r.mtSeq,
|
|
554
|
+
r.deltaVector.map(x => x.toFixed(6)).join(','),
|
|
555
|
+
].join('\t'));
|
|
556
|
+
}
|
|
557
|
+
return lines.join('\n');
|
|
558
|
+
}
|
|
559
|
+
async function fourierScoreCommand(variantsArg, opts) {
|
|
560
|
+
if (!variantsArg || variantsArg.trim() === '') {
|
|
561
|
+
throw new Error('Provide at least one HGVS variant (e.g. ITGA2B:p.Val779Ala). Multiple comma-separated.');
|
|
562
|
+
}
|
|
563
|
+
const inputs = variantsArg.split(',').map(s => s.trim()).filter(Boolean);
|
|
564
|
+
const parsed = inputs.map(s => parseHgvs(s, opts.uniprot));
|
|
565
|
+
if (!opts.quiet) {
|
|
566
|
+
console.error(chalk_1.default.cyan(`\n🌊 biofs fourier-score — ${parsed.length} variant(s)`));
|
|
567
|
+
for (const p of parsed) {
|
|
568
|
+
console.error(chalk_1.default.gray(` ${p.original} → ${p.gene || '?'} (${p.uniprot || '?'}) pos ${p.pos} ${p.ref}→${p.alt}`));
|
|
569
|
+
}
|
|
570
|
+
console.error('');
|
|
571
|
+
}
|
|
572
|
+
const rows = parsed.map(p => scoreOne(p, opts));
|
|
573
|
+
const fmt = opts.format || 'table';
|
|
574
|
+
let rendered;
|
|
575
|
+
if (fmt === 'json') {
|
|
576
|
+
rendered = JSON.stringify(rows, null, 2);
|
|
577
|
+
}
|
|
578
|
+
else if (fmt === 'tsv') {
|
|
579
|
+
rendered = renderTsv(rows);
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
rendered = renderTable(rows);
|
|
583
|
+
}
|
|
584
|
+
// Append the Cosic-RRM f_c section if any rows have it
|
|
585
|
+
const fcSection = renderFcSection(rows);
|
|
586
|
+
if (opts.output) {
|
|
587
|
+
fs.writeFileSync(opts.output, (rendered + '\n' + fcSection).replace(/\x1b\[[0-9;]*m/g, ''));
|
|
588
|
+
if (!opts.quiet) {
|
|
589
|
+
console.error(chalk_1.default.green(`✓ Wrote scores for ${rows.length} variant(s) to ${opts.output}`));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
console.log(rendered);
|
|
594
|
+
if (fcSection)
|
|
595
|
+
console.log(fcSection);
|
|
596
|
+
}
|
|
597
|
+
if (opts.plot) {
|
|
598
|
+
plotSpectra(rows, opts.plot, opts.quiet || false);
|
|
599
|
+
}
|
|
600
|
+
if (opts.plotFull && rows.some(r => r.fullSpectrumWt)) {
|
|
601
|
+
plotFullProteinSpectra(rows, opts.plotFull, opts.quiet || false);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function plotFullProteinSpectra(rows, outPath, quiet) {
|
|
605
|
+
const py = `
|
|
606
|
+
import json, sys
|
|
607
|
+
import matplotlib
|
|
608
|
+
matplotlib.use("Agg")
|
|
609
|
+
import matplotlib.pyplot as plt
|
|
610
|
+
import numpy as np
|
|
611
|
+
|
|
612
|
+
d = json.loads(sys.stdin.read())
|
|
613
|
+
rows = [r for r in d["rows"] if r.get("fullSpectrumWt")]
|
|
614
|
+
n = len(rows)
|
|
615
|
+
fig, axes = plt.subplots(n, 1, figsize=(12, 3.8 * n), squeeze=False)
|
|
616
|
+
|
|
617
|
+
for i, r in enumerate(rows):
|
|
618
|
+
ax = axes[i, 0]
|
|
619
|
+
Xw = np.array(r["fullSpectrumWt"])
|
|
620
|
+
Xm = np.array(r["fullSpectrumMt"])
|
|
621
|
+
freqs = np.linspace(0, 0.5, len(Xw))
|
|
622
|
+
ax.plot(freqs, Xw, color="#1f77b4", linewidth=0.9, label="|X_WT(k)|", alpha=0.9)
|
|
623
|
+
ax.plot(freqs, Xm, color="#d62728", linewidth=0.9, label="|X_MT(k)|", alpha=0.9, linestyle="--")
|
|
624
|
+
fc_freq = r["fcFreqNormalized"]
|
|
625
|
+
ax.axvline(fc_freq, color="#2ca02c", linewidth=1.2, linestyle=":", label=f"f_c = {fc_freq:.4f} (period {r['fcPeriodAa']:.1f} aa)")
|
|
626
|
+
# Zoom in to the low-frequency region where f_c lives
|
|
627
|
+
ax.set_xlim(0, max(0.05, fc_freq * 8))
|
|
628
|
+
ax.set_xlabel("normalized frequency (cycles/residue)")
|
|
629
|
+
ax.set_ylabel("|X(k)| (unit-energy normalized)")
|
|
630
|
+
ratio = r["fcRatio"]
|
|
631
|
+
de = r["fcEnergyChangePct"]
|
|
632
|
+
ax.set_title(
|
|
633
|
+
f"{r['variant']} ({r['ref']}{r['pos']}{r['alt']}) "
|
|
634
|
+
f"|X_WT(f_c)|={r['fullXwtAtFc']:.3e} |X_MT(f_c)|={r['fullXmtAtFc']:.3e} "
|
|
635
|
+
f"ratio MT/WT={ratio:.4f} ΔE@f_c={de:+.2f}%"
|
|
636
|
+
)
|
|
637
|
+
ax.legend(loc="upper right", fontsize=9)
|
|
638
|
+
ax.grid(True, alpha=0.3)
|
|
639
|
+
|
|
640
|
+
fig.suptitle("Cosic-RRM full-protein DFT at family characteristic frequency | biofs fourier-score --consensus-fc", y=1.0, fontsize=11)
|
|
641
|
+
fig.tight_layout()
|
|
642
|
+
fig.savefig(d["out_path"], dpi=150, bbox_inches="tight")
|
|
643
|
+
print(f"OK: {d['out_path']}", file=sys.stderr)
|
|
644
|
+
`;
|
|
645
|
+
const r = (0, child_process_1.spawnSync)('python3', ['-c', py], {
|
|
646
|
+
encoding: 'utf8',
|
|
647
|
+
input: JSON.stringify({ rows, out_path: outPath }),
|
|
648
|
+
maxBuffer: 200 * 1024 * 1024,
|
|
649
|
+
});
|
|
650
|
+
if (r.status !== 0) {
|
|
651
|
+
throw new Error(`Full-protein plot failed: ${r.stderr || r.stdout}`);
|
|
652
|
+
}
|
|
653
|
+
if (!quiet)
|
|
654
|
+
console.error(chalk_1.default.green(`✓ Full-protein f_c spectrum saved to ${outPath}`));
|
|
655
|
+
}
|
|
656
|
+
function plotSpectra(rows, outPath, quiet) {
|
|
657
|
+
const py = `
|
|
658
|
+
import json, sys
|
|
659
|
+
import matplotlib
|
|
660
|
+
matplotlib.use("Agg")
|
|
661
|
+
import matplotlib.pyplot as plt
|
|
662
|
+
import numpy as np
|
|
663
|
+
|
|
664
|
+
d = json.loads(sys.stdin.read())
|
|
665
|
+
rows = d["rows"]
|
|
666
|
+
out_path = d["out_path"]
|
|
667
|
+
n = len(rows)
|
|
668
|
+
fig, axes = plt.subplots(n, 1, figsize=(11, 3.5 * n), squeeze=False)
|
|
669
|
+
|
|
670
|
+
for i, r in enumerate(rows):
|
|
671
|
+
ax = axes[i, 0]
|
|
672
|
+
delta = np.array(r["deltaVector"])
|
|
673
|
+
delta_dt = np.array(r["deltaVectorDetrended"])
|
|
674
|
+
bins = np.arange(len(delta))
|
|
675
|
+
ax.bar(bins - 0.18, delta, width=0.36, color="#1f77b4", label="|ΔF|")
|
|
676
|
+
ax.bar(bins + 0.18, delta_dt, width=0.36, color="#d62728", alpha=0.85, label="|ΔF| (detrended)")
|
|
677
|
+
ax.set_xlabel("frequency bin k")
|
|
678
|
+
ax.set_ylabel("|ΔF|")
|
|
679
|
+
ax.set_title(
|
|
680
|
+
f'{r["variant"]} ({r["ref"]}{r["pos"]}{r["alt"]}, N={r["windowSize"]}, {r["domainHint"]}) '
|
|
681
|
+
f'Σ|ΔF|(k≥1)={r["sumAbsDeltaFNoDc"]:.3f} ΔE={r["energyChangeRatio"]*100:.1f}%'
|
|
682
|
+
)
|
|
683
|
+
ax.legend(loc="upper right")
|
|
684
|
+
ax.set_xticks(bins)
|
|
685
|
+
ax.grid(True, axis="y", alpha=0.3)
|
|
686
|
+
# Mark the maximum non-DC bin
|
|
687
|
+
if r["maxBinNoDc"] > 0:
|
|
688
|
+
ax.annotate(
|
|
689
|
+
f'max k={r["maxBinNoDc"]}',
|
|
690
|
+
xy=(r["maxBinNoDc"], r["maxAbsDeltaFNoDc"]),
|
|
691
|
+
xytext=(r["maxBinNoDc"] + 1.5, r["maxAbsDeltaFNoDc"] * 1.1),
|
|
692
|
+
fontsize=9,
|
|
693
|
+
arrowprops=dict(arrowstyle="->", color="black", lw=0.7),
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
fig.suptitle("Cosic-RRM ΔF spectra (EIIP+DFT) | biofs fourier-score", y=1.0, fontsize=12)
|
|
697
|
+
fig.tight_layout()
|
|
698
|
+
fig.savefig(out_path, dpi=150, bbox_inches="tight")
|
|
699
|
+
print(f"OK: {out_path}", file=sys.stderr)
|
|
700
|
+
`;
|
|
701
|
+
const result = (0, child_process_1.spawnSync)('python3', ['-c', py], {
|
|
702
|
+
encoding: 'utf8',
|
|
703
|
+
input: JSON.stringify({ rows, out_path: outPath }),
|
|
704
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
705
|
+
});
|
|
706
|
+
if (result.status !== 0) {
|
|
707
|
+
throw new Error(`Plot rendering failed: ${result.stderr || result.stdout}\n(install: python3 -m pip install matplotlib)`);
|
|
708
|
+
}
|
|
709
|
+
if (!quiet) {
|
|
710
|
+
console.error(chalk_1.default.green(`✓ ΔF spectrum saved to ${outPath}`));
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
//# sourceMappingURL=fourier-score.js.map
|