findPeakGene {tomoda} | R Documentation

## Find peak genes

### Description

Find peak genes (spatially upregulated genes) in a `SummarizedExperiment` object.

### Usage

    findPeakGene(
      object,
      threshold = 1,
      length = 4,
      matrix = "scaled",
      nperm = 1e+05,
      method = "BH"
    )

### Arguments

`object` | A `SummarizedExperiment` object.
`threshold` | Integer, only scaled read counts bigger than `threshold` are recognized as part of the peak.
`length` | Integer, scaled read counts bigger than `threshold` in minimum `length` of consecutive sections are recognized as a peak.
`matrix` | Character, must be one of `"count"`, `"normalized"`, or `"scaled"`.
`nperm` | Integer, number of random permutations to calculate p values. Set it to 0 if you are not interested in p values.
`method` | Character, the method to adjust p values for multiple comparisons, must be one of `"holm"`, `"hochberg"`, `"hommel"`, `"bonferroni"`, `"BH"`, `"BY"`, `"fdr"`, `"none"`.

### Details

Peak genes are selected based on scaled read counts. As scaled read counts are Z scores, suggested `threshold` are [1,3]. Smaller `threshold` and `length` makes the function detect more peak genes, and vice versa. P values are calculated by approximate permutation tests. For a given `threshold` and `length`, the scaled read counts of each gene is randomly permutated for `nperm` times. The p value is defined as the ratio of permutations containing peaks. In order to speed up permutation process, genes whose expression exceeds threshold in same number of sections have same p values. To be specific, only one of these genes will be used to calculate a p value by permutation, and other genes are assigned this p value.

### Value

A data.frame with peak genes as rows. It has following columns:

- `gene` : Character, peak gene names.

- `start` : Numeric, the start index of peak.

- `end` : Numeric, the end index of peak.

- `center` : Numeric, the middle index of peak. If the length of the peak is even, `center` is defined as the left-middle index.

- `p` : Numeric, p values.

- `p.adj` : Numeric, adjusted p values.

### Examples

    data(zh.data)
    zh <- createTomo(zh.data)
    peak_genes <- findPeakGene(zh)
    head(peak_genes)

    # Increase threshold so that less peak genes will be found.
    peak_genes <- findPeakGene(zh, threshold=1.5)

    # Increase peak length so that less peak genes will be found.
    peak_genes <- findPeakGene(zh, length=5)

    # Set nperm to 0 so that p values will not be calculated. This will save running time.
    peak_genes <- findPeakGene(zh, nperm=0)

[Package tomoda version 1.0.0 Index]