Skip to content

Commit

Permalink
v0.99.7 -- run a test for r-lib/pkgdown#1230. Works locally
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Feb 28, 2020
1 parent 9dd323d commit aad74a6
Show file tree
Hide file tree
Showing 49 changed files with 209 additions and 172 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatialLIBD
Title: LIBD Visium spatial transcriptomics human pilot data inspector
Version: 0.99.6
Version: 0.99.7
Date: 2020-02-27
Authors@R:
c(
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# spatialLIBD 0.99.7

* Run a test that might help with https://github.com/r-lib/pkgdown/issues/1230.

# spatialLIBD 0.99.6

* Add mirrors for the shiny app and change the main location.
Expand Down
4 changes: 2 additions & 2 deletions R/check_image_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Get the path to the images
#' img_path <- system.file('app', 'www', 'data', package = 'spatialLIBD')
#'
#' ## Check the object
#' check_image_path(img_path, ori_sce)
#' check_image_path(img_path, sce)
#'

check_image_path <- function(image_path, sce) {
Expand Down
6 changes: 3 additions & 3 deletions R/check_modeling_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#'
#' @examples
#'
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#'
#' ## Check the object
#' xx <- check_modeling_results(ori_modeling_results)
#' xx <- check_modeling_results(modeling_results)
#'

check_modeling_results <- function(modeling_results) {
Expand Down
4 changes: 2 additions & 2 deletions R/check_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Check the object
#' check_sce(ori_sce)
#' check_sce(sce)
#'

check_sce <- function(sce,
Expand Down
4 changes: 2 additions & 2 deletions R/check_sce_layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce_layer')) ori_sce_layer <- fetch_data('sce_layer')
#' if (!exists('sce_layer')) sce_layer <- fetch_data('sce_layer')
#'
#' ## Check the object
#' check_sce_layer(ori_sce_layer)
#' check_sce_layer(sce_layer)
#'

check_sce_layer <- function(sce_layer, variables = 'layer_guess_reordered_short') {
Expand Down
2 changes: 1 addition & 1 deletion R/fetch_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#'
#' ## Download the SingleCellExperiment object
#' ## at the layer-level
#' sce_layer <- fetch_data('sce_layer')
#' if (!exists('sce_layer')) sce_layer <- fetch_data('sce_layer')
#'
#' ## Explore the data
#' sce_layer
Expand Down
6 changes: 3 additions & 3 deletions R/gene_set_enrichment.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
#' )
#'
#' ## Obtain the necessary data
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#'
#' ## Compute the gene set enrichment results
#' asd_sfari_enrichment <- gene_set_enrichment(
#' gene_list = asd_sfari_geneList,
#' modeling_results = ori_modeling_results,
#' modeling_results = modeling_results,
#' model_type = 'enrichment'
#' )
#'
Expand Down
6 changes: 3 additions & 3 deletions R/gene_set_enrichment_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
#' )
#'
#' ## Obtain the necessary data
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#'
#' ## Compute the gene set enrichment results
#' asd_sfari_enrichment <- gene_set_enrichment(
#' gene_list = asd_sfari_geneList,
#' modeling_results = ori_modeling_results,
#' modeling_results = modeling_results,
#' model_type = 'enrichment'
#' )
#'
Expand Down
9 changes: 6 additions & 3 deletions R/geom_spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#'
#' @examples
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Select the first sample and extract the data
#' sample_id <- unique(ori_sce$sample_name)[1]
#' sce_sub <- ori_sce[, ori_sce$sample_name == sample_id]
#' sample_id <- unique(sce$sample_name)[1]
#' sce_sub <- sce[, sce$sample_name == sample_id]
#' sample_df <- as.data.frame(colData(sce_sub))
#'
#' ## Make a plot using geom_spatial
Expand All @@ -41,6 +41,9 @@
#' y = 0.5
#' )
#'
#' ## Clean up
#' rm(sce_sub)
#'

geom_spatial <- function(mapping = NULL,
data = NULL,
Expand Down
8 changes: 4 additions & 4 deletions R/get_colors.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce_layer')) ori_sce_layer <- fetch_data('sce')
#' if (!exists('sce_layer')) sce_layer <- fetch_data('sce')
#'
#' ## Example layer colors with the corresponding names
#' get_colors(libd_layer_colors, ori_sce_layer$layer_guess)
#' get_colors(libd_layer_colors, ori_sce_layer$layer_guess_reordered_short)
#' get_colors(libd_layer_colors, sce_layer$layer_guess)
#' get_colors(libd_layer_colors, sce_layer$layer_guess_reordered_short)
#'
#' ## Example where colors are assigned automatically
#' ## based on a pre-defined set of colors
#' get_colors(clusters = ori_sce_layer$kmeans_k7)
#' get_colors(clusters = sce_layer$kmeans_k7)
#'
#' ## Example where Polychrome::palette36.colors() gets used
#' get_colors(clusters = letters[seq_len(13)])
Expand Down
24 changes: 12 additions & 12 deletions R/layer_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,39 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('ori_sce_layer')) ori_sce_layer <- fetch_data(type = 'sce_layer')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('sce_layer')) sce_layer <- fetch_data(type = 'sce_layer')
#'
#' ## Top 2 genes from the enrichment model
#' sig_genes <- sig_genes_extract_all(n = 2,
#' modeling_results = ori_modeling_results,
#' sce_layer = ori_sce_layer)
#' modeling_results = modeling_results,
#' sce_layer = sce_layer)
#'
#' ## Example default boxplot
#' layer_boxplot(sig_genes = sig_genes, sce_layer = ori_sce_layer)
#' layer_boxplot(sig_genes = sig_genes, sce_layer = sce_layer)
#'
#' ## Now show the long title version
#' layer_boxplot(sig_genes = sig_genes,
#' short_title = FALSE,
#' sce_layer = ori_sce_layer)
#' sce_layer = sce_layer)
#'
#' layer_boxplot(
#' i = which(sig_genes$model_type == 'anova')[1],
#' sig_genes = sig_genes,
#' sce_layer = ori_sce_layer
#' sce_layer = sce_layer
#' )
#' layer_boxplot(
#' i = which(sig_genes$model_type == 'pairwise')[1],
#' sig_genes = sig_genes,
#' sce_layer = ori_sce_layer
#' sce_layer = sce_layer
#' )
#'
#' ## Viridis colors displayed in the shiny app
#' library('viridisLite')
#' layer_boxplot(
#' sig_genes = sig_genes,
#' sce_layer = ori_sce_layer,
#' sce_layer = sce_layer,
#' col_low_box = viridis(4)[2],
#' col_low_point = viridis(4)[1],
#' col_high_box = viridis(4)[3],
Expand All @@ -78,7 +78,7 @@
#' ## Paper colors displayed in the shiny app
#' layer_boxplot(
#' sig_genes = sig_genes,
#' sce_layer = ori_sce_layer,
#' sce_layer = sce_layer,
#' col_low_box = 'palegreen3',
#' col_low_point = 'springgreen2',
#' col_high_box = 'darkorange2',
Expand All @@ -89,7 +89,7 @@
#' layer_boxplot(
#' i = which(sig_genes$model_type == 'pairwise')[1],
#' sig_genes = sig_genes,
#' sce_layer = ori_sce_layer,
#' sce_layer = sce_layer,
#' col_bkg_box = 'grey90',
#' col_bkg_point = 'grey60',
#' col_low_box = 'lightcyan',
Expand Down
6 changes: 3 additions & 3 deletions R/layer_stat_cor.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#'
#' ## Compute the correlations
#' cor_stats_layer <- layer_stat_cor(
#' tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer,
#' ori_modeling_results,
#' modeling_results,
#' 'enrichment'
#' )
#'
Expand Down
6 changes: 3 additions & 3 deletions R/layer_stat_cor_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_modeling_results'))
#' ori_modeling_results <- fetch_data(type = 'modeling_results')
#' if (!exists('modeling_results'))
#' modeling_results <- fetch_data(type = 'modeling_results')
#'
#' ## Compute the correlations
#' cor_stats_layer <- layer_stat_cor(
#' tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer,
#' ori_modeling_results,
#' modeling_results,
#' 'enrichment'
#' )
#'
Expand Down
2 changes: 1 addition & 1 deletion R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ run_app <- function(sce = fetch_data(type = 'sce'),
sce <-
check_sce(sce,
variables = c(spatial_libd_var, sce_discrete_vars, sce_continuous_vars))
sce_layer <-
if (!exists('sce_layer')) sce_layer <-
check_sce_layer(sce_layer, variables = spatial_libd_var)
modeling_results <- check_modeling_results(modeling_results)
image_path <- check_image_path(image_path, sce)
Expand Down
6 changes: 3 additions & 3 deletions R/sce_image_clus.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Check the colors defined by Lukas M Weber
#' libd_layer_colors
#'
#' ## Use the manual color palette by Lukas M Weber
#' sce_image_clus(
#' sce = ori_sce,
#' sce = sce,
#' clustervar = 'layer_guess_reordered',
#' sampleid = '151673',
#' colors = libd_layer_colors,
Expand All @@ -43,7 +43,7 @@
#'
#' ## Without histology
#' sce_image_clus(
#' sce = ori_sce,
#' sce = sce,
#' clustervar = 'layer_guess_reordered',
#' sampleid = '151673',
#' colors = libd_layer_colors,
Expand Down
7 changes: 5 additions & 2 deletions R/sce_image_clus_p.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' sce_sub <- ori_sce[, ori_sce$sample_name == '151673']
#' if (!exists('sce')) sce <- fetch_data('sce')
#' sce_sub <- sce[, sce$sample_name == '151673']
#'
#' ## Use the manual color palette by Lukas M Weber
#' ## Don't plot the histology information
Expand All @@ -33,6 +33,9 @@
#' spatial = FALSE
#' )
#'
#' ## Clean up
#' rm(sce_sub)
#'

sce_image_clus_p <-
function(sce,
Expand Down
10 changes: 5 additions & 5 deletions R/sce_image_gene.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Valid `geneid` values are those in
#' head(rowData(ori_sce)$gene_search)
#' ## or continuous variables stored in colData(ori_sce)
#' head(rowData(sce)$gene_search)
#' ## or continuous variables stored in colData(sce)
#'
#' ## Visualize a default gene on the non-viridis scale
#' sce_image_gene(
#' sce = ori_sce,
#' sce = sce,
#' sampleid = '151507',
#' viridis = FALSE
#' )
#'
#' ## Visualize a continuous variable, in this case, the ratio of chrM
#' ## gene expression compared to the total expression at the spot-level
#' sce_image_gene(
#' sce = ori_sce,
#' sce = sce,
#' sampleid = '151507',
#' geneid = 'expr_chrM_ratio'
#' )
Expand Down
7 changes: 5 additions & 2 deletions R/sce_image_gene_p.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Prepare the data for the plotting function
#' sce_sub <- ori_sce[, ori_sce$sample_name == '151673']
#' sce_sub <- sce[, sce$sample_name == '151673']
#' df <- as.data.frame(colData(sce_sub))
#' df$COUNT <- df$expr_chrM_ratio
#'
Expand All @@ -37,6 +37,9 @@
#' spatial = FALSE
#' )
#'
#' ## Clean up
#' rm(sce_sub)
#'

sce_image_gene_p <-
function(sce,
Expand Down
7 changes: 5 additions & 2 deletions R/sce_image_grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#' @examples
#'
#' ## Obtain the necessary data
#' if (!exists('ori_sce')) ori_sce <- fetch_data('sce')
#' if (!exists('sce')) sce <- fetch_data('sce')
#'
#' ## Subset to two samples of interest
#' sce_sub <- ori_sce[, ori_sce$sample_name %in% c('151673', '151674')]
#' sce_sub <- sce[, sce$sample_name %in% c('151673', '151674')]
#'
#' ## Obtain the plot list
#' p_list <-
Expand All @@ -40,6 +40,9 @@
#' colors = libd_layer_colors
#' )
#'
#' ## Clean up
#' rm(sce_sub)
#'
#' ## Visualize the spatial adjacent replicates for position = 0 micro meters
#' ## for subject 3
#' cowplot::plot_grid(plotlist = p_list, ncol = 2)
Expand Down
Loading

0 comments on commit aad74a6

Please sign in to comment.