Earlier this semester I had a project where I had to calculate the solvent-accessible surface area of a protein given its 3-dimensional structure (in a PDB file). The suggested method of implementation was to simulate the surface of each atom by distributing 500 points (roughly) evenly across the surface defined by its van der Waals radius. Although that sounds straightforward, it actually took me a while to figure out how to randomly sample points from a sphere defined by a point and a radius.
I did some extensive searching on Google, but most of the methods I found came with the caveat that there would be a greater concentration of points near the poles than at the equator. I finally came across this page, which offered a clear and concise method for sampling points from a sphere.
- Set up a 2-dimensional coordinate system: the z dimension (running from -R to R, where R is the van der Waals radius) and (longitude, running from 0 to radians)
- Generate random coordinates: and
- Use the following relation () to calculate latitude ():
- Finally, convert to Cartesian (xyz) coordinates
Repeat this process 500 times for each atom to simulate its surface!
I’m taking a structural informatics course this semester, and this is my first in-depth exposure to working with biomolecular structures. The class’ first assignment was to download a specific PDB file, parse the atom coordinates, and determine all sorts of bond lengths, bond angles, and torsion angles. This required me to review concepts I haven’t used much since linear algebra and multivariable calculus, but all in all this part wasn’t too hard.
The last part of the assignment was a kicker though. I had to select the 30th residue in the protein, set two of its dihredral angles to 0º (effectively rotating the remaining portion of the structure along bonds between backbone atoms), and recompute the new atomic coordinates. I had no idea where to start!
One of the other student’s in the class mentioned Rodrigues’ rotation formula, and after looking into things, it seemed to be the answer to our question. In a general sense, if you want to rotate given a vector by an angle of degrees about an axis of rotation defined by the vector , then the new rotated vector can be computed as follows.
In the context of the homework assignment, is the bond around which I’m rotating (N-CA for , CA-C for ), is the angle I need to set to 0 ( or ), and the rotation is applied to the coordinate vector for each subsequent atom affected by the rotation.
Burset and Guigó published a foundational paper on evaluating gene annotations in 1996. A lot of my work as a graduate student has involved writing software for comparing multiple sets of gene structure annotations against each other, and I’ve used the statistics described in this paper (matching coefficient, correlation coefficient, sensitivity, specificity) as the basis for my comparisons. However, there is another statistic (called the F1 score) that is (apparently) used commonly for analyzing gene annotations, and someone recently recommended that I should include this statistic in my comparisons. Never having heard of it, I decided to investigate.
I found several papers that referenced the F1 score (none of them were related to gene structure annotation, by the way) and was able to eventually track down the origin of the statistic. It was introduced by van Rijsbergen in 1979 in a text on information retrieval and has since found application in a variety of fields. The F1 score combines two other commonly used statistics: the precision (defined as the ratio of true positives to all predicted positives) and the recall (defined as the ratio of true positives to all actual positives).
With precision defined as
and recall defined as
we now define the F1 score as follows.
After 15 minutes of searching, 10 minutes of reading, and 5 minutes of coding, my software now has a new feature!
I was exposed briefly to Hidden Markov Models (HMMs) as an undergraduate, but now as a graduate student I have revisited HMMs in much more detail (I need to know it “forward” and “backward”, if you catch my drift). Our instructor taught us with very simple examples (two hidden states, very short sequences) and in each case, the notation he used was specific to each example. This made it easy to grasp the concepts initially, but I’m not sure I would have been able to implement more complicated HMMs with only that notation to help me. In preparing for a recent exam, however, I’ve finally come across some notation that is more generalizable. I’ll use it here to describe the forward, backward, and Viterbi algorithms.
First let us provide some formal definitions. We have an observed sequence where for all . For each , there is an unobserved state forming the corresponding hidden state sequence . Additionally we define initial state probabilities (where is the probability of starting a sequence in state ), transition probabilities (where is the probability of moving from state to state ), and emission (or output) probabilities (where is the probability of observing the symbol given that we know the corresponding hidden state is ).
The forward algorithm provides the most straightforward way to determine the probability of an observed sequence given the HMM (i.e. ). This algorithm introduces a probability , which we can conceptualize as an matrix. We initialize the first column of this matrix like so.
We can then continue to fill out the rest of the matrix using the following recurrence.
Once the matrix is filled out, we can get our desired probability by summing over the values in the last column of the matrix.
The backward algorithm can also be used to find the probability of an observed sequence, but it is most useful in combination with the forward algorithm to determine the probability of a state at a specific position given an output sequence.
The backward algorithm introduces a probability , which we can also conceptualize as an matrix. We first initialize the last column of the matrix like so.
Then, as the algorithm’s name suggests, we work backwards to fill out the rest of the matrix using the following recurrence.
The Viterbi algorithm is a slight variation of the forward algorithm that answers a slightly different question: what is the most probable hidden state sequence given an observed sequence (in formal terms, which hidden state sequence maximizes the probability )?
Here we introduce another probability which we can conceptualize as an matrix.
We initialize this matrix exactly the same way we do in the forward algorithm.
We then continue to fill out the rest of the matrix using the following recurrence.
We also maintain a matrix of pointers where indicates the value of k which maximizes (used for backtracing). To find the most probable hidden state sequence, identify the highest value in the last column of the matrix (or ) and use the matrix of pointers to trace backward and identify the sequence of states that produced the maximal probability.