Conversation
|
I think the project has a nice start but it can and should be greatly simplified. Remember, it is an exploratory exercise, not an attempt to generate a realistic protein folder! I would just use a simple ball-and-stick model, where the AAs are at the joints and the distances between them are fixed and constant. So, your optimization only works on the angles between these. Furthermore, the user can give a list of charges (positive vs negative vs neutral) as a way of building your chain (I don't know by heart the charges of the amino acids anymore). I like the electrostatic and van der Waals forces, keep them, though you can abstract away the constants. So, I would allow a peptide to be defined from "0++-0-++" as a string with charged and neutral residues. Your code is not very efficient, because the compiler cannot guess the type of your arrays in e.g. While mentally going through the code, I don't immediately see the best way of going from the angles to the loss in a way that is differentiable and generic. My (strong) recommendation is doing it by hand for an example of 5 point charges (or so). Otherwise, you might need to use metaprogramming. Here is how I would do it for three points: function distances((a1, a2),l=1) # fixed length and two angles
x0, y0 = 0.0, 0.0
x1, y1 = x0 + l * cos(a1), y0 + l * sin(a1)
x2, y2 = x1 + l * cos(a2), y1 + l * sin(a2)
# compute energie based on the pairwise distances
endIt will be blazingly fast so. |
|
Thanks for your feedback. I found an alternative for the differentiation of the loss function by using Zygote.Buffer() to allow mutation of the distance matrix. function distances_θ(θ::Vector{Float64};l=1)
n=length(θ)
x=Zygote.Buffer(zeros(n))
y=Zygote.Buffer(zeros(n))
distance=Zygote.Buffer(zeros(n,n))
x[1],y[1]=0.0, 0.0
n=length(θ)
for i in 2:n
x[i],y[i]=x[i-1] + l * cos(θ[i-1]),y[i-1] + l * sin(θ[i-1])
end
for i in 1:n
for j in i+1:n
distance[i,j]=sqrt((x[i]-x[j])^2+(y[i]-y[j])^2)
end
end
return copy(distance)
end |
New version of PeptFold2D using bond angle based structures and (meta)heuristic based optimization
|
Thanks @Jordiverbruggen, I've adapted the notebook accordingly. |

No description provided.