## Prerequisites

This tutorial assumes that you already learned the theory in the following chapters.

Chapter Slides
Transcriptional regulation - basic concepts 01.2_regulatory_sequences_intro.pdf
Position-specific scoring matrices 01.4.PSSM_theory.pdf

## Tools used in this tutorial

Tool Usage
RSAT convert-matrix Convert matrix between different formats
+derive various statistics from a count matrix
+generate sequence logos

## Exercise - From count matrices to weight matrices

Before using computer tools, we will start with an easy exercise on an artificial dataset, in order to get the principles of the procedure enabling to build position-specific scoring matrices from aligned binding sites.

Let us assume that we dispose of a collection of 4 binding sites for a given transcription factor, collected by individual footprint experiments.

 AAAAACCG
AAAACCGG
AATTGGGG
ATTGTGGG


Note: the example is intently minimalist for this exercise. In practice, you should not even try to build matrices with such a poor collecting of bona fide binding sites.

Open an empty spreadsheet in Excel or LibreOffice.

1. Build a position-specific scoring matrix indicating the residue counts per position (count matrix).
2. From this count matrix, derive a frequency matrix.
3. Compute a pseudo-weight smoothed frequency matrix, with pseudo-wsights of 1, 10 and 100, respectively.
4. Compute the weight matrices corresponding to the frequency matrices with no pseudo-weight, assuming equiprobable residues.
5. Do the same with the pseudo-weight=1.
6. Compute the weight matrices with a pseudo-weight=1 and the following prior probabilities: A=0.3, T=0.3, C=0.2, G=0.2.
7. Add a comment on the spreadsheet with your interpretation of the results.

### Solutions for the exercise

You can now check the solution in various formats:

## Tutorial - matrix conversion

1. Open a connection to the Regulatory Sequence Analysis Tools teaching server (http://teaching.rsat.eu/).
2. In the left-side menu, open the tool set Matrix tools, and click on convert-matrix.
3. Paste the count matrix from previous exercise1 in the Matrix box, and check that the input format is set to tab.
4. Set the pseudo-weights to 1, and check the option distributed in an equiprobable way.
5. Download on your computer the background frequency file with equal prior probabilities: prior_equal.tab.
6. Under Background model estimation, check the option Upload your own background file, select format oligo-analysis, click on the “Choose file” button, and locate your local copy of the file prior_equal.tab.
7. For the Output format, select tab.
8. Check the following Output fields: counts, frequencies, weights, info, header, margins, consensus, parameters, logo with error bars and small sample corrections.
9. Set the decimals to 2.
10. CLick GO.
11. Com back to the form, modify the pseudo weight, and check the effect on the sequence logo.
12. Repeat steps 5 to 10 with unequal priors from the file prior_unequal.tab.
13. Check that you obtain the same results as with your manual computations in the previous exercises.

### Exercise: impact of the pseudo-weight

Play around with the matrix conversion tool by progressively increasing the pseudo-weight (this exercise should be done with the unequal prior file as background).

1. What is the effect of this parameter on the frequency matrix and the weight matrix, respectively?
2. What happens when the pseudo-weights tends towards infinity (try with a sufficiently large value, e.g. 10000)?

1. The count matrix can also be found here: fake_matrix.tab