Author Topic: Affinity score calculation  (Read 38188 times)

kubranarci

  • with posts
  • *
  • Posts: 1
    • View Profile
Affinity score calculation
« on: January 05, 2017, 02:55:20 am »
Hi!

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

thanks!

xiangjun

  • Administrator
  • with posts
  • *****
  • Posts: 42
    • View Profile
Re: Affinity score calculation
« Reply #1 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]
>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:

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

« Last Edit: January 05, 2017, 05:34:49 pm by xiangjun »

JonathanCan

  • with posts
  • *
  • Posts: 1
    • View Profile
Re: Affinity score calculation
« Reply #2 on: September 11, 2017, 02:29:30 am »
Hi!

Can you explain how D-Bal works is calculated (in what range)?

thanks!

Thanks for explaining Xiang-Jun!
« Last Edit: September 22, 2021, 08:32:10 am by JonathanCan »

 

Created and maintained by Dr. Xiang-Jun Lu [律祥俊]. See also http://forum.x3dna.org and http://x3dna.org