AnalyzeInterInFullView: Perform Network Analysis

View source: R/FullView.R

AnalyzeInterInFullViewR Documentation

Perform Network Analysis

Description

This function works for network analysis, which calculates count and power of interaction pairs among all given clusters.

Usage

AnalyzeInterInFullView(
  object,
  sel.clusters.X = NULL,
  sel.clusters.Y = NULL,
  sel.exprs.change = c("Xup.Yup", "Xup.Ydn", "Xdn.Yup", "Xdn.Ydn"),
  sel.some.genes.X = NULL,
  sel.some.genes.Y = NULL,
  sel.genes.option = "intersect",
  sel.gene.pairs = NULL,
  run.permutation = FALSE,
  perm.expression = NULL,
  perm.pval.sides = "two-sides",
  perm.pval.cutoff = 0.05,
  force.process = FALSE,
  verbose = TRUE
)

Arguments

object

A InterCell object, which is created by CreateInterCellObject.

sel.clusters.X

Defining one part of interacting clusters. The options can be found from ListAllClusters. See details for help.

sel.clusters.Y

Defining the other part of interacting clusters. The options can be found from ListAllClusters. See details for help.

sel.exprs.change

Options are 'Xup.Yup', 'Xup.Ydn', 'Xdn.Yup', 'Xdn.Ydn'. It gives the corresponding expression change of every interacting gene pair.

sel.some.genes.X

It gives the genes to be expected to be expressed in clusters given by parameter sel.clusters.X. It can either be return by FetchGeneOI, or just character though losing some gene properties.

sel.some.genes.Y

It gives the genes to be expected to be expressed in clusters given by parameter sel.clusters.Y. It can be generated as paramter sel.some.genes.X.

sel.genes.option

Options are 'intersect' or 'union'. 'intersect' strictly restricts gene pair to have one gene partner in sel.some.genes.X and the other in sel.some.genes.Y. 'union' restricts gene pair to have at least one gene either in sel.some.genes.X or sel.some.genes.Y.

sel.gene.pairs

Directly specify the desired gene pairs. It should be given in standard table that is generated by FormatCustomGenePairs. To note, it's strictly aligned to clusters, see details.

run.permutation

It decides whether to permutation test to distinguish significant changed gene pairs with the rest. If set TRUE, parameter perm.expression, perm.pval.sides and perm.pval.cutoff should be provided. If set FALSE, no statistical test is used, which means all gene pairs will be passed to result.

perm.expression

A list of permutations of gene expression. It should be generated by function Tool.GenPermutation().

perm.pval.sides

Default is 'two-sides'. All allowed options are 'one-side-large' or 'one-side-small' or 'two-sides'. Explicit explanation are given in details.

perm.pval.cutoff

The P value cutoff for

force.process

It stops the program when no subset of genes are selected either by sel.some.genes.X and sel.some.genes.Y or by sel.gene.pairs, which may take long time to process. To force process, set this to TRUE.

verbose

If set TRUE, the progress bar will be shown.

Details

This function performs network analysis and calculates:

  • count: count of interaction.

  • power: strength of interaction, which is calculated by formula: SUM(Power(pair[i~j])).

sel.clusters.X and sel.clusters.Y: Interactions are defined by pairs of interacting clusters, or say cluster groups. For one interaction, e.g. cluster-Myeloid ~ cluster-T_cell, the fromer one will be restricted to clusters given in sel.clusters.X and the latter one will be retricted to clusters given in sel.clusters.Y. The clusters given by ListAllClusters list all available clusters, and users can manually pick some or all of them.

sel.exprs.change: The *up means the gene is up-regulated, i.e. its LogFC (log fold change) > 0. The *dn means the gene is down-regulated. Take 'Xup.Ydn' for example, it gets to explore the interaction between cluster X and cluster Y by taking up-regulated genes from X and down-regulated genes from Y.

sel.gene.pairs: The gene pairs given in this parameter are strictly aligned to clusters given by parameter sel.clusters.X and sel.clusters.Y. After standardizing by FormatCustomGenePairs, the gene pairs are given in 4 columns, and 2 of them are named 'inter.GeneName.A', 'inter.GeneName.B'. The corresponding relation is that genes listed in 'inter.GeneName.A' are used to compare with genes expressed by clusters given in sel.clusters.X and genes listed in 'inter.GeneName.B' are used to compare with genes expressed by clusters given in sel.clusters.Y. For example, if the user gives C3~C3ar1 in sel.gene.pairs, Myeloid_cell and T_cell in sel.clusters.X, and fibroblast and B_cell in sel.clusters.Y, then C3 will be tested in Myeloid_cell and T_cell but not fibroblast and B_cell, and C3ar1 will be only tested in fibroblast and B_cell. If the user need C3~C3ar1 to be tested in the opposite way, one more row C3ar1~C3 should be given in sel.gene.pairs.

perm.pval.sides and perm.pval.cutoff: The perm.pval.sides can be 'two-side', 'one-side-large' and 'one-side-small'. Take option 'two-side' as example. The null hypothesis is given as power of one gene pair from actual scRNA-seq is equal to it from cell label permutation. Suppose one gene pair A~B, and cell clusters G1, G2, G3 exist. The average expression of A and B in all cells are denoted as allavg(A) and allavg(B), and the average expression of A and B in each cell clusters are denoted as E(G1, A), E(G1, B), E(G2, A), so on so forth. The permutations of cell labels generate one list of new expression, and will be denoted like Perm(i, G1, A), i goes from 1 to permutation times. To test whether A~B is significant between cluster G1 and G2, we calculate the power of this gene pair, which is the multiply of expression, and thus H0 is made as E(G1, A) * E(G2, B) - allavg(A) * allavg(B) = Perm(i, G1, A) * Perm(i, G2, B) - allavg(A) * allavg(B), i goes from 1 to permutation times. By getting the times when abs(Equation-left) <= abs(Equation-right), we get the P value. By comparing the P value with perm.pval.cutoff, we judge whether the gene pair A~B between G1 and G2 is significant.

For 'one-side-large', the H0 is E(G1, A) * E(G2, B) - allavg(A) * allavg(B) > Perm(i, G1, A) * Perm(i, G2, B) - allavg(A) * allavg(B) . P value is calculated as (Equation-left) <= (Equation-right). For 'one-side-small', the H0 is E(G1, A) * E(G2, B) - allavg(A) * allavg(B) < Perm(i, G1, A) * Perm(i, G2, B) - allavg(A) * allavg(B) . P value is calculated as (Equation-left) >= (Equation-right).

Value

A InterCell object.


ZJUDBlab/InterCellDB documentation built on March 19, 2023, 4:56 p.m.