Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protein Mutation Impact API

This API uses ESM-2, a state-of-the-art transformer model trained on millions of protein sequences, to predict how much a mutation "changes" a protein's biological representation. It is designed to help researchers quickly screen the impact of amino acid substitutions.


🧬 How It Works

When you send a protein sequence to this API, it doesn't just look at the letters; it understands the "context" of the amino acids.

  1. Embedding: The model converts the protein sequence into a high-dimensional numerical map (an embedding).
  2. Comparison: It compares the map of your Wild Type (original) protein to the map of your Mutant protein.
  3. Impact Score: It calculates the "distance" between these two maps. A higher score suggests a more significant structural or functional change.

🚀 Setup & Installation

1. Prerequisites

You will need Python 3.9 or higher.

2. Install Dependencies

pip install fastapi uvicorn torch transformers numpy

3. Launch the API

Save the code as main.py and run:

uvicorn main:app --port 8000

🛠 Usage Guide

The API has one main endpoint: /api/cosine-impact-batch. It is built to handle multiple mutants at once for faster processing.

Testing with curl

You can test the API directly from your terminal using the following command:

curl -X POST "http://localhost:8000/api/cosine-impact-batch" \
     -H "Content-Type: application/json" \
     -d '{
           "wild_seq": "MQIFVKTLTGKTITLEVE",
           "mutant_seqs": [
             "MQIFVKTLTGKTITLEVA",
             "MQIFVKTLTGKTITLEVW"
           ]
         }'

The Response

The API returns an array showing each mutant and its calculated "Impact" score:

[
  {
    "mutant": "MQIFVKTLTGKTITLEVA",
    "impact": 0.1245
  },
  {
    "mutant": "MQIFVKTLTGKTITLEVW",
    "impact": 0.4892
  }
]

🧪 Quick Interpretation

  • Low Impact (e.g., < 0.15): The mutation is likely "conservative." The new amino acid has similar properties to the old one.
  • High Impact (e.g., > 0.40): The mutation is "radical." Replacing a small amino acid with a bulky or charged one often results in a higher score, indicating a potentially significant functional shift. The highest score is expected by changing the first amino acid, which is usually Methionine(M), to another amino acid.

⚙️ Technical Specs

  • Model: ESM-2 (8M parameters) — Light enough to run on a standard CPU.
  • Framework: FastAPI and PyTorch.
  • CORS: Pre-configured for local development and Vercel deployments.

About

API server to calculate functional impact of an amino acid level mutation of a protein.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages