Hi,
Thanks for using the REDUCE Suite and for posting your question(s) on the Forum.
The concept of affinity in the REDUCE Suite is simple, but technical. As is often the case, the idea can be best illustrated with a concrete example.
Let's suppose we have a PSAM (sample-psam.xml) as shown below:
<matrix_reduce>
<directionality>forward</directionality>
<psam_length>6</psam_length>
<psam>
# A C G T
# +============+============+============+=======
1 0.25 0.1 0.1 #1
0.1 0.5 0.2 1 #2
0.1 1 0.1 0.1 #3
1 0.1 0.6 0.1 #4
0.2 0.6 1 0.1 #5
0.1 0.1 1 0.3 #6
</psam>
</matrix_reduce>
And a short base sequence (sample-seq.txt) as below:
>sample
GTCATGGT
Since the PSAM has a length of 6, and the single sequence has 8 bases, there are three sliding windows, as detailed below:
w1: GTCATG --- affinity of w1: 0.1 * 1 * 1 * 0.1 * 1 * 1 = 0.01
w2: TCATGG --- affinity of w2: 0.1 * 0.5 * 0.1 * 0.1 * 1 * 1 = 0.0005
w3: CATGGT --- affinity of w3: 0.2 * 0.1 * 0.1 * 0.6 * 1 * 0.3 = 0.00045
---- sum of affinity = 0.01095
If you run:
AffinityProfile -seq=sample-seq.txt -psam=sample-psam.xml
you will find the following content in the default output file seq_psam.dat:
sample-psam.xml
sample 0.01095
There are quite a few variations for the calculation of affinity in AffinityProfile, but the above example covers the essence. Since the REDUCE Suite is open source, you can and are encouraged to dive into the details.
Hope this helps,
Xiang-Jun