Sunday, July 5, 2015

False Discovery Rate ( a.k.a, FDR)



Terminology
FDR: False Discovery Rate
PSM: Peptide Spectrum Match(a.k.a.,a hit)
PIT: Percentage of Incorrect Targets

In the past years, a number of statistical tools and strategies have been developed to assess the error rate of peptide-spectrum matches(e.g., FDR calculations, Percolator, PeptideProphet, FDRAnalysis).In particular, the use of decoy databases is a simple yet powerful approach to estimate the false discovery rate (FDR) at the peptide identification level. Inprinciple,FDR estimations should allow us to make a direct comparison of peptide identification results from different laboratories in this study. Despite its widespread use in proteomics experiments, PSM FDR has not been fully standardized yet. In what follows I will discuss the different strategies to calculate FDR and scoring systems commonly employed. I also provide some basic information of FDR calculation for newbies.

P- vs Q- vs PEP-values in Mass Spec Database Search

We often see both P and Q-values in literature and search results by mass spec software, but how many of us actually know how these numbers are generated?  OK, you may say you know that P-value is probability. But what does this really mean? Can you explain?

For peptide spectra matching (PSM), let’s say you have an experimental MS/MS spectra X with 60 peaks and a theoretical MS/MS spectra Y (derived from protein database sequences) with 32 peaks. If 23 peaks match between these two spectrum, how likely does this kind of situation occur by chance?
Actually, this is not enough to calculate the probability of such an event. Because you need to know how many possible positions in the spectra. To be simple, let’ think about this scenario.  Spectra X’s peaks range from 350 to 700, whereas spectra Y ranges from 400 to 850. You have an overlap between 400 to 700 in m/z. If you have mass tolerance of 0.5m/z, you divide this range by 0.5 which is (700-400)/0.5=600.  This number is the number of bins or positions you have in the overlapping range.
spectra_match

Calculate Possible Occasions for Experimental MS/MS

The likelihood to have 23 peaks match from spectra X (60 peaks) and spectra Y (32 peaks) within 600 possible peak positions is calculated by
p-formula
In this formula, denominator calculates all possible combination to pick l(60) peaks out of N(600) positions. The numerator is a product of two numbers, that are the number of possible combination of picking n(23) positions out of m(32) and the number of possible combinations of picking 37 out of 568. The first combination is essentially how many possibilities to have 23 peaks in the correct database mass spectra which has total 32 peaks. The second combination is how many possibilities the unmatched peaks fall in the rest of bins in the range.  The P-value calculated from this formula is 7.72xE-35. This is a very very small number and it means that the scenario described here is a highly unlikely event by random matching. But is this true?

Peak matching is not a completely random event

In fact, spectra matching does not behave like random matching. Let’s look at one example. In this example, theoretical spectra of peptide KGHHEAELKPLAQSHATK (+2) had 18 matches with an experimental spectra. This experimental spectra is searched against a database and examined for the number of peaks matched to the spectrum in the database.
distribution of matched peaks
Fridman et al., J Bioinfo Comp Biol, 2005: 455-476
You can see the distribution of matched peaks (total area under the line should be 1) has shifted towards more right compared to theoretical peak matching distribution (use the same number of peaks with the same range as experimental spectra).
This means that real spectrum more likely match to the theoretical spectrum derived from the databases than pure random matching.
Why?
Because peptides are composed of amino acids with distinct molecular weight. Therefore, the bins in the MS/MS have unequal likelihood to match to experimental spectrum. In fact, the smaller the m/z, the more distinct m/z due to smaller number of amino acid combinations. To correct the experimental distribution of p-value, you can shift the curve by 2 matches in this case.

P-value distribution of random matching follows poisson distribution

Poisson distribution is the probability distribution of a given number of events occurring in some fixed amount of time. Smaller average events, the sharper the peak distribution. Also poisson distribution is only in a positive range as there is no negative number for events. The number of peaks (events) matching to database spectrum for many peptides appear to follow this type of distribution (but not all peptides, of course!). OMSSA uses poisson distribution for P-value modeling.
distribution estimation
However, calculating P-value strictly based on the number of matched peaks is obviously not the best method. There are many properties in MS/MS spectrum which provide useful information for identification. Peak height intensity, intensity distribution,  presence of both b & y ion pair are examples. Good matching often comes with matching intense mass peaks. Mass spec search programs (e.g. X! tandem) take these into account to generate scores. The probability distribution based on scores is used to calculate P-values. There is an excellent PowerPoint slide how to calculate hyperscore for X!tandem.
I want to point out that each search program calculates P-value distribution using specific formula. What is critical is how each formula handles right-tail of P-value distribution which will be important for real-matching spectrum.

Q- & PEP-value

How about Q-value? Q-value is defined as minimum false discovery rate (FDR). If you search MS/MS spectrum against a decoy database, you know that all PSMs are incorrect. If you search against true databases, you get the mixture of correct and wrong hits.
q-value
As you can see the graph above, you can guess the number of falsely identified hits in blue line by deducting the hits from the decoy database search in red. For example, if you draw a line and you see only one wrong hit from decoy search, and 99 hits from true search, you get 1% FDR. Q-value is associated with each PSM, meaning every PSM has Q-value. The Q-value 0.05 means that there are 1 in 20 of higher ranked PSMs that are likely wrong.
Posterior error probability (PEP) is defined as a local probability for the PSM with a given score, which is calculated by the ratio of hits from decoy and true database search with a given score. In the figure above, it is the ratio of  height for a given score in red and red+blue line.  For example, if the score that gives an equal number of matches in both decoy and true databases, PEP will be 0.5, meaning at this score the chance of being incorrect is 50%. This concept is important especially when you find a PSM that was found with 5% FDR, but its PEP is 20%.
There is an excellent review which is easy to read and understand these concepts published by Käll and Noble et al., in 2007.

P-values, False Discovery Rate (FDR) and q-values

What are p-values?

The object of differential 2D expression analysis is to find those spots which show expression difference between groups, thereby signifying that they may be involved in some biological process of interest to the researcher. Due to chance, there will always be some difference in expression between groups. However, it is the size of this difference in comparison to the variance (i.e. the range over which expression values fall) that will tell us if this expression difference is significant or not. Thus, if the difference is large but the variance is also large, then the difference may not be significant. On the other hand, a small difference coupled with a very small variance could be significant. We use the one way Anova test (equivalent t-test for two groups) to formalise this calculation. The tests return a p-value that takes into account the mean difference and the variance and also the sample size. The p-value is a measure of how likely you are to get this spot data if no real difference existed. Therefore, a small p-value indicates that there is a small chance of getting this data if no real difference existed and therefore you decide that the difference in group expression data is significant. By small we usually mean 0.05.

What are q-values, and why are they important?

False positives


A positive is a significant result, i.e. the p-value is less than your cut off value, normally 0.05. A false positive is when you get a significant difference when, in reality, none exists. As I mentioned above, the p-value is the chance that this data could occur given no difference actually exists. So, choosing a cut off of 0.05 means there is a 5% chance that we make the wrong decision.

The multiple testing problem


When we set a p-value threshold of, for example, 0.05, we are saying that there is a 5% chance that the result is a false positive. In other words, although we have found a statistically significant result, in reality, there is no difference in the group means. While 5% is acceptable for one test, if we do lots of tests on the data, then this 5% can result in a large number of false positives. For example, if there are 200 spots on a gel and we apply an ANOVA or t-test to each, then we would expect to get 10 false positives by chance alone. This is known as the multiple testing problem.

Multiple testing and the False Discovery Rate


While there are a number of approaches to overcoming the problems due to multiple testing, they all attempt to assign an adjusted p-value to each test, or similarly, reduce the p-value threshold. Many traditional techniques such as the Bonferroni correction are too conservative in the sense that while they reduce the number of false positives, they also reduce the number of true discoveries. The False Discovery Rate approach is a more recent development. This approach also determines adjusted p-values for each test. However, it controls the number of false discoveries in those tests that result in a discovery (i.e. a significant result). Because of this, it is less conservative that the Bonferroni approach and has greater ability (i.e. power) to find truly significant results.
Another way to look at the difference is that a p-value of 0.05 implies that 5% of all tests will result in false positives. An FDR adjusted p-value (or q-value) of 0.05 implies that 5% of significant tests will result in false positives. The latter is clearly a far smaller quantity.

q-values


q-values are the name given to the adjusted p-values found using an optimised FDR approach. The FDR approach is optimised by using characteristics of the p-value distribution to produce a list of q-values. In what follows I will tie up some ideas and hopefully this will help clarify some of the ideas about p and q values.
It is usual to test many hundreds or thousands of spot variables in a proteomics experiment. Each of these tests will produce a p-value. The p-values take on a value between 0 and 1 and we can create a histogram to get an idea of how the p-values are distributed between 0 and 1. Some typical p-value distributions are shown below. On the x-axis we have histogram bars representing p-values. Each has a width of 0.05 and so in the first bar (red or green) we have those p-values that are between 0 and 0.05. Similarly, the last bar represents those p-values between 0.95 and 1.0, and so on. The height of each bar gives an indication of how many values are in the bar. This is called a density distribution because the area of all the bars always adds up to 1. Although the two distributions appear quite different, you will notice that they flatten off towards the right of the histogram. The red (or green) bar represents the significant values, if you set a p-value threshold of 0.05.
P-value cut off
If there are no significant changes in the experiment, you will expect to see a distribution more like that on the left above while an experiment with significant changes will look more like that on the right. So, even if there are no significant changes in the experiment, we still expect, by chance, to get p-values < 0.05. These are false positives, and shown in red. Even in an experiment with significant changes (in green), we are still unsure if a p-value < 0.05 represents a true discovery or a false positive. Now, the q-value approach tries to find the height where the p-value distribution flattens out and incorporates this height value into the calculation of FDR adjusted p-values. We can see this in the histogram below. This approach helps to establish just how many of the significant values are actually false positives (the red portion of the green bar).
P-value cut off graph
Now, the q-values are simply a set of values that will lie between 0 and 1. Also, if you order the p-values used to calculate the q-values, then the q-values will also be ordered. This can be seen in the following screen shot from SameSpots. Notice that q-values can be repeated.
Q-value table screenshot
To interpret the q-values, you need to look at the ordered list of q-values. There are 839 spots in this experiment. If we take spot 52 as an example, we see that it has a p-value of 0.01 and a q-value of 0.0141. Recall that a p-value of 0.01 implies a 1% chance of false positives, and so with 839 spots, we expect between 8 or 9 false positives, on average, i.e. 839*0.01 = 8.39. In this experiment, there are 52 spots with a value of 0.01 or less, and so 8 or 9 of these will be false positives. On the other hand, the q-value is a little greater at 0.0141, which means we should expect 1.41% of all the spots with q-value less than this to be false positives. This is a much better situation. We know that 52 spots have a q-value less than 0.0141 and so we should expect 52*0.0141 = 0.7332 false positives, i.e. less than one false positive. Just to reiterate, false positives according to p-values take all 839 values into account when determining how many false positives we should expect to see while q-values take into account only those tests with q-values less the threshold we choose. Of course, it is not always the case that q-values will result in less false positives, but what we can say is that they give a far more accurate indication of the level of false positives for a given cut-off value.

When doing lots of tests, as in a proteomics experiment, it is more intuitive to interpret p and q values by looking at the entire list of values in this way rather that looking at each one independently. In this way, a threshold of 0.05 has meaning across the entire experiment. When deciding on a cut-off or threshold value, you should do this from the point of view of how many false positives will this result in, rather than just randomly picking a p- or q-value of 0.05 and saying that everything with a value less than this is significant.