Sequence Cleaner

DNA Sequence Cleaner

Clean and normalize a DNA sequence.

Before: 0 charsAfter: 0 chars

Description

The sequence cleaner removes unwanted characters from a DNA sequence — such as whitespace, numbers, FASTA headers, and non-standard bases — and optionally converts it to uppercase. Useful for preparing sequences for downstream analysis.

How to use

Paste a raw DNA sequence into the input field. Toggle the cleaning options as needed. The cleaned sequence is generated instantly. Use the copy button to copy the result.

Learn more

What it does

The DNA sequence cleaner normalizes a raw sequence by removing FASTA header lines, digits, whitespace and non-ACGT characters, and optionally converting everything to uppercase. Each cleaning step is a separate toggle, and the character count before and after is shown so you can see exactly how much was stripped. It exists because sequences copied from GenBank records, papers, supplier reports or spreadsheets almost never arrive as a clean contiguous string.

How it works

Cleaning is rule-based text normalization rather than biology: lines beginning with the greater-than character are treated as FASTA headers and dropped, digits are removed, all whitespace including line breaks is collapsed away, and with the strict option any character outside A, C, G and T is deleted. Order matters conceptually, because header removal must happen line by line before whitespace is discarded, otherwise the header text would merge into the sequence. The important caveat is that removing non-ACGT characters also deletes legitimate IUPAC ambiguity codes such as N, R and Y, which shortens the sequence and shifts every downstream coordinate; if positions matter, keep those codes and use a tool that tolerates them.

Worked example

A GenBank-style block such as a header line reading greater-than sign followed by gi 12345 sample, then the numbered lines 1 atgcg gtcac and 11 ttagc, collapses to the single string ATGCGGTCACTTAGC, 15 bases long. The header line, the position numbers 1 and 11, the internal spaces and the line breaks are all discarded, and the lowercase input is folded to uppercase. Anything that survives is a real base, so the after count of 15 is the true sequence length.

When to use it

Before running a Tm, ORF or GC calculation, clean sequence that came out of a PDF or a GenBank ORIGIN block, where line numbers and spaces would otherwise be counted as characters and shift codon positions. When a collaborator sends a multi-line FASTA record inside an email body, cleaning gives you the contiguous string needed to paste into an ordering form or an alignment tool. When a Sanger read arrives with trailing Ns and stray quality symbols, use the strict non-ACGT option to keep only unambiguous bases, remembering that this changes the numbering.

FAQ

How do I remove numbers and spaces from a DNA sequence?
Paste the raw text and enable the remove numbers and remove whitespace options; digits, spaces, tabs and line breaks are stripped and the remaining bases are joined into one continuous string. This is the usual fix for sequence copied from a GenBank ORIGIN block or a printed figure, where every line carries a position number.
Will cleaning remove N and other ambiguity codes?
Only if you enable the remove non-ACGT option, which deletes every character outside A, C, G and T, including N, R, Y and gap dashes. Because deletion shortens the sequence, any coordinate you recorded earlier will no longer line up; if you need to preserve positions, leave that option off or replace ambiguous bases rather than removing them.
Can I clean a multi-FASTA file with several sequences?
The header removal option drops every line that starts with the greater-than character, so a file with several records will have all its headers removed and the remaining bases concatenated into one continuous sequence. That is fine for a single record but will silently fuse multiple records, so split a multi-FASTA file into individual sequences before cleaning.
Why did my sequence length change after cleaning?
Because the characters that were removed were being counted as part of the string. The before and after counts tell you exactly how many characters went away, and a large drop usually means line numbers, spaces or ambiguity codes were present. If the after count is what you expected from the construct, the original string was padded rather than the sequence being wrong.