# REDUCE Suite

## General Category => General Discussion => Topic started by: kubranarci on January 05, 2017, 02:55:20 am

Title: Affinity score calculation
Post by: kubranarci on January 05, 2017, 02:55:20 am
Hi!

Can you explain how the the result of AffinityProbe is calculated (in what range)?

thanks!
Title: Re: Affinity score calculation
Post by: xiangjun on January 05, 2017, 01:30:05 pm
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:

Code: [Select]
`<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:

Code: [Select]
`>sampleGTCATGGT`
Since the PSAM has a length of 6, and the single sequence has 8 bases, there are three sliding windows, as detailed below:

Code: [Select]
`w1: GTCATG      --- affinity of w1: 0.1 * 1 * 1 * 0.1 * 1 * 1 = 0.01w2:   TCATGG    --- affinity of w2: 0.1 * 0.5 * 0.1 * 0.1 * 1 * 1 = 0.0005w3:     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:
Code: [Select]
`AffinityProfile -seq=sample-seq.txt -psam=sample-psam.xml`
you will find the following content in the default output file seq_psam.dat:
Code: [Select]
`        sample-psam.xmlsample  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

Title: Re: Affinity score calculation
Post by: JonathanCan on September 11, 2017, 02:29:30 am
Hi!

Can you explain how the of AffinityProbe is calculated (in what range)?

thanks!

Thanks for explaining Xiang-Jun!