Skip to main content

    Validation & QA

    Preflight Biotite inputs — FASTA headers, non-empty sequences, valid residue codes — then record counts, skipped files and RMSD stats in a SUMMARY.json.

    Validation lets you catch bad inputs before a run and record a QA summary afterward — preflighting sequences and structures, checking headers and residue codes, and capturing counts and RMSD statistics. Deciding what to skip versus fail fast on is what most affects whether a batch degrades gracefully or corrupts its outputs.

    Where this code runs

    You cannot open a shell on the platform yourself. The scripts on this page are plain Biotite Python and shell: ask Ivy in chat to run them in the chat's code workspace, which ships Biotite, or run them on your own machine.

    Preflight checks

    python - <<'PY'
    from biotite.sequence.io import load_sequence
    from biotite.structure.io import load_structure
    from pathlib import Path
    
    def validate_seq(path: Path) -> bool:
        try:
            load_sequence(str(path), format=None)
            return True
        except Exception:
            return False
    
    def validate_struct(path: Path) -> bool:
        try:
            load_structure(str(path))
            return True
        except Exception:
            return False
    
    seq_ok = [p for p in Path("inputs/sequences").glob("*.fasta") if validate_seq(p)]
    struct_ok = [p for p in Path("inputs/structures").glob("*.pdb") if validate_struct(p)]
    
    print("Sequences OK:", len(seq_ok))
    print("Structures OK:", len(struct_ok))
    PY

    QA summary JSON

    import json
    from pathlib import Path
    
    summary = {
        "biotite_version": "auto",
        "inputs": {
            "sequences": len(list(Path("inputs/sequences").glob("*.fasta"))),
            "structures": len(list(Path("inputs/structures").glob("*.pdb"))),
        },
        "outputs_dir": "outputs/run-latest",
    }
    
    Path("outputs").mkdir(exist_ok=True)
    with open("outputs/SUMMARY.json", "w", encoding="utf-8") as handle:
        json.dump(summary, handle, indent=2)

    Checks to include

    • Verify FASTA headers and non-empty sequences.
    • Ensure residue codes are valid before alignment/superposition.
    • Record skipped files with reasons; fail fast on corrupted archives.
    • Capture RMSD/length statistics in the summary for spot checks.

    Was this page helpful?

    On this page

    On this page

    Loading...