DNA Tool

This is a tool I wrote to search for a sequence of nucleotides inside a DNA sequence. To use the tool click the following link:

Proceed to the DNA Tool


This tool uses the following terminology: The sequence you are searching for is called the needle and the larger sequence that you are looking inside is called the haystack.

The main interface has two text inputs: It has an input labelled needle and an input labelled haystack. Simply copy/paste the larger DNA sequence into the haystack, and the sequence you are searching for into the input labelled needle and click 'search' to perform the search.

Once you have submitted your search, you will see the results on the screen. The haystack will be displayed, and all occurrences of the needle will be highlighted.

Advanced Usage

This program supports many different types of searches:

  • You can search for a specific sequence of nucleotides by typing in the exact sequence, for example to search for occurences of CAAAG simply type CAAAG in the needle box.
  • You can search for alternative bases which occur in a specific position within the needle sequence by using square brackets. CAAA[TG] will search for CAAA followed by either T or G, and will find all occurrences of CAAAT and CAAAG in the haystack.
  • You can search for any base at a position in the needle sequence by typing a '.' (full stop). CAAA. will search for CAAA followed by any base, and will match CAAAA, CAAAT, CAAAC and CAAAG. This is equivalent to searching for CAAA[ATCG].

Regular Expressions

If you are familiar with regular expressions the pattern matching in the previous section will seem very familiar to you! This is because this tool uses regular expressions to perform its searches.

Regular expressions are very powerful, and it is way beyond the scope of this page to give a full description of them here! A great introduction to regular expressions can be found here: Regular Expressions Tutorial. For a full description of the regular expression syntax go here: Perl Regular Expressions (the regular expressions used by this tool are compatible with perl regular expressions).


If you just want to play with the tool and see how it works, click the following link to load up an example. The tool will be preloaded with a DNA sequence and search pattern - you can modify it by scrolling up and editting the text, and pressing search again to see the results.

Click here for an example


WARNING: This tool is still in development and there may still be a few bugs. If you spot anything that is broken or have any ideas about how to improve this tool, or have any questions at all about how to use this you can contact me here: Contact Me.