Statistical Test

class pygna.statistical_test.StatisticalTest(test_statistic, network: networkx.classes.graph.Graph, diz: dict = {}, degree_bins=1)[source]

This class implements the statistical analysis performed by Pygna. It performs the statistical tests on the given network, elaborates the number of observed genes, the pvalue etc. Please refer to the single method documentation for the returning values

empirical_pvalue(geneset: set, alternative: str = 'less', max_iter: int = 100, cores: int = 1) → [<class 'int'>, <class 'float'>, <class 'float'>, <class 'int'>, <class 'int'>, <class 'int'>][source]

Calculate the empirical pvalue on the genes list

Parameters:
  • geneset – the geneset to elaborate
  • alternative – the pvalue selection of the observed genes
  • max_iter – the number of iterations to be performed
  • cores – the number of cores to be used
Return observed, pvalue, null_distribution, len(mapped_genesetA), len(mapped_genesetB):
 

the list with the data calculated

get_null_distribution(geneset: list, n_samples: int, sampling_p=None)[source]

Calculate the null distribution over the geneset

Parameters:
  • geneset – the geneset to be used
  • n_samples – the number of samples to be taken
Returns:

the random distribution calculated

get_null_distribution_mp(geneset: list, iter: int = 100, n_proc: int = 1, sampling_p=None)[source]

Calculate the null distribution with multiple cores on the geneset

Parameters:
  • geneset – the geneset to be used
  • iter – the number of iterations to perform
  • n_proc – the number of cpu to use for the elaboration
Returns:

the array with null distribution

pygna.statistical_test.geneset_localisation_statistic_median(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → float[source]

Calculate the median shortest path for each node

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed
pygna.statistical_test.geneset_localisation_statistic(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → float[source]

Identify the genes in a geneset

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed
pygna.statistical_test.geneset_module_statistic(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → float[source]

Evaluate the length of a observed network

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed
pygna.statistical_test.geneset_total_degree_statistic(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → float[source]

Total degree of the geneset: average total_degree

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed
pygna.statistical_test.geneset_internal_degree_statistic(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → float[source]

Internal degree ratio: average of the ratio internal_degree/total_degree

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed
pygna.statistical_test.geneset_RW_statistic(network: networkx.classes.graph.Graph, geneset: set, diz: dict = {}, observed_flag: bool = False) → numpy.ndarray[source]

Poisson binomial probability, sum of interaction probabilities for the genes in the geneset

Parameters:
  • network – the network used in the analysis
  • geneset – the geneset to analyse
  • diz – the dictionary containing the genes name
  • observed_flag – whether the gene has been already observed