flowchart TD
A["🔬 Input Query Sequence"] --> B["Break Query into K-mer Words"]
B --> C["Search Database for Exact K-mer Matches"]
C --> D{"Seed Hits Found?"}
D -- "No" --> E["No Significant Matches"]
D -- "Yes" --> F["Extend Seed Match Left"]
F --> G["Extend Seed Match Right"]
G --> H{"Score Above\nDropoff Threshold?"}
H -- "No" --> I["Discard Low-Scoring Extension"]
H -- "Yes" --> J["Generate High-Scoring\nSegment Pair (HSP)"]
J --> K["Calculate E-value\nfor Each HSP"]
K --> L{"E-value Below\nSignificance Cutoff?"}
L -- "No" --> M["Filter Out\nNon-Significant Hits"]
L -- "Yes" --> N["Rank Results\nby E-value"]
N --> O["🧬 Return BLAST Results"]
classDef seeding fill:#4FC3F7,stroke:#0277BD,color:#01579B,stroke-width:2px
classDef extension fill:#AED581,stroke:#33691E,color:#1B5E20,stroke-width:2px
classDef evaluation fill:#FFB74D,stroke:#E65100,color:#BF360C,stroke-width:2px
classDef decision fill:#CE93D8,stroke:#6A1B9A,color:#4A148C,stroke-width:2px
classDef discard fill:#EF9A9A,stroke:#B71C1C,color:#B71C1C,stroke-width:2px
classDef result fill:#80CBC4,stroke:#004D40,color:#004D40,stroke-width:2px
class A,B,C seeding
class F,G,J extension
class K,N evaluation
class D,H,L decision
class E,I,M discard
class O result