In a sequence, one can also identify patterns of sequence, such as DNA binding sites or promotor sequences.
Here, with the help of two examples we will show the importance of pattern matching in analysis.
Step 1: Download promotor sequences, 1 kb upstream of the gene, for 102 NF-kappaB target genes (List of 102 NFkappaB targets) using BioMart
Step 2: Check GO terms for these genes
Step 3: Predict the consensus binding site of NF-kappaB (GGGNNNNNCC) in the promotors, on both strands, using the EMBOSS tool fuzznuc via the web-interface or via the commandline:
fuzznuc -sequence NFkappaB-targets-1000bp-up.fasta -rformat gff -outfile NFkappaB-targets-1000bp-up.fasta.gff -pmismatchs 0 -pattern GGGNNNNNCC -complement
Step 4: Calculate the total predicted sites
cat NFkappaB-targets-1000bp-up.fasta.gff | grep -v '#' | wc -l
Step 5: How many are expected by chance? Use 1 sequence randomizations (step 6)
Step 6: Randomize the sequences using the EMBOSS tool shuffleseq via the web-interface or the commandline. How many are predicted now?
Now let's see what happens when we randomize 1000 times.
Hints and tricks:
To make 1000 randomizations and use fuzznuc on each:
for ((i=0;i<1000;i++));do shuffleseq -sequence NFkappaB-targets-1000bp-up.fasta -outseq NFkappaB-targets-1000bp-up-shuffled-$i.fasta ;echo $i;done
for ((i=0;i<1000;i++));do fuzznuc -sequence NFkappaB-targets-1000bp-up-shuffled-$i.fasta -rformat gff -outfile NFkappaB-targets-1000bp-up-shuffled-$i.fasta.gff -mismatch 0 -pattern GGGNNNNNCC -complement ;echo $i;done
for ((i=0;i<1000;i++));do cat NFkappaB-targets-1000bp-up-shuffled-$i.fasta.gff | grep -v '##' | wc -l;done > results-shuffledSeq.txt

1000 Randomizations
The mean number of predicted sites is 253.3 with a standard deviation of 20.7.
We can calculate the z-score (477-253.3)/20.7 = 10.8
z>1.96 is significant (corresponds with p<0.05)
So, here we can say our finding of 477 predicted sites is significant (more than by chance).
Step 7: Randomize the motif (GGGNNNNNCC). How many are predicted now?
Step 8: One can also use Toucan (https://gbiomed.kuleuven.be/english/research/50000622/lcb/tools/toucan) to detect transcription factor binding sites. Load the sequences from step 1 (File -> Load Seq (Fasta)) and predict motifs (Motifs -> Consensus Match)

Predict transcription factor binding sites with Toucan
Hints and tricks:

IUPAC codes for nucleotides
For pattern notation of proteins, one must use the one-letter code for each protein. Each code can be seperated by a '-'.
xis used for any possible amino acid
x(3,5) means at least 3 and at most 5 amino acids of any type can occur
[VIM] means that any one, but only one at a time, of these three amino acids can occur
x(2) two amino acids of any type may occur
{WC} all amino acids except W and C can occur
For example, zinc fingers are small structural motifs, which encode for a zinc finger protein within a protein. Zinc fingers stabilize themselves by binding one or more zinc ions. Different types of zinc fingers exist based on their domain composition. Here, we will determine how many C2H2 zinc fingers does the human protein CTCF have.
C2H2 zinc finger domain: C-x(2,4)-C-x(3)-[LIVMFYWC]-x(8)-H-x(3,5)-H

Zinc finger domain motif
fuzzpro -sequence CTCF.fasta -mismatch 0 -outfile CTCF-zincfinger.gff -rformat gff -pattern "C-x(2,4)Cx(3)[LIVMFYWC]x(8)Hx(3,5)H"
cat CTCF-zincfinger.gff | grep -v '##'| wc -l