# custom value transformation function [closed]

Background: Blast is a (famous) tool for finding high scoring local alignments between sequences. It allows you to set a search parameter that controls the statistical significance of each (similar) sequence in the result. If you set t in the E-value field, it will report only the sequances with e-values lower than t and deem anything else "insignificant match".

Question: I'm looking for a way (a function) to transform the resulting e-values to values from in the following set: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1] that also make use of the search parameter t as the zero of that function; and the closer to t values are, the closer they get to 0; and the furthur away from t, the closer they get to 1.

A suggested function is
$$p(x_i) = \frac{1}{\log_{}{E_i}}$$where x_i is the ith sequance, and E_i is its e-value. However, this function makes no use of the original threshold, and it produces negative values, and values greater than 1!

values greater than 1 (in the suggested function) make sense (strong statistical significance of a sequence similarity score) and they will always be mapped to 1 (in the transformation function); on the other hand, negative values produced by the suggested function should not be mapped to 0.

Any suggestion?!

• What are possible values for E? – S. Kolassa - Reinstate Monica Dec 27 '17 at 20:22
• E can be any vale less than 0.01; for example some actual values of E I'm getting are (in order from best to worst): 6e-178, 1e-177, 3e-176, 3e-88, 9e-49, 8e-24, 2e-08, 1e-07 – 7kemZmani Dec 27 '17 at 22:13
• could anyone explain which part is "unclear"?! – 7kemZmani Dec 28 '17 at 16:39
• It's clearer now, given the comment. I forgot to retract my closure vote, and have nominated this for reopening. – S. Kolassa - Reinstate Monica Dec 28 '17 at 16:40

If your threshold is $t$, you can use

$$p(x) = -\log t\bigg(\frac{1}{\log x}-\frac{1}{\log t}\bigg)$$

and round to one decimal if you want to.

tt <- 0.01
pp <- function(xx) -log(tt)*(1/log(xx)-1/log(tt))
xx <- seq(0,tt,by=.0001)
plot(xx,pp(xx),type="l",xlab="x",ylab=p(x))
lines(xx,round(pp(xx),1),type="l",col="red") 