ksfun: Kolmogorov-Smirnov test on genomic distances

Description Usage Arguments Value DETAILS Author(s) See Also Examples

View source: R/distTests.R

Description

Compare 2 sets of distances with a Kolmogorov-Smirnov test (only returns the p-value)

Usage

1
ksfun(.x, .y)

Arguments

.x

A data frame with distances for the gene set of interest.

.y

A data frame with distances for the control/reference gene set.

Value

The p-value of the Kolmorovov-Smirnov test.

DETAILS

Both .x and .y should contain at least the following columns:

Note that the Kolmogorov-Smirnov test is not adapted to integer values such as intergenic distances in bp. However, it gives conservative p-values for large enough gene sets.

Author(s)

Pascal GP Martin

See Also

ks.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Create some random distance data
  set.seed(123)
  mydistData <- data.frame(GeneName = stringi::stri_rand_strings(400, 5),
                           Distance = sample(1:5000, 400, replace=TRUE),
                           GeneSet = sample(c("TestSet", "RefSet"),
                                            400, replace= TRUE))
## Compute the p-value of the KS test comparing TestSet to RefSet
  ksfun(.x = mydistData[mydistData$GeneSet == "TestSet",],
        .y = mydistData[mydistData$GeneSet == "RefSet",])
## If .x is empty, the function returns NA
  ksfun(.x = mydistData[mydistData$GeneSet == "SomeRandomName",],
        .y = mydistData[mydistData$GeneSet == "RefSet",])
## If .y is empty, the function returns an error
## Not run: 
  ksfun(.x = mydistData[mydistData$GeneSet == "TestSet",],
        .y = mydistData[mydistData$GeneSet == "SomeRandomName",])
        
## End(Not run)

pgpmartin/GeneNeighborhood documentation built on Sept. 2, 2021, 6:37 a.m.