Shows the results of the 'haystack' analysis in various ways, sorted by significance. Priority of params is genes > p.value.threshold > n.

show_result_haystack(
  res.haystack,
  n = NULL,
  p.value.threshold = NULL,
  gene = NULL
)

# S3 method for haystack
show_result_haystack(
  res.haystack,
  n = NULL,
  p.value.threshold = NULL,
  gene = NULL
)

Arguments

res.haystack

A 'haystack' result object.

n

If defined, the top "n" significant genes will be returned. Default: NA, which shows all results.

p.value.threshold

If defined, genes passing this p-value threshold will be returned.

gene

If defined, the results of this (these) gene(s) will be returned.

Value

A data.frame with 'haystack' results sorted by log.p.vals.

Details

The output is a data.frame with the following columns: * D_KL the calculated KL divergence. * log.p.vals log10 p.values calculated from randomization. * log.p.adj log10 p.values adjusted by Bonferroni correction.

Examples

# using the toy example of the singleCellHaystack package

# running haystack
res <- haystack(dat.tsne, dat.expression)
#> ### calling haystack_continuous_highD()...
#> ### Using package sparseMatrixStats to speed up statistics in sparse matrices.
#> ### Calculating row-wise mean and SD... 
#> ### Filtered 0 genes with zero variance...
#> ### Using 100 randomizations...
#> ### Using 100 genes to randomize...
#> Warning: The value of 'grid.points' appears to be very high (> No. of cells / 10). You can set the number of grid points using the 'grid.points' parameter.
#> ### scaling input data...
#> ### deciding grid points...
#> ### calculating Kullback-Leibler divergences...
#> ### performing randomizations...
#> ### estimating p-values...
#> ### picking model for mean D_KL...
#> ### using natural splines
#> ### best RMSD  : 0.093
#> ### best df    : 3
#> ### picking model for stdev D_KL...
#> ### using natural splines
#> ### best RMSD  : 0.02
#> ### best df    : 3
#> ### returning result...

# below are variations for showing the results in a table
# 1. list top 10 biased genes
show_result_haystack(res.haystack = res, n =10)
#>              D_KL log.p.vals log.p.adj
#> gene_62  2.167619  -37.49534 -34.79637
#> gene_351 1.952468  -36.33302 -33.63405
#> gene_275 1.869558  -35.86746 -33.16849
#> gene_497 1.990614  -35.30553 -32.60656
#> gene_339 1.848716  -34.94200 -32.24303
#> gene_79  2.401003  -34.49255 -31.79358
#> gene_242 1.709774  -32.72927 -30.03030
#> gene_71  2.618959  -31.62696 -28.92799
#> gene_213 1.756021  -31.21381 -28.51484
#> gene_325 1.874556  -30.88724 -28.18827
# 2. list genes with p value below a certain threshold
show_result_haystack(res.haystack = res, p.value.threshold=1e-10)
#>              D_KL log.p.vals  log.p.adj
#> gene_62  2.167619  -37.49534 -34.796370
#> gene_351 1.952468  -36.33302 -33.634046
#> gene_275 1.869558  -35.86746 -33.168493
#> gene_497 1.990614  -35.30553 -32.606562
#> gene_339 1.848716  -34.94200 -32.243033
#> gene_79  2.401003  -34.49255 -31.793578
#> gene_242 1.709774  -32.72927 -30.030295
#> gene_71  2.618959  -31.62696 -28.927990
#> gene_213 1.756021  -31.21381 -28.514842
#> gene_325 1.874556  -30.88724 -28.188271
#> gene_479 2.462010  -29.63185 -26.932879
#> gene_244 1.634253  -29.13092 -26.431949
#> gene_137 1.680041  -29.09412 -26.395152
#> gene_429 1.615984  -28.98509 -26.286125
#> gene_99  1.970877  -28.89432 -26.195353
#> gene_61  1.887008  -28.40971 -25.710744
#> gene_444 1.856239  -28.19758 -25.498606
#> gene_313 1.755483  -28.00972 -25.310752
#> gene_458 1.646122  -27.88507 -25.186098
#> gene_24  2.503064  -25.57603 -22.877061
#> gene_381 2.351667  -25.32954 -22.630567
#> gene_317 1.524015  -25.03824 -22.339265
#> gene_300 2.025872  -24.48818 -21.789212
#> gene_155 2.020291  -24.12024 -21.421271
#> gene_321 2.161541  -23.46944 -20.770465
#> gene_424 2.377840  -22.99977 -20.300805
#> gene_400 2.647292  -22.88906 -20.190094
#> gene_78  3.088231  -22.82156 -20.122586
#> gene_57  2.407546  -22.52389 -19.824916
#> gene_463 2.921912  -22.33673 -19.637764
#> gene_51  2.642381  -22.25577 -19.556797
#> gene_59  2.024199  -22.14167 -19.442696
#> gene_340 2.120703  -21.87009 -19.171118
#> gene_112 1.932236  -20.45545 -17.756477
#> gene_291 3.045928  -20.14897 -17.449995
#> gene_295 2.532697  -18.37318 -15.674210
#> gene_135 2.254088  -18.02469 -15.325721
#> gene_449 3.513541  -17.26738 -14.568413
#> gene_13  2.361233  -16.72864 -14.029672
#> gene_488 3.629939  -16.22173 -13.522755
#> gene_136 2.840323  -16.17383 -13.474857
#> gene_156 2.708703  -15.48886 -12.789891
#> gene_10  2.203270  -15.39893 -12.699962
#> gene_216 2.814330  -14.61612 -11.917146
#> gene_201 2.644354  -13.24347 -10.544500
#> gene_176 3.105065  -13.01437 -10.315395
#> gene_225 2.915940  -12.48868  -9.789706
#> gene_9   3.167582  -10.04909  -7.350124
# 3. list a set of specified genes
set <- c("gene_497","gene_386", "gene_275")
show_result_haystack(res.haystack = res, gene = set)
#>               D_KL  log.p.vals log.p.adj
#> gene_275 1.8695579 -35.8674630 -33.16849
#> gene_497 1.9906140 -35.3055316 -32.60656
#> gene_386 0.6926282  -0.3668113   0.00000