Codon Usage Fraction Calculator for Gene Codon Counts
The codon usage fraction calculator measures how much one codon contributes to all observed codons that encode the same amino acid within a gene.
Run — free
Supply codon counts and choose a target codon; the result shows its normalized fraction, percentage, amino acid, and the complete synonymous group used as the denominator. DNA and RNA notation are accepted, duplicate rows are combined, and missing synonymous codons count as zero. This makes a focused codon-bias summary easy to reproduce without a spreadsheet or a hand-maintained genetic-code table.
What the codon usage fraction means
Amino acids are often encoded by more than one codon. The usage fraction asks a narrow, useful question: among the codons observed for one amino acid in this gene, what share uses the selected codon? If a gene contains 18 TTT observations and 12 TTC observations, both encoding phenylalanine, the TTT fraction is 18 divided by 30, or 0.6. The calculation is local to the amino acid rather than to every codon in the gene. That distinction makes the value suitable for describing synonymous preference, because unrelated amino-acid composition does not change the denominator. A fraction near one indicates that the selected codon dominates its synonymous group in the supplied gene, while a fraction near zero indicates rare or absent use. This value summarizes observed composition; it does not by itself establish selection, expression efficiency, or statistical significance. Those interpretations require an appropriate reference set and biological context. Use counts derived from a consistent reading frame and the same gene definition so that the comparison remains meaningful.
How to prepare and interpret the input
Enter each observed codon with its non-negative integer count, then identify the target codon. Both DNA letters such as TTT and RNA letters such as UUU are accepted; RNA U is normalized to DNA T in the output. Letter case and surrounding whitespace do not matter. When the same normalized codon appears more than once, its counts are added, which is helpful when data came from separate regions or batches. You do not need to list every synonymous codon. Any synonymous codon omitted from the input is shown with a zero count and still appears in the result, making the denominator transparent. Counts for codons encoding other amino acids are valid input but do not affect the selected fraction. The calculator uses the standard genetic code and rejects a stop codon as the target because a stop signal is not an amino acid. It also rejects a synonymous group whose supplied total is zero, since division by zero would not describe usage. Review the returned synonymous list before comparing genes to confirm that the intended codon family was used.
Using the result in codon-bias workflows
The returned usage_fraction is between zero and one, and percentage expresses the same value on a zero-to-one-hundred scale. The target count and synonymous total are returned alongside the fraction so downstream analyses can preserve the evidence behind the ratio. This matters because identical fractions can have very different support: one out of two observations and five hundred out of one thousand observations both equal 0.5, but they should not automatically receive the same confidence. For exploratory work, calculate the fraction for each synonymous codon and compare patterns across genes, conditions, organisms, or designed sequences. Keep genetic-code assumptions, annotation versions, and counting rules consistent across the comparison. The output can also support quality checks: fractions for all codons in a synonymous family should sum to one when computed from the same counts. The API price is $0.002 per request, while the browser version can perform the same deterministic calculation locally. No network lookup, random sampling, background database, or changing reference frequency is involved, so the same valid input always produces the same result.
What you can do with it
Summarize one gene
Measure whether a selected synonymous codon dominates or is rarely used within a gene.
Compare gene designs
Calculate matching codon fractions for native and redesigned coding sequences using the same counting rules.
Audit a codon-count table
Expose the synonymous denominator and zero-filled family members before a broader codon-bias analysis.
FAQ
What is the formula?
The selected codon's count is divided by the sum of counts for every codon that encodes the same amino acid under the standard genetic code.
Can I enter RNA codons?
Yes. U is normalized to T, so UUU and TTT are treated as the same codon.
What happens when a synonymous codon is missing?
It is assigned a count of zero. The output lists the complete synonymous family used for the calculation.
Are duplicate codon rows allowed?
Yes. Duplicate codons are normalized and their non-negative integer counts are combined.
Can the target be a stop codon?
No. The metric is defined for a codon and its amino acid, so stop codons are rejected as targets.
Does a high fraction prove optimal expression?
No. It describes usage in the supplied counts only; expression and adaptation claims require reference data and biological context.
What does the API request cost?
The API price is $0.002 per request. The page can also run the deterministic calculation locally in the browser.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/bio/codon-usage-fraction \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"codon_counts":[{"codon":"TTT","count":18},{"codon":"TTC","count":12},{"codon":"ATG","count":7}],"target_codon":"TTT"}'const res = await fetch("https://api.kit.forhosting.com/bio/codon-usage-fraction", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"codon_counts": [
{
"codon": "TTT",
"count": 18
},
{
"codon": "TTC",
"count": 12
},
{
"codon": "ATG",
"count": 7
}
],
"target_codon": "TTT"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/bio/codon-usage-fraction",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"codon_counts": [
{
"codon": "TTT",
"count": 18
},
{
"codon": "TTC",
"count": 12
},
{
"codon": "ATG",
"count": 7
}
],
"target_codon": "TTT"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/bio/codon-usage-fraction", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"codon_counts":[{"codon":"TTT","count":18},{"codon":"TTC","count":12},{"codon":"ATG","count":7}],"target_codon":"TTT"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"codon_counts":[{"codon":"TTT","count":18},{"codon":"TTC","count":12},{"codon":"ATG","count":7}],"target_codon":"TTT"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/bio/codon-usage-fraction", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"codon_counts": [
{
"codon": "TTT",
"count": 18
},
{
"codon": "TTC",
"count": 12
},
{
"codon": "ATG",
"count": 7
}
],
"target_codon": "TTT"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "bio.codon_usage_fraction",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_items | 64 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |