Calculate the gene order score.

geneOrderScore(
  genesList,
  ids,
  ref,
  k = length(ids),
  max_gap = 1e+07,
  method = c("edit distance", "global alignment score", "spearman correlation",
    "kendall correlation", "non-random score", "pairs distance", "pairs direction"),
  output = c("score", "value matrix")
)

Arguments

genesList

A list of GRanges.

ids

IDs to be plotted. See getGeneCluster.

ref

The reference species.

k

The maximum number of nearest genes used in getGeneCluster.

max_gap

The maximal gaps from the first ID in `ids`.

method

The method to calculate the gene order score. 'edit distance', the gene order score is the mean of edit (Levenshtein) distance of given ids from different species. Gene order score = k/length(ids)/(mean(adist)+1). 'global alignment score', the gene order score is the mean of normalized global alignment score. For global alignment score please refer pairwiseAlignment. The alignment score will be normalized by the reference self alignment score. 'spearman correlation', the score is the mean of absolute value of Spearman correlation of the genes appearance order. 'non-random score', the score is the mean of Jaccard index of 2-order and 3-order of ids for paired samples. 'pairs distance', the score is the mean of pairwise coordinates distance. Score = k/length(ids)/(mean(abs(coordinates distance))+1). 'pairs direction', the score is the mean of alignment of pairwise strand information. The higher the gene order score, the higher the conservation of gene order.

output

Output values

Value

the score or values matrix such as adist, or alignment scores.

Examples

fish <- readRDS(system.file('extdata', 'fish.rds',
package = 'geneClusterPattern'))
homologs <- readRDS(system.file('extdata', 'homologs.rds',
                                package = 'geneClusterPattern'))
queryGene <- 'inhbaa'
nearest10neighbors <- getGeneCluster(fish, queryGene, homologs, k=10)
genesList <- c(drerio=fish, homologs)[
c("hsapiens", "mmusculus", "drerio", "olatipes", "nfurzeri", "gaculeatus")]
# set zebrafish as reference
geneOrderScore(genesList, nearest10neighbors, ref='drerio')
#> [1] 0.00799975
# default first element is reference
geneOrderScore(genesList, nearest10neighbors, method='edit distance')
#> [1] 0.01296464
geneOrderScore(genesList, nearest10neighbors, method='global alignment score')
#> [1] -532.9976
geneOrderScore(genesList, nearest10neighbors, method='spearman correlation')
#> [1] 0.4101958
geneOrderScore(genesList, nearest10neighbors, method='kendall correlation')
#> [1] 0.2048604
geneOrderScore(genesList, nearest10neighbors, method='non-random score')
#> [1] 0.5375864
geneOrderScore(genesList, nearest10neighbors, method='pairs distance')
#> [1] 0.2031206
geneOrderScore(genesList, nearest10neighbors, method='pairs direction')
#> [1] 0.3555556