Skip to content

Commit

Permalink
export volcano plot func & add Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Murphy committed Jun 2, 2021
1 parent 8152984 commit 063f1e0
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 63 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/R-CMD-check.yaml
@@ -0,0 +1,33 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
- dev-am
pull_request:
branches:
- main
- master

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Check
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
shell: Rscript {0}
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -52,6 +52,7 @@ export(report_impacted_pathway)
export(report_integrated_sce)
export(report_merged_sce)
export(report_qc_sce)
export(volcano_plot)
export(write_celltype_mappings)
export(write_sce)
export(write_sparse_matrix)
Expand Down
5 changes: 2 additions & 3 deletions R/cluster_sce.R
Expand Up @@ -2,9 +2,8 @@
#' Cluster SingleCellExperiment with monocle3::cluster_cells
#'
#' @param sce a SingleCellExperiment object
#' @param reduction_methods one or more of "PCA", "tSNE", "UMAP", "UMAP3D"
#' @param pca_dims the number of pca dimensions used
#' @param ... see uwot::umap for umap options
#' @param ... see uwot::umap for umap options. Includes reduction_methods one
#' or more of "PCA", "tSNE", "UMAP", "UMAP3D"
#'
#' @return sce a SingleCellExperiment object annotated with reducedDims
#'
Expand Down
16 changes: 12 additions & 4 deletions R/diffexp_models.R
Expand Up @@ -664,15 +664,23 @@ perform_de <- function(sce,
}


#' volcano plot
#' Plot volcano plot for differential expression analysis
#'
#' @param dt Differential expression result table from perform_de() function.
#' @param fc_threshold Fold change threshold for the volcano plot. This will be adjusted and plotted as the log2 fold change. Default is 1.05.
#' @param pval_cutoff The adjusted p-value cut-off for the volcano plot. Default is 0.05.
#' @param n_label The number of top up & down differentially expressed genes to be labeled. Default is 10.
#'
#' @return No return. The plot is printed out.
#'
#' @family differential gene expression
#'
#' @importFrom ggplot2 ggplot geom_point aes coord_cartesian
#' @importFrom ggrepel geom_text_repel
#' @importFrom dplyr %>% filter top_n
#'
#' @keywords internal

.volcano_plot <- function(dt,
#' @export
volcano_plot <- function(dt,
fc_threshold = 1.05,
pval_cutoff = 0.05,
n_label = 10) {
Expand Down
2 changes: 1 addition & 1 deletion R/find_cells_sce.R
Expand Up @@ -8,7 +8,7 @@
#' @param lower see [DropletUtils::emptyDrops()]
#' @param retain see [DropletUtils::emptyDrops()]. Use "auto" to calculate
#' the parameter from the top `expect_cells` cells (cellranger method).
#' @param alpha minimum FDR for [DropletUtils::emptyDrops()]
# #' @param alpha minimum FDR for [DropletUtils::emptyDrops()]
#' @param niters the number of Monte Carlo iterations
#' @param expect_cells the number of cells expected for auto retain
#' @param alpha_cutoff The alpha cutoff used for Monte Carlo signficance.
Expand Down
4 changes: 2 additions & 2 deletions R/integrate_sce.R
Expand Up @@ -5,9 +5,9 @@
#'
#' @param sce a SingleCellExperiment object or merged sce objects
#' @param method the integration method to use
#' @param k Inner dimension of factorization (number of factors).
#' Set to k=30 as default.
#' @param ... Additional arguments
#' @param ... Additional arguments. Such as k Inner dimension of factorization
#' (number of factors).
#'
#' @return sce SingleCellExperiment object annotated with reducedDims
#'
Expand Down
11 changes: 8 additions & 3 deletions R/liger_preprocess.R
Expand Up @@ -4,9 +4,11 @@
#' Split merged object into multiple sce objects and extract sparse matrices:
#' @param sce SingleCellExperiment object or merged objects
#' @param k Inner dimension of factorization (number of factors).
#' @param unique_id_var the colData variable identifying unique samples.
#' Default is "manifest".
#'
#' Make a Liger object:
#' @param take.gene.union Whether to fill out raw.data matrices with union
#' @param take_gene_union Whether to fill out raw.data matrices with union
#' of genes across all datasets (filling in 0 for missing data)
#' (requires make.sparse=T) (default FALSE).
#' @param remove.missing Whether to remove cells not expressing any
Expand All @@ -15,7 +17,7 @@
#' not expressed in any dataset) (default TRUE).
#'
#' Select informative genes:
#' @param num.genes Number of genes to find for each dataset.
#' @param num_genes Number of genes to find for each dataset.
#' Set to 3000 as default.
#' @param combine How to combine variable genes across experiments.
#' Either "union" or "intersect".
Expand All @@ -26,7 +28,10 @@
#' Scale genes by root-mean-square across cells:
#'
#' Remove cells/genes with no expression across any genes/cells:
#' @param use.cols Treat each column as a cell (default TRUE)
#' @param use_cols Treat each column as a cell (default TRUE)
#' @param num_cores Number of cores used on user's machine to run function.
#' Default fouynd by `future::availableCores()`
#' @param ... Additional arguments.
#'
#' @return liger preprocessed object.
#'
Expand Down
7 changes: 4 additions & 3 deletions R/liger_reduce_dims.R
Expand Up @@ -19,9 +19,9 @@
#' this increments the random seed by 1 for each consecutive restart,
#' so future factorizations of the same dataset can be run with
#' one rep if necessary. (default 1)
#' @param H.init Initial values to use for H matrices. (default NULL)
#' @param W.init Initial values to use for W matrix (default NULL)
#' @param V.init Initial values to use for V matrices (default NULL)
#' @param h_init Initial values to use for H matrices. (default NULL)
#' @param w_init Initial values to use for W matrix (default NULL)
#' @param v_init Initial values to use for V matrices (default NULL)
#' @param rand_seed Random seed to allow reproducible results (default 1).
#' @param print_obj Print objective function values after convergence
#' (default FALSE).
Expand All @@ -40,6 +40,7 @@
#' sparse modalities like methylation data). (default FALSE)
#' @param resolution Controls the number of communities detected.
#' Higher resolution -> more communities. (default 1)
#' @param ... Additional arguments.
#'
#' @return liger object with H, H.norm, W, and V slots sets.
#'
Expand Down
2 changes: 2 additions & 0 deletions R/model_celltype_freqs.R
Expand Up @@ -6,6 +6,8 @@
#' @param celltype_var the colData variable specifying celltype or subtype
#' @param dependent_var the name of the colData variable for contrasts
#' @param ref_class the class of dependent_var used as reference
#' @param var_order Optional re-ordering of subset_group factor levels. Default
#' NULL.
#' @param ... Additional arguments
#'
#' @return results_l a list of results
Expand Down
2 changes: 1 addition & 1 deletion R/plot_expr_by_numeric_var.r
Expand Up @@ -9,7 +9,7 @@
#'
#'
#' @param sce a SingleCellExperiment object
#' @param group_var The colData variable for x-axis groups
#' @param numeric_var The colData variable for x-axis groups. Default is p_tau
#' @param subset_var The colData variable to subset on
#' @param subset_group The specific subset_var group to subset
#' @param gene The gene of interest
Expand Down
2 changes: 1 addition & 1 deletion R/report_de.R
Expand Up @@ -27,7 +27,7 @@ report_de <- function(res,

cli::cli_h2("Generating report for differential expression analysis")

p <- .volcano_plot(
p <- volcano_plot(
dt = res,
fc_threshold = fc_threshold,
pval_cutoff = pval_cutoff,
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Expand Up @@ -28,6 +28,7 @@ knitr::opts_chunk$set(
[![Manual](https://img.shields.io/badge/manual-passing-brightgreen.svg?style=flat)](https://combiz.github.io/scflow-manual/)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/combiz/scFlow/issues)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![R-CMD-check](https://github.com/combiz/scFlow/workflows/R-CMD-check/badge.svg)](https://github.com/combiz/scFlow/actions)
<!-- badges: end -->

The goal of scFlow is to provide tools in R to build a complete analysis workflow for single-cell/nuclei RNA sequencing data.
Expand Down
7 changes: 2 additions & 5 deletions man/cluster_sce.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/dot-filter_sce_genes_for_de.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/dot-generate_model_from_vars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/dot-perform_de_with_mast.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/dot-preprocess_sce_for_de.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions man/dot-volcano_plot.Rd

This file was deleted.

2 changes: 0 additions & 2 deletions man/find_cells.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions man/integrate_sce.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions man/liger_preprocess.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/liger_reduce_dims.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/model_celltype_freqs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/perform_de.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/plot_expr_by_numeric_var.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 063f1e0

Please sign in to comment.