Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ LazyData: true
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Depends:
data.table
Imports:
Seurat,
MAST,
data.table,
Matrix,
ggplot2,
patchwork,
parallel,
sessioninfo,
utils,
magrittr
RoxygenNote: 7.1.1
magrittr,
methods
RoxygenNote: 7.2.3
18 changes: 17 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export(.countsperclus)
export(DE_MAST_RE_seurat)
export(estimate_dimensions)
export(geneset_VIF)
export(geneset_embed)
export(geneset_embed_list_seurat)
export(plot_barIdentGroup)
export(plot_network)
export(plot_vlnGrid)
export(prep_HTO_q_area_plot)
export(prep_intrahash_doub)
export(prep_qc_rna)
export(remap)
export(utils_big_as.matrix)
importFrom(Matrix,rowSums)
7 changes: 4 additions & 3 deletions R/differential_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,13 @@ DE_MAST_RE_seurat = function(
# https://github.com/kdzimm/PseudoreplicationPaper/blob/master/Type_1_Error/Type%201%20-%20MAST%20RE.Rmd

de.results <- data.frame(
"p_val" = summaryCond$datatable[contrast=='groupGroup1' & component=='H', `Pr(>Chisq)`],
"p_val" = summaryCond$datatable[contrast=='groupGroup1' & component=='H', "Pr(>Chisq)"],
"z_score" = summaryCond$datatable[contrast=='groupGroup1' & component=='H', "z"],
fc.results[vec_logical_features,]) #setDF(summaryCond$datatable[contrast=='groupGroup1' & component=='logFC', .(coef)])

de.results$p_val_adj = p.adjust(de.results$p_val, method=p.adjust.method, n=length(vec_logical_features))
de.results$p_val_adj = p.adjust(de.results$p_val, method=p.adjust.method, n=length(features))

de.results = de.results[order(de.results$p_val, -de.results[[fc.name]]),]
de.results = de.results[order(de.results$z_score),]

return(de.results)
}
Expand Down
2 changes: 1 addition & 1 deletion R/geneset_enrichment.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#'
#' @references modified from https://rdrr.io/bioc/qusage/src/R/qusage.R
#' . drawing on https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3458527/
#' @examples list_vec_VIF <- geneset_VIF(datExpr=mat_counts, list_genesets=mylist)
#' @examples ## list_vec_VIF <- geneset_VIF(datExpr=mat_counts, list_genesets=mylist)
geneset_VIF <- function(datExpr, list_genesets) {
list_vec_vif = lapply(names(list_genesets), function(genesetname) {
vec_logicalgenes <-rownames(datExpr) %in% list_genesets[[genesetname]]
Expand Down
4 changes: 2 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @return a ggplot2 object
#' @export
#'
#' @examples p <- plot_barIdentGroup(seurat_obj=seu, var_ident="sample",var_group="cluster")
#' @examples ##p <- plot_barIdentGroup(seurat_obj=seu, var_ident="sample",var_group="cluster")
plot_barIdentGroup = function(seurat_obj,
var_ident,
var_group,
Expand Down Expand Up @@ -106,7 +106,7 @@ plot_barIdentGroup = function(seurat_obj,
#' @return ggplot2 object
#' @export
#'
#' @examples p <- plot_vlnGrid(seurat_obj=seu, assay="RNA", slot="data", var_group="cluster", vec_features=head(VariableFeatures(seu)))
#' @examples ##p <- plot_vlnGrid(seurat_obj=seu, assay="RNA", slot="data", var_group="cluster", vec_features=head(VariableFeatures(seu)))
plot_vlnGrid = function(seurat_obj,
assay,
slot,
Expand Down
20 changes: 10 additions & 10 deletions R/reduce_dimensions.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
#' @return integer number of dimensions, <= max_dim
#' @export
#'
#' @examples estimate_dimensions(seurat_obj)
dim_red_est <- function(x,
max_dim=75,
seed.use=12345) {
#' @examples ##estimate_dimensions(seurat_obj)
estimate_dimensions <- function(x,
max_dim=75,
seed.use=12345) {

if(is(x, "SingleCellExperiment")) {
x <- as.Seurat(x)
}
if(is(x, "SingleCellExperiment")) {
x <- as.Seurat(x)
}

x %>% RunPCA(., npcs=max_dim, seed.use=seed.use, verbose = F) -> x
x %>% RunPCA(., npcs=max_dim, seed.use=seed.use, verbose = F) -> x

dims <- round(as.numeric(intrinsicDimension::maxLikGlobalDimEst(data = x@reductions$pca[, 1:max_dim], k = 20)))
dims <- round(as.numeric(intrinsicDimension::maxLikGlobalDimEst(data = x@reductions$pca[, 1:max_dim], k = 20)))

return(dims)
return(dims)
}


2 changes: 1 addition & 1 deletion R/remap.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @return an object of the same format as dataIn with new gene names
#' @export
#'
#' @examples df_data_remapped = map_genes(dataIn=df_data, colRemap="genes", df_mapping=fread("./mapping/hgnc_ensembl.csv"), replace=T)
#' @examples ## df_data_remapped = remap(dataIn=df_data, colRemap="genes", df_mapping=fread("./mapping/hgnc_ensembl.csv"), replace=T)
remap <- function(dataIn,
colRemap = NULL,
df_mapping,
Expand Down
1 change: 1 addition & 0 deletions SCOPfunctions.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
3 changes: 0 additions & 3 deletions man/dot-countsperclus.Rd

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

24 changes: 24 additions & 0 deletions man/estimate_dimensions.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/f_VIF.Rd

This file was deleted.

17 changes: 15 additions & 2 deletions man/geneset_VIF.Rd

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

28 changes: 27 additions & 1 deletion man/plot_barIdentGroup.Rd

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

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

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

Loading