Skip to content

Commit

Permalink
fix cran issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Liuy12 committed Feb 26, 2024
1 parent c1bfa1e commit 0a9c22a
Show file tree
Hide file tree
Showing 72 changed files with 144 additions and 122 deletions.
38 changes: 0 additions & 38 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
#' Integrated scRNA-seq reference for breast tissue (subset)
#'
#' Integrated scRNA-seq reference using random subset of two scRNA-seq datasets for breast tissue. One sample is from Komen tissue bank.
#' The other sample is from Gtex snRNA-seq data.
#'
#' @format
#' a \code{\link[Seurat]{Seurat-class}} object with several metadata included:
#' \describe{
#' \item{cellid}{cell barcodes}
#' \item{celltypes}{annotated cell types}
#' \item{subjectid}{subject id}
#' \item{cohort}{data cohort, either "komentissuebank" or "gtex"}
#' }
#'
#' @source
#' \url{https://gtexportal.org/home/singleCellOverviewPage}
#' \url{https://pubmed.ncbi.nlm.nih.gov/33763657/}
"refdata"



#' Reference scRNA-seq data for mouse cortical cell taxonomy from the Allen Institute (subset)
#'
#' The data was generated using SMART-Seq2 protocol. 20 cells were randomly selected for each cell type. 15,000 highly variable
#' genes were selected.
#'
#' @format
#' a \code{\link[Seurat]{Seurat-class}} object with several metadata included:
#' \describe{
#' \item{cellid}{cell barcodes}
#' \item{celltypes}{annotated cell types}
#' \item{subjectid}{subject id}
#' }
#'
#' @source
#' \url{https://www.nature.com/articles/nn.4216}
"refdata_brain"

#' relationship between average tpm and ffpe artifacts based on a gam model
#'
#' The model was learnt using seven paired FFPE-FFzn samples from BBD patients
Expand Down
21 changes: 18 additions & 3 deletions R/deconvolution.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' effect of cell type removal from reference.
#' @param ffpe_artifacts logical value indicating whether to add simulated ffpe artifacts in the bulk data. Only applicable to simulation experiments in
#' evaluating the effect of FFPE artifacts.
#' @param model pre-constructed ffpe model data. Can be loaded via \code{data(ffpemodel)}.
#' @param model pre-constructed ffpe model data. Can be downloaded from github: https://github.com/Liuy12/SCdeconR/blob/master/data/ffpemodel.rda.
#' @param prop a matrix or data.frame of simulated cell proportion values with rows representing cell types, columns representing samples. Only applicable to simulation
#' experiments in evaluating the effect of cell type removal from reference.
#' @param cibersortpath full path to CIBERSORT.R script.
Expand Down Expand Up @@ -110,8 +110,23 @@
#'
#' @examples
#' \dontrun{
#' ## generate artificial bulk samples
#' data(refdata)
#' ref_list <- c(paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample1"),
#' paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample2"))
#' phenopath1 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample1.txt")
#' phenopath2 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample2.txt")
#' phenodata_list <- c(phenopath1,phenopath2)
#'
#' # construct integrated reference using harmony algorithm
#' refdata <- construct_ref(ref_list = ref_list,
#' phenodata_list = phenodata_list,
#' data_type = "cellranger",
#' method = "harmony",
#' group_var = "subjectid",
#' nfeature_rna = 50,
#' vars_to_regress = "percent_mt", verbose = FALSE)
#'
#' phenodata <- data.frame(cellid = colnames(refdata),
#' celltypes = refdata$celltype,
#' subjectid = refdata$subjectid)
Expand Down
17 changes: 16 additions & 1 deletion R/differential_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,22 @@
#'
#' @examples
#' \dontrun{
#' data(refdata)
#' ref_list <- c(paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample1"),
#' paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample2"))
#' phenopath1 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample1.txt")
#' phenopath2 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample2.txt")
#' phenodata_list <- c(phenopath1,phenopath2)
#'
#' # construct integrated reference using harmony algorithm
#' refdata <- construct_ref(ref_list = ref_list,
#' phenodata_list = phenodata_list,
#' data_type = "cellranger",
#' method = "harmony",
#' group_var = "subjectid",
#' nfeature_rna = 50,
#' vars_to_regress = "percent_mt", verbose = FALSE)
#' phenodata <- data.frame(cellid = colnames(refdata),
#' celltypes = refdata$celltype,
#' subjectid = refdata$subjectid)
Expand Down
2 changes: 1 addition & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ transformation <- function(matrix, option) {
#' @param seed random seed used for simulating FFPE artifacts. Only applicable when ffpe_artifacts is set to TRUE.
#' @param ffpe_artifacts logical value indicating whether to add simulated ffpe artifacts in the bulk data. Only applicable to simulation experiments in
#' evaluating the effect of FFPE artifacts.
#' @param model pre-constructed ffpe model data. Can be loaded via \code{data(ffpemodel)}
#' @param model pre-constructed ffpe model data. Can be downloaded from github: https://github.com/Liuy12/SCdeconR/blob/master/data/ffpemodel.rda
#'
#' @return a matrix-like object with the same dimension of input object after data normalization.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/reference_construction.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ construct_ref <- function(
merge_data <- harmony::RunHarmony(
object = merge_data,
assay.use = "SCT",
reduction = "pca",
reduction.use = "pca",
dims.use = 1:30,
group.by.vars = group_var,
plot_convergence = FALSE,
Expand Down
34 changes: 32 additions & 2 deletions R/simulate_bulk.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,22 @@
#'
#' @examples
#' \dontrun{
#' data(refdata)
#' ref_list <- c(paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample1"),
#' paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample2"))
#' phenopath1 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample1.txt")
#' phenopath2 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample2.txt")
#' phenodata_list <- c(phenopath1,phenopath2)
#'
#' # construct integrated reference using harmony algorithm
#' refdata <- construct_ref(ref_list = ref_list,
#' phenodata_list = phenodata_list,
#' data_type = "cellranger",
#' method = "harmony",
#' group_var = "subjectid",
#' nfeature_rna = 50,
#' vars_to_regress = "percent_mt", verbose = FALSE)
#' phenodata <- data.frame(cellid = colnames(refdata),
#' celltypes = refdata$celltype,
#' subjectid = refdata$subjectid)
Expand Down Expand Up @@ -164,7 +179,22 @@ bulk_generator <- function(
#' @examples
#' \dontrun{
#' ## generate artificial bulk samples
#' data(refdata)
#' ref_list <- c(paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample1"),
#' paste0(system.file("extdata", package = "SCdeconR"), "/refdata/sample2"))
#' phenopath1 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample1.txt")
#' phenopath2 <- paste0(system.file("extdata", package = "SCdeconR"),
#' "/refdata/phenodata_sample2.txt")
#' phenodata_list <- c(phenopath1,phenopath2)
#'
#' # construct integrated reference using harmony algorithm
#' refdata <- construct_ref(ref_list = ref_list,
#' phenodata_list = phenodata_list,
#' data_type = "cellranger",
#' method = "harmony",
#' group_var = "subjectid",
#' nfeature_rna = 50,
#' vars_to_regress = "percent_mt", verbose = FALSE)
#' phenodata <- data.frame(cellid = colnames(refdata),
#' celltypes = refdata$celltype,
#' subjectid = refdata$subjectid)
Expand Down
17 changes: 16 additions & 1 deletion man/bulk_generator.Rd

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

17 changes: 16 additions & 1 deletion man/compute_metrics.Rd

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

27 changes: 0 additions & 27 deletions man/refdata.Rd

This file was deleted.

25 changes: 0 additions & 25 deletions man/refdata_brain.Rd

This file was deleted.

17 changes: 16 additions & 1 deletion man/run_de.Rd

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

2 changes: 1 addition & 1 deletion man/scaling.Rd

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

21 changes: 18 additions & 3 deletions man/scdecon.Rd

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

Loading

0 comments on commit 0a9c22a

Please sign in to comment.