For details read Perl NOC. After June 25

Nathaniel Nutter >
Genome-Model-Tools-Music-0.04 >
Genome::Model::Tools::Music::PathScan::PathScan

PathScan - the Path-Scan significance test for mutations in groups of putative cancer genes

use PathScan; my $pmobj = PathScan->new ($list_of_gene_lengths); my $pval = $pmobj->path_scan ($actual_hits, $background_mutation_rate);

This package calculates the so-called path-scan statistic P-value for sets of putative cancer genes under the null hypothesis that somatic mutations found in data are the result of a random process characterized by the background mutation rate. This test is applied to, for example, a biologically-relevant group of genes, say all the genes in a particular pathway, for which somatic mutation data are available. A low p-value would imply that the null hypothesis should be rejected. In other words, the result suggests that the mutation configuration in this pathway is probably not the result of a strictly random process.

This statistic considers individual genes in a "binary" fashion, i.e. a gene is either mutated (has one or more mutations) or it is not mutated. *The number of mutations in a mutated gene is not considered.* This is the "path-scan" aspect of the test.

Why is such information discarded? The somatic background mutation rate is typically very small compared to the size of the average gene. Consequently, the expected number of mutations in any given gene is very low, much less than one, in fact. Under the null hypothesis, most genes will have no mutations. Genes with one (or just a few) may be interesting, but when many genes in a biologically-relevant group (say a pathway) have one (or just a few) mutations, that could be a sign of some underlying *non-random* process. In other words, this test is useful in cases where many genes in a group might each contribute a small component (i.e. a small fitness advantage) in the context of the disease process. What this test is not concerned with (and will *not* detect) is the case where a single, specific gene has a non-random association and it reflects this fact via a large number of mutations. Other single-gene tests should presumably flag such cases. The path-scan test should, therefore, be thought of as just one tool within a larger statistical "toolbox".

The main assumption is that a single background mutation rate applies to the set of genes of interest. That is, the rate does not vary among genes, among chromosomes (if more than one hosts genes of interest), etc.

Coefficients are recalculated for every individual test, but it would be good for these to persist between tests, adding more as necessary (i.e. if a subsequent test involves more genes than the current one).

Michael C. Wendl

mwendl@wustl.edu

Copyright (C) 2007, 2008 Washington University

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

The available methods are as follows.

This is the usual object constructor, which optionally takes all the gene-length data as input. If you want to use the exact probability solution or the asymptotic approximate solution, pass all lengths in a single list reference

my $pmobj = PathScan->new ([3434, 54565, 6445, ...]);

but if you want to use the convolution approximation method, divide the list of gene sizes into the desired number of bins and pass each of these as a reference

my $pmobj = PathScan->new ([3434, 54565], [6445, ...]);

In other words, the way you pass these arguments at partially determines the context in which you will obtain your P-value for this set of genes. The latter choice is typically betetr, as it gives good accuracy and good computational efficiency. Conversely, the exact solution is identically correct, but can be difficult to compute. The asymptotic approximation is always computationally efficient, but not necessarily accurate for small test sets.

This function calculates the path-scan statistic in one of the appropriate contexts (exact or convolution approximation, as described above). It takes the actual number of "hits" you've observed in the data, i.e. the number of genes that have a mutated status.

my $pval = $pmobj->path_scan (7);

If you have not yet done the pre-processing with respect to the background mutation rate (see below), then pre-processing can be executed implicitly by passing the rate as the second argument.

my $pval = $pmobj->path_scan (7, 0.000001);

This function returns the cummulative distribution in the context of the convolution approximation *truncated* such that it contains only enough information to process the given number of hits.

my $pvals_list = $pmobj->cdf_truncated ($hits);

The list is ordered from most extreme to least extreme probability tail values, i.e. the last value in the list is always unity. However, tailed p-values more extreme than that associated with the argument are not, in fact, calculated, but rather are replaced with the flag -1. This saves processing time and also reduces the chances of numerical overflow for large pathways, as the full CDF must ultimately raise an "mval" (>1) to a power equal to the number of genes in the pathway. The method assumes you have already done the pre-processing with respect to the background mutation rate.

This function returns the cummulative distribution in one of the appropriate contexts (exact or convolution approximation, as described above). There are no arguments,

my $pvals_list = $pmobj->cdf;

unless you have not yet done the pre-processing with respect to the background mutation rate (see below), in which case the pre-processing can be executed implicitly by passing the rate as the sole argument.

my $pvals_list = $pmobj->cdf (0.000001);

The list is ordered from most extreme to least extreme probability tail values, i.e. the last value in the list is always unity.

This function returns the cummulative distribution based on asymptotic analysis. There are no arguments, i.e.

my $pvals_list = $pmobj->cdf_asymptot;

unless you have not yet done the pre-processing with respect to the background mutation rate (see below), in which case the pre-processing can be executed implicitly by passing the rate as the sole argument.

my $pvals_list = $pmobj->cdf_asymptot (0.000001);

The list is ordered from most extreme to least extreme probability tail values, i.e. the last value in the list is always unity.

Note that asymptotic analysis gives a function (the Poisson) having infinite support. The infinite tail probability for all values past the most extreme physical case are all bundled into that most extreme p-value.

This function calculates the path-scan statistic in the asymptotic (Poisson) context. It takes the actual number of "hits" you've observed in the data, i.e. the number of genes that have a mutated status.

my $pval = $pmobj->path_scan_asymptot (7);

If you have not yet done the pre-processing with respect to the background mutation rate (see below), then pre-processing can be executed implicitly by passing the rate as the second argument.

my $pval = $pmobj->path_scan_asymptot (7, 0.000001);

You must set up the object, somewhat paradoxically, *as if you will be doing the calculation in the exact context*. (This is a consequence of how data are stored internally within the object.)

The basic functionality of this package is encompassed in the methods described above. However, some lower-level functions can also sometimes be useful.

This function returns the exact value of the probability *mass* for a specific number of hits.

$pval_exact = $pmobj->p_value_exact (7);

You must make sure to call this only if you've configured the object in the exact context (see above).

This function returns the convolution approximated value (i.e. using the binomial binning approximation) of the probability *mass* for a specific number of hits.

$pval_exact = $pmobj->p_value_binomial_approx (7);

You must make sure to call this only if you've configured the object in the approximate binomial context (see above). Also, you must explicitly calculate the necessary binomial coefficients beforehand (see `binom_coeffs`

).

This function returns the asymptotic approximated value (i.e. using the Poisson limit approximation) of the probability *mass* for a specific number of hits.

$pval_exact = $pmobj->p_value_asymptot_approx (7);

Somewhat paradoxically, you must make sure to call this only if you've configured the object in the exact context (see above).

Stores the raw gene length data. Use this if you did not pass these data to `new`

before you call any calculation methods. Works in the same way as `new`

, described above. Specifically, the context is partially determined by whether you pass a single list (exact context or asymptotic approximation)

$pmobj->store_genes ([3434, 54565, 6445, ...]);

or more than one list (convolution approximate context)

$pmobj->store_genes ([3434, 54565], [6445, ...]);

Calculates the binomial coefficients needed in the binomial (convolution) approximate solution.

$pmobj->binom_coeffs;

The internal data structure is essentially the symmetric half of the appropriately-sized Pascal triangle. Considerable memory is saved by not storing the full triangle.

Calculates the Bernoulli kernel probabilities for the individual genes or gene bins

$pmobj_binom->preprocess ($background_mutation_rate);

The data structure can be re-configured to run the test with different background mutation rates by just re-calling this routine with a different value

$pmobj_binom->preprocess ($new_background_mutation_rate);

The following examples may be helpful in using this package. In each case, assume we have first executed some required preliminary code.

#__USE THE PACKAGE use PathScan; #__SOME DATA FOR AN "EXACT CONTEXT" CALCULATION my $genes_exact = [ 4000, 4000, 4000, 4000, 4000, 15000, 15000, 15000, 15000, 15000, 35000, 35000, 35000, 35000, 35000 ]; #__SOME DATA FOR AN "APPROXIMATE CONTEXT" CALCULATION my @genes_binned = ( [4000, 4000, 4000, 4000, 4000], [15000, 15000, 15000, 15000, 15000], [35000, 35000, 35000, 35000, 35000] );

Here, we compare the values returned by both the exact and approximate algorithms over the whole domain of possible hits for a case where the answers should be identical.

#__SET BACKGROUND MUTATION RATE my $rho = 0.00002; #__CONFIGURE OBJECTS IN "EXACT" AND "APPROXIMATE" CONTEXTS my $pmobj_exact = PathScan->new ($genes_exact); $pmobj_exact->preprocess ($rho); my $pmobj_binom = PathScan->new (@genes_binned); $pmobj_binom->preprocess ($rho); #__CALCULATE AND TALLY THE MAXIMUM DIFFERENCE my $maxdiff = 0; for (my $i = 0; $i <= scalar @{$genes_exact}; $i++) { my $pm_pval_exact = $pmobj_exact->path_scan($i); my $pm_pval_binom = $pmobj_binom->path_scan($i); my $diff = abs ($pm_pval_exact - $pm_pval_binom); $maxdiff = $diff if $diff > $maxdiff; print "$i hits: $pm_pval_exact $pm_pval_binom $diff\n"; } print "MAXIMUM DIFFERENCE IS $maxdiff\n";

This example shows how to run the test for a fixed number of hits, say 7 in this case, for various different background mutation rates.

#__CONFIGURE OBJECT my $pmobj_binom = PathScan->new (@genes_binned); #__CALCULATE for (my $rho = 0.00001; $rho <= 0.0001; $rho += 0.00001) { my $pm_pval_binom = $pmobj_binom->path_scan(7, $rho); print "7 hits at background $rho : P = $pm_pval_binom\n"; }

Note that we did not run `preprocess`

explicitly, but rather let the `path_scan`

method call it implicitly for each new value of the background mutation rate.

The asymptotic (Poisson) approximate probabiltiy value is straightforward to compute.

#__SET BACKGROUND MUTATION RATE my $rho = 0.00002; #__CONFIGURE OBJECT my $pmobj_poisson = PathScan->new ($genes_exact); $pmobj_poisson->preprocess ($rho); #__P-VALUE FOR 7 OBSERVED MUTATED GENES my $pm_pval_poisson = $pmobj_exact->path_scan_asymptot (7);

The probability masses for specific numbers of hits can also be calculated.

#__SET BACKGROUND MUTATION RATE my $rho = 0.00002; #__CONFIGURE OBJECT my $pmobj_exact = PathScan->new ($genes_exact); $pmobj_exact->preprocess ($rho); #__CALCULATE MASSES my $total_prob = 0; for (my $i = 0; $i <= scalar @{$genes_exact}; $i++) { my $pval_exact = $pmobj_exact->p_value_exact ($i); $total_prob += $pval_exact; print "$i hits : probability mass = $pval_exact\n"; } print "total probability = $total_prob\n";

syntax highlighting: