An association study of features with conditions with scFeatures
Source:vignettes/scFeatures_associationstudy.Rmd
scFeatures_associationstudy.Rmd
Association study of the features with the conditions
scFeatures provides a function that automatically run association study of the features with the conditions and produce an html file with the visualisation of the features and the association result.
For this, we would first need to generate the features using scFeatures and then store the result in a named list format.
For demonstration purpose, we provide an example of this features list. The code below show a step to step guide of generating the hmtl output from the features list.
# here we use the demo data from the package
scfeatures_result <- readRDS(system.file("extdata", "scfeatures_result.rds",
package = "scFeatures"))
# here we use the current working directory to save the html output
# modify this to save the html file to other directory
output_folder <- tempdir()
run_association_study_report(scfeatures_result, output_folder )
Inside the directory defined in the output_folder
, you
will see the html report output with the name
output_report.html
.
Some additional notes on creating the scfeatures_list
When generating the features using scFeatures, make sure the
sample
information is in the format of
a_cond_b
, where a
is sample ID and
b
is the condition, eg,
patient09_cond_nonresponder
. This is so that we can
retrieve the sample ID and the corresponding condition when running the
analysis.
When creating the list, the name of the list must use the same name as shown below. Otherwise, it is not possible to tell which feature type each list entry is and create the correct visualisation for each feature type.
Not all feature types need to be provided. If a feature type is missing, the section in the html for the feature type will just be left blank.
# example of creating the feature list using the correct naming conventions
scfeatures_result <- list(
proportion_raw = proportion_raw,
proportion_logit = proportion_logit,
proportion_ratio = proportion_ratio,
gene_mean_celltype = gene_mean_celltype,
gene_prop_celltype = gene_prop_celltype,
gene_cor_celltype = gene_cor_celltype,
pathway_gsva = pathway_gsva ,
pathway_mean = pathway_mean,
pathway_prop = pathway_prop,
CCI = CCI ,
gene_mean_aggregated = gene_mean_aggregated ,
gene_cor_aggregated = gene_cor_aggregated ,
gene_prop_aggregated = gene_prop_aggregated,
L_stats = L_stats ,
morans_I = morans_I,
celltype_interaction = celltype_interaction,
nn_correlation = nn_correlation
)
sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Debian GNU/Linux 11 (bullseye)
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] BiocStyle_2.24.0
##
## loaded via a namespace (and not attached):
## [1] rstudioapi_0.14 knitr_1.40 magrittr_2.0.3
## [4] R6_2.5.1 ragg_1.2.3 rlang_1.0.6
## [7] fastmap_1.1.0 stringr_1.4.1 tools_4.2.1
## [10] xfun_0.33 cli_3.4.1 jquerylib_0.1.4
## [13] systemfonts_1.0.4 htmltools_0.5.3 yaml_2.3.5
## [16] digest_0.6.29 rprojroot_2.0.3 pkgdown_2.0.6
## [19] bookdown_0.30 textshaping_0.3.6 BiocManager_1.30.18
## [22] purrr_0.3.5 sass_0.4.2 fs_1.5.2
## [25] memoise_2.0.1 cachem_1.0.6 evaluate_0.17
## [28] rmarkdown_2.17 stringi_1.7.8 compiler_4.2.1
## [31] bslib_0.4.0 desc_1.4.2 jsonlite_1.8.2