Spaces:
Sleeping
Sleeping
Commit History
-
feat: techspec additions — de novo tier-6 branch, structure export, page capture + final synthesis
Pre-work A1-A7: pymol2-wheel cleanup + fpocket source builds, migration 008 structure_prep_jobs with RLS, user-scoped reads, input validation, SSRF routing, chain_integrity + castp/fpocket status tags. S1: zero-hit proteins complete as de novo runs — composition/hints bundle, InterProScan5 sequence-search domains, ESMFold structure card; confidence tiers (identified/homolog/de_novo) threaded backend-to-frontend with badges, DeNovoPanel, unavailable-state messaging. S2: /api/structure-export router (PDB/CIF/styled PyMOL .pse), docking complex.pdb + ligand.sdf exports, StructureExportMenu on viewer + docking page, honest ChimeraX/VMD file+script bundles. S3: migration 009 page_captures, rate-limited allowlisted capture service wired per source, deterministic final-synthesis findings with confidence-tier tagging, FinalReport panel. 84 backend tests green across five suites; frontend tsc + lint clean.4939f56 -
feat: optimize CASTp SASA with KDTree, add sequence input to CASTp + Structure Prep, ESMFold integration for unknown genes
Backend: - castp.py: Replace O(n²) adjacency loop with scipy KDTree O(n log n), compute SASA on first model only - castp router: Accept pdb_id, sequence (auto-ESMFold), or pdb_text input - structure_prep.py: Add esmfold_predict() for raw sequences via HF Inference API - structure_prep router: Accept sequences for full pipeline (ESMFold → chain detection → repair → cleanup → pockets) Frontend: - CASTp page: PDB ID / amino acid sequence toggle, textarea with residue counter - Structure Prep page: PDB ID / amino acid sequence toggle, progress bar with ESMFold step - api.ts: Add runCastpSequence(), runStructurePrepSequence(), sequence_source on CastpResulte21c532
-
feat: structure preparation pipeline — broken chains → SWISS-MODEL repair → PyMOL cleanup → fpocket + CASTp
- Broken chain detection: Biopython REMARK 465 + CA-CA gap >4.2Å - SWISS-MODEL auto-repair when broken chains found (SMR Repository API) - PyMOL cleanup (waters/hetero removal) with Biopython fallback - fpocket local pocket detection (compiled from source in Docker) - CASTp remote async via CASTpFold server (polls for results) - Combined pocket results panel (fpocket + CASTp side by side) - Pipeline status stepper UI with progress bar - Both Dockerfiles: fpocket compiled from Discngine/fpocket source - Frontend: analyze/structure-prep/page.tsx with full pipeline visualization - Wired into main.py + api.ts, TypeScript clean1b28e93 -
fix: PDBParser.get_pdb -> get_structure in castp.py
8c37459 -
feat: add CASTp pockets, SWISS-MODEL, ESMFold + fix Dockerfiles
- CASTp pocket analysis: Biopython SASA + grid-based cavity detection, 3 endpoints - SWISS-MODEL Repository: query SMR API for homology models + experimental structures - ESMFold structure prediction: HF Inference API proxy, async job with progress - Fix root Dockerfile: add g++/libgl1/libgomp1/libopenblas-dev/libxml2/libxslt1.1 - Fix primer3-py quoting bug in both Dockerfiles (shell redirect issue) - Wire 3 routers into main.py, add API client functions, update analyze hub - TypeScript clean, zero errorsbe36a29 -
fix: NGS fallback to Python aligner when native tools missing; add missing re import in sequence_utils
34b3c94
-
refactor: require native samtools/minimap2, delete hand-rolled BAM/BAI code
- Install samtools + minimap2 in backend/Dockerfile and build.sh - render.yaml now uses build.sh (installs native tools) - _run_alignment: raises RuntimeError if tools missing, checks returncode on every subprocess call (minimap2, samtools sort, samtools index) - Deleted ~350 lines of hand-rolled BAM/BAI code: _bgzf_compress, _voffset_for, _sam_to_bam, _write_bai, _seq_to_half_ints, _parse_cigar, _cigar_ref_len, _reg2bin - _python_alignment now produces SAM only (no BAM/BAI) - _run_variant_calling: added returncode checks on bcftools calls - _upload_ngs_files: removed Python fallback paths - IgvBrowser: removed 300-line JS BAM converter, fetches BAM/BAI/VCF as Blobs for igv.js (which only supports BAM for alignments)2fe9546
-
fix: correct BGZF virtual offsets in BAI, fix duplicate-read bug, install minimap2 everywhere
Bug 1 (critical): _bgzf_compress now produces multi-block BGZF with proper block boundary tracking. _write_bai receives correct BGZF virtual offsets (coffset<<16|uoffset) instead of raw uncompressed byte offsets. New helper _voffset_for() maps uncompressed offsets through the block table. Bug 2: reads.index() in _python_alignment replaced with enumerate-by-index so duplicate reads (common in real FASTQs) don't silently overwrite each other's mapping slots. Both Dockerfiles now install minimap2 + samtools so the native alignment path (minimap2+samtools sort+samtools index) is always available. Python fallback kept as last resort with 'degraded: True' flag and warning log.45a0eed -
fix(ngs): dynamic locus + SAM-first igv.js for reliable genome browser
Root causes of blank igv.js browser: 1. Locus hardcoded to NC_045512v2:21000-25000 but synthetic reads align at position ~0 — browser was viewing an empty region 2. BAM format from pure-Python converter may still have subtle issues that igv.js strict parser rejects Fixes: - Backend: _python_alignment now computes read_region from actual mapped positions and returns it in the result - Backend: _compute_read_region() helper parses SAM for min/max positions - Backend: minimap2 path also gets read_region via the helper - Frontend: IgvBrowser prefers SAM over BAM (text format, zero risk) - Frontend: NGS page uses alignment.read_region for igv.js locus instead of hardcoded REFERENCE_LOCUS map - Frontend: Added read_region to NGSAlignment type132a669 -
fix: repair BAI index generation and BAM record format for igv.js compatibility
- Fix BAM record field order: swap flag and n_cigar to match BAM spec - Track pos and rec_len in record_info for proper BAI construction - Rewrite _write_bai(): correct chunk_end (voff+rec_len), per-window linear index entries instead of global min, forward-propagate empty windows - Install samtools in both Dockerfiles so native alignment path worksbd1c698 -
fix(ngs): correct BAM record format and BAI index for igv.js
Three critical bugs fixed: 1. Removed extra bin field in BAM records (BAM spec has no separate bin field; bin is embedded in bin_mq_nl). This was shifting all subsequent fields by 4 bytes, corrupting the entire BAM file. 2. Added reg2bin() to compute proper BAM bin numbers from reference coords. Previously hardcoded to 0, which caused igv.js to find no reads. 3. Rewrote _write_bai() with correct BAI format: proper reg2bin bin IDs, BAM virtual offsets (not genomic coordinates), and correct linear index. Previously used wrong bin numbers and genomic coords as offsets.70f89bb -
feat(ngs): pure-Python SAM to BAM converter with BGZF + BAI index for igv.js
- Added _sam_to_bam() for converting SAM to valid BGZF-compressed BAM - Added _bgzf_compress() producing proper BGZF blocks with raw deflate - Added _write_bai() generating minimal BAI index files - Python alignment now auto-generates BAM from SAM - Upload function finds aligned.bam as fallback - IgvBrowser prefers BAM over SAM with format detection - Removes duplicate helper functions0c59ad3 -
fix: igv.js white screen — CIGAR ops, qual strings, locus format
Backend (ngs.py): - CIGAR: replaced 1X with 1M (SAM spec: M = alignment match including mismatches). Added proper multi-digit collapse (63M37M -> 100M) - Quality strings: padded/truncated to match sequence length exactly - Unmapped reads: also get fixed-length quality strings Frontend: - IgvBrowser: added loading/error states, 100ms DOM delay, container clear before reinit, status feedback - Locus: changed from invalid gene names (SCoV2) to position format (NC_045512v2:21000-25000) for SARS-CoV-2 region of interest - SAM download link added alongside BAM/VCF/FASTA Verified: CIGAR collapse produces 100M, no X ops, all QUAL match seq len.a56b947 -
feat: add igv.js genome browser + proper 6-step NGS pipeline
Backend (ngs.py): - Step 1 QC: per-base quality distribution, GC windows, read length stats - Step 2 Trim: quality/length filtering with before/after metrics - Step 3 Align: Python seed-and-extend alignment (mapped reads, CIGAR) - Step 4 Variant: pileup-based variant calling with VCF output - Step 5 Annotation: SnpEff/cross-reference with protein changes - Step 6 Visualization: upload BAM/SAM/VCF/FASTA to Supabase Storage Frontend: - IgvBrowser component: lazy-loads igv.js, loads BAM/SAM + VCF tracks - Rebuilt NGS page with all 6 steps, per-base quality SVG chart - Download links for BAM/SAM/VCF/FASTA - TypeScript types updated for file_urls, quality charts, annotations Verified: end-to-end test produced 50 variants, uploaded SAM+VCF+reference.95e9035 -
feat: add full 6-step NGS pipeline + fix sequencing WinError 193
NGS Pipeline (new): - tools/ngs.py: 6-step pipeline (QC, trim, align, variants, annotate, report) with native tool detection (fastqc/fastp/minimap2/samtools/bcftools/snpEff) and pure-Python fallbacks for every step (works on Windows + Linux/Docker) - routers/ngs.py: FastAPI router with POST /run, GET /status, GET /references - migrations/007_ngs_jobs.sql: ngs_jobs table + claim RPC + RLS policies - worker.py: wired ngs_jobs into durable worker dispatch - rate_limit.py: 5 NGS jobs/day per user - Frontend: /analyze/ngs page with 6-step progress stepper, QC stats, trimming retention, alignment mapping rate, variant table, annotation with known variant lookup, consensus FASTA download, BLAST bridge - api.ts: NGS types + runNGS/getNGSStatus/listNGSReferences functions Sequencing Pipeline fix: - Fixed [WinError 193] by detecting platform and refusing to execute Linux ELF binary on Windows; added Python fallback alignment5fa9145
-
fix(pipeline): stop abandoning slow NCBI BLAST jobs + EBI fallback
NCBI BLAST routinely exceeds its optimistic RTOE under load, but the stuck heuristic (max(RTOE*5, 180s)) declared jobs STUCK after ~3 minutes even with a 900s poll budget, then re-submitted and failed 3x. The poll now gives a job at least half its budget before declaring STUCK. Add a resilience net: when NCBI fails or returns unparsable output, the pipeline BLAST step falls back to EBI BLAST (uncached, so transient errors are not cached for 24h), mapping NCBI databases to EBI equivalents. The pipeline only fails when both providers fail. BlastTool stype mapping fixed for blastx/tblastn. Verified: 8 new resilience tests + full seq_tools (48) pass; frontend tsc clean.60c8e2d -
feat(results): in-app share dialog + self-normalized dotplot scoring
Share flow: replace native share sheet / clipboard-only sharing with a dedicated ShareDialog (copy link, native Web Share when available, and popup links for X, Facebook, LinkedIn, WhatsApp, Telegram, Reddit, Email). Wizard and job detail pages now create the link, open the dialog, and show a spinner while the link is being created. Dotplot: stringency now means percent of a window's perfect self-match for substitution scoring (residue-composition independent), so identical A-rich proteins render a full main diagonal and conserved regions appear regardless of amino-acid content. Both inputs must be protein for matrix scoring; protein-vs-DNA comparisons fall back to identity and report a mixed type. BLAST panels link dot plots against full-length subject sequences from the MSA instead of the aligned segment. Verified: backend test_seq_tools 48 passed; frontend tsc + next build clean.525a5b5
-
feat(admet): ProTox 3.0 ML toxicity prediction — backend client + endpoint, frontend ProTox tab, restored sidebar chevron
38e4510
-
feat(seq-tools): motif categories & structure overlay, dot-plot scoring & features, cross-tool links
033540e -
feat(seq-tools): add sequence utilities, motif scanner and dot plot tools with frontend pages
60aee05
-
feat(primers): add NCBI gene search + sequence retrieval, oligo QC and in-silico PCR verification with recharts graphs
5d5e978 -
fix(function-predict): add BP term, real AA composition, JSON export, UniProt distinction, and /learn topic
0e1d7f2
-
Docking: flatten multi-chain obabel receptor output to a single model
033c1d2 -
Fix docking on Windows: resolve obabel from venv, use Windows Vina binary
- _ensure_obabel(): locate obabel on PATH (Docker/Linux) or next to the Python interpreter (Windows venv Scripts) and use the resolved binary. - _ensure_vina(): download vina_1.2.7_win.exe on Windows instead of the Linux binary (previously failed to execute). - requirements.txt: restore openbabel-wheel (obabel is required for the PDBQT conversion used by the docking pipeline). - Verified end-to-end on Windows: aspirin SDF->PDBQT, 1HIA PDB->PDBQT, Vina 1.2.7 docking produced poses with affinity scores.0c3a0da -
Fix pipeline MSA/AI stall, add SwissADME-parity ADMET panel, PubChem search, docking ligand data
- Pipeline: lazy litellm loading in interpreter/llm_client, brace-safe prompt building, EBI MSA best-effort (clustalo->muscle) + in-process progressive MSA fallback (msa_fallback.py), robust polling with consecutive-failure detection in PipelineResults. - ADMET: SwissADME-parity block (BOILED-Egg polygons, ESOL, Martin bioavailability, Muegge, radar, SA score), HBA as pure N+O count, recharts radar/BOILED-Egg/range-bar panel, chemical name in header. - PubChem: /api/admet/search autocomplete + name/CID->SMILES resolution, debounced compound search box on ADMET page. - Docking: ligand essential-data table (formula, MW, heavy atoms, H count, HBA/HBD/TPSA/RB/LogP) and per-pose hydrogen counts. - Pin backend start scripts to backend/.venv.5bb077e
-
feat(docking): Vina full-detail — parse 1.2.7 log (RMSD l.b./u.b., version, seed), RMSD table + run-config UI (3e)
4320faf
-
feat(uniprot,domains): reviewed/organism filters + debounce/fast-path, PROSITE raw-sequence scan UI (3c,3d)
7acf89d -
feat(alignment): multi-method MSA (clustalo/muscle/kalign/mafft/tcoffee) with method selector (3b)
cc7ed3f -
feat(alignment): pairwise global/local alignment via BLAST hit 'Align pair' (3a)
- POST /api/alignment/pairwise: Biopython PairwiseAligner (Needleman-Wunsch global default / Smith-Waterman local), BLOSUM62/PAM250, configurable gap penalties; subject fetched by accession (NCBI efetch -> UniProt fallback, ttl_cache 86400); clear 400 on dead/obsolete accession - Degenerate no-overlap local alignment returns empty result, not an error - BlastPanel 'Align pair' button: full query seq threaded from all 4 render sites, dimmed overhang beyond the aligned region, coverage note, fetch-failure UI - biopython>=1.80 pinned; 18 offline testsf0992bc -
feat(md): verified force field/solvent menu (ff14SB/ff15ipq/ff19SB/amberfb15/CHARMM36 x OBC1/OBC2/GBN2) with alanine-dipeptide createSystem startup probe; explicit errors for invalid combos; dynamic frontend menu
2583376
-
fix(md): raise production budget to 25 min so runs aren't clamped to ~3 ps
The 180s production budget clamped every real run to a few ps of dynamics on the slow CPU-only Space (a 250 ps request yielded 3 ps; the earlier 1TIM 'success' only delivered the 2 ps floor). The job window is 60 min, so raise the production budget to 1500s (25 min), leaving headroom for fetch/minimize/ equilibration. User-requested lengths are still honored as an upper bound.35104cd -
fix(md): don't abandon long jobs after 5 min + trim workload
The frontend poll loop gave up after 5 minutes, so any MD job taking longer on the throttled CPU-only Space showed 'Simulation timed out after 5 minutes' even though the backend finishes within its 60-minute window. Raise the poll cap to 65 min (md + function pages) so results always surface. Also trim default workload so typical jobs finish fast: minimize 500->300 steps, equilibrate 300->200, SASA 48->36 points / 5->4 frames.c6b3385 -
feat(md): clay simulation-parameter controls (force field, solvent, run length)
09fc54e
-
fix(md): reflect OXT across C-CA axis so GBSA stops NaNing on Linux CPU
The terminal OXT was placed by point-reflecting the carbonyl O through C, which drove it into the backbone (1.4 A from CA/CB on 1TIM HIS248). That clash made the initial GBSA force ~3.7e8 kJ/mol/nm - finite on Windows but NaN on the Linux CPU platform in the deployed container, aborting minimizeEnergy with 'Particle coordinate is NaN' and degrading every job to the BioPython fallback. Reflect O across the C-CA line instead (correct ~120 deg carboxylate angle, pointing away from the sidechain): initial max force drops to ~3.9e5 and minimize converges. Also switch GBSA to CutoffNonPeriodic (2.0 nm), the OpenMM-recommended implicit-solvent setup, which is ~3.5x faster than the O(N^2) NoCutoff path and lets jobs finish inside the Space's CPU-only limits. Supporting changes: per-job platform override, /health reports openmm version/platforms, debug meta (version/platform/init max force) attached to results and fallback diagnostics, cheaper SASA (48 pts, 5 frames), eq 300 steps, job timeou…d040f58 -
fix(md): surface real OpenMM error message + traceback in fallback diagnostics
13c2094 -
fix(md): add missing C-terminal OXT so unterminated termini (1TIM HIS 248) build in OpenMM
a28c4bb
-
fix(md): BioPython fallback crash on Atom.element.name ('str' object has no attribute 'name')
atom.element is already the element string in BioPython; use it directly for the SASA heavy-atom scan instead of elem.name. Regression test runs the fallback on a mini PDB.be32f12 -
feat(md): temperature/KE, Rg and SASA traces; fix OpenMM in deployed image
- Add temperature (from kinetic energy), radius-of-gyration and Shrake-Ruger SASA time series to OpenMM production results; static single points in the BioPython fallback; avg summary keys. - Correct nm->A conversion in _positions_to_np (RMSD/Rg/SASA were 10x too small and mislabeled as angstrom). - Self-calibrating production length: probe real platform throughput so runs fit the budget on fast local OpenCL and slow CPU-only containers (HF Spaces). - Deployment: install openmm>=8.0 via pip (PyPI since 8.0) instead of the broken micromamba+site-packages symlink; add libgomp1 to worker image; fix libgl1-mesa-glx -> libgl1 for bookworm base. Verified in a built image: OpenMM 8.5.2 imports and a full 1CRN production run completes with sane temperature/Rg/SASA. - Random-data unit tests for Rg, SASA, temperature-from-KE and Langevin thermostat; production integration test asserts the new keys. - Frontend: charts for temperature, Rg and SASA; SASA avg in summary.8e3419e -
feat(md): real OpenMM production runs with accurate Ca RMSD
- OpenMM 8.x implicit-solvent fix (explicit obc2 forcefield, NoCutoff) - Strip non-standard residues before parameterization - Adaptive production length (target 250 ps, cap 1 ns) sized to atom count - Ca-atom Kabsch RMSD + per-residue Ca RMSF, minimization drift metric - Graceful fallback to BioPython analysis when OpenMM cannot build structure - Fix rdkit/OpenMM DLL conflict (preload openmm before rdkit in worker/conftest) - Frontend: adaptive production progress bar + extended result typescbef588
-
fix: harden BLAST pipeline against NCBI timeouts and server overload
- Add EMAIL parameter to NCBI submit_blast (required by NCBI API) - Catch httpx.TimeoutException and HTTPStatusError in _request_with_retry - Add stuck-job detection in check_status_until_ready (5x RTOE threshold) - Add synchronous mode fallback when async RTOE is unreasonable (>300s) - Tolerate up to 3 consecutive poll failures before giving up - Increase retries from 1 to 2 (3 total attempts) - Increase poll start delay from 5s to 10s (NCBI rate limit guidance) - Add QUEUED status handling in poll loop - Fix EBI BlastTool: increase poll timeout (120->180s), add failure tolerance - Pipeline v2: pass retries=2 to run_blast_with_retry - Add comprehensive BLAST test suite (test_blast_comprehensive.py) with: * Multiple protein datasets (crambin, insulin, GFP, lysozyme, hemoglobin) * Full NCBI roundtrip tests, XML parsing, retry verification * EBI BLAST tool tests, error handling (empty/invalid/long sequences) * Random fuzz tests (5 random sequences), consecutive reliability tests …2dadeea -
feat: expanded Domain & Motif Analysis with all features and cross-project links
- Added domain_analysis.py tool with 12 analysis functions (InterPro, UniProt features, sites, PTMs, topology, motifs, variants, disulfide, composition, GO, pathways, full analysis) - Expanded domains router with 12 endpoints (/features, /sites, /ptm, /topology, /motifs, /variants, /disulfide, /composition, /go, /pathways, /all) - Updated DomainArchitecture.tsx with tabbed interface (9 tabs), multi-track SVG visualizations, cross-feature links - Updated domains page.tsx with richer UI, example accessions, bridge links to BLAST/Structure/UniProt/Interactions - Fixed fetch_uniprot_raw to handle 400 status codes gracefully - Added 19 new domain/motif endpoint tests (206 passed, 17 skipped, 0 failed)9c0c10a -
test: comprehensive validation & fuzz testing with bug fixes
- Add 84-test feature validation suite (test_feature_validation.py) covering all 19 platform features against real biological data (aspirin, caffeine, ibuprofen, 4HHB, TP53, P00698, etc.) - Add 71-test fuzz/random data suite (test_fuzz_random.py) with random SMILES, PDB IDs, sequences, SQL injection, XSS, path traversal, huge payloads, malformed JSON, Unicode, control characters - Fix Foldseek structure comparison: handle nested list-of-lists alignment format from updated API (structure_analysis.py:257) - Fix input sanitization for control characters in interactions, pathways, uniprot, and domains routers to prevent httpx.InvalidURL unhandled 500s - Fix KEGG search URL encoding with urllib.parse.quote - Fix ADMET BalabanJ segfault on Windows (os.name guard) and MolVolume exception handling - Add subprocess isolation for RDKit on Windows (admet router) - Add missing reportlab submodule mocks to conftest.py - Add asyncio_mode=auto to pytest.ini for async test support - 187 …d17fdb8
-
fix: case-insensitive accession lookup - normalize to uppercase at entry points
- sequences.py: .upper() accession before detect_source and API calls - ncbi_service.py: .upper() accession in fetch_by_accession - uniprot.py: .upper() accession in run() - Fixes: p04637 vs P04637 producing different results / cache misses9be3066 -
fix: AlphaFold lookup for NCBI RefSeq accessions
- _lookup(): map NCBI RefSeq IDs to UniProt before querying AlphaFold API - run(): skip cache for NCBI accessions (they need mapping, not caching) - Fixes: AlphaFold 404 when BLAST returns NP_/XP_/YP_ accessions93a4e13
-
fix: BLAST pipeline crash — accession misclassification + missing error handling
Root cause: NCBI accession QMS45324 (insulin hit) was misclassified as UniProt by detect_source_from_accession due to bare 'P/Q/O' prefix check. UniProt lookup then failed with 400, crashing the entire pipeline. Fixes: - detect_source_from_accession: regex-based detection ([OPQ][0-9]xxx for UniProt, A0A[A-Z0-9]{5,}[0-9] for new format) — QMS45324 now correctly classified as NCBI - UniprotTool._fetch: handle 400/500 errors (not just 404) - _run_uniprot: wrap in try/except so UniProt failures don't crash pipeline - pipeline_v2._execute: each step wrapped in individual try/except so one failed step doesn't kill the whole pipeline - map_refseq_to_uniprot: try RefSeq_Protein, EMBL, and PDB sourceseb567da -
fix: num_aromatic_rings -> n_aromatic_rings in CYP panel
45628dd -
feat: ADMET 3a/3b split — mark RDKit descriptors as production, toxicity/ADMET as rule-based heuristic
fe8fda4 -
fix: wrap all Fragments.fr_* calls in safe _fg() wrapper
b3640c4
-
fix: mol_volume fallback referenced labute_asa before definition
aec45b0 -
fix: MolVolume with triple fallback (CalcMolecularVolume -> Descriptors3D -> ASA estimate)
e4295b1