Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b00a56d
Update Roxygen parmameters/descriptions for Dual_Labeling
phoman14 Mar 23, 2026
dd5efd0
Modify unit Tests for updated list output
phoman14 Mar 23, 2026
544c352
add use.assay roxygen parameter
phoman14 Mar 23, 2026
b6ef94a
Merge branch 'DEV_PhilSprint' of https://github.com/NIDAP-Community/S…
phoman14 Mar 23, 2026
338875e
update unit tests for Heatmap
phoman14 Mar 23, 2026
e0863af
add cluster.identities.table roxygen description"
phoman14 Mar 23, 2026
a2e8d75
make table for cluster.identities.table when running unit tests
phoman14 Mar 23, 2026
beb44f6
modify unit tests to use plots slot instead of plot
phoman14 Mar 23, 2026
127cbe3
Merge branch 'DEV_PhilSprint' of github.com:NIDAP-Community/SCWorkflo…
phoman14 Mar 23, 2026
f0d8449
fixed typo param mad.topNgenes.limitsSet
phoman14 Mar 24, 2026
2d2a248
Merge branch 'DEV_PhilSprint' of github.com:NIDAP-Community/SCWorkflo…
phoman14 Mar 24, 2026
433a42d
Update Test for FilterQC
phoman14 Mar 24, 2026
25c81c7
clean up vignette quotation ussaage
phoman14 Mar 24, 2026
878d37b
Merge branch 'DEV_PhilSprint' of https://github.com/NIDAP-Community/S…
phoman14 Mar 24, 2026
ab057aa
Modscore change to standard output
phoman14 Mar 24, 2026
6a582f0
colorByMarkerTable-clean up function parameter layout and coment out …
phoman14 Mar 24, 2026
b14deac
fix Samples Bug in Plot_Metadata
phoman14 Mar 24, 2026
36c91d0
plot Metadata rearange function parameters
phoman14 Mar 24, 2026
4bbc03e
Merge branch 'DEV_PhilSprint' of github.com:NIDAP-Community/SCWorkflo…
phoman14 Mar 24, 2026
142e0d1
Plot Metadata test error plot->plots for output
phoman14 Mar 24, 2026
548fd8b
Standardize parameters so that _->. and fix typo in parameter
phoman14 Mar 24, 2026
4919ba9
standardize parameters for inst/shiny/ModuleScoreApp
phoman14 Mar 24, 2026
b31621f
modify test to look for plots instead of plot
phoman14 Mar 24, 2026
971e96e
colorByGene-resolved cant find Samples error
phoman14 Mar 24, 2026
e2eaf05
Merge branch 'DEV_PhilSprint' of https://github.com/NIDAP-Community/S…
phoman14 Mar 24, 2026
2d3b139
minor error fixes to test files to run correctly
phoman14 Mar 24, 2026
d14db06
remove explicetly loading library in function
phoman14 Mar 24, 2026
1a2fb71
return standard output list data and plot
phoman14 Mar 24, 2026
45909c6
removue redundant use of samples to us only samples.to.include
phoman14 Mar 24, 2026
7943570
Harmony make standard object list of object and plots
phoman14 Mar 24, 2026
748c754
Harmony remove uncessary print statements
phoman14 Mar 24, 2026
e511a4d
Add title and description from .json files for Annotate_Cell_Types.R,…
phoman14 Mar 24, 2026
a9703ad
add example function calls to roxygen section. Standardize Roxygen fo…
phoman14 Mar 24, 2026
06c9dfd
unifiy parameter descriptions with .json files
phoman14 Mar 25, 2026
191e3af
update documentation
phoman14 Mar 25, 2026
76990b8
minor changes to missing packages and test not using standard output …
phoman14 Mar 25, 2026
4eae80c
fix Violin plot not loading tidyr
phoman14 Mar 25, 2026
b740dbf
create vignettes with previous updates to variables
phoman14 Mar 25, 2026
6b37d6e
make interactive plot an option for AggregateCounts
phoman14 Mar 25, 2026
9b4fd94
recreate vignette
phoman14 Mar 26, 2026
d0c74e7
Color_by_Genes_Automatic.R and Compare_Cell_Populations.R still did n…
phoman14 Mar 26, 2026
98e8b2e
Update NAMESPACE
phoman14 Mar 26, 2026
ff35211
Update R/Violin_Plots_by_Metadata.R
phoman14 Mar 26, 2026
67712ca
Update R/Filter_QC.R
phoman14 Mar 26, 2026
1807c26
Declare patchwork dependency and import plot_layout in Harmony.R (#85)
Copilot Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 20 additions & 20 deletions .Rhistory
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ complexity.limits = c(NA,NA),
mad.complexity.limits = c(5,NA),
topNgenes.limits = c(NA,NA),
mad.topNgenes.limits = c(5,5),
n.topgnes=20,
do.doublets.fitler=T
n.topgenes=20,
do.doublets.filter=T
)
ggsave(SO_filtered$plots$PostFilterCombined, filename = "./images/QC1.png", width = 10, height = 10)
ggsave(SO_filtered$plots$ViolinPlotCombine, filename = "./images/QC2.png", width = 10, height = 10)
Expand Down Expand Up @@ -315,12 +315,12 @@ dev.off()
modScore
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" )
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" )
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" ),
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" ),
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
use_assay = "SCT",
general.class=c("Macrophages"),
lvl.vec = c('Macrophages-M1','Macrophages-M2'),
Expand All @@ -333,8 +333,8 @@ step.size = 0.1
modScore
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" ),
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" ),
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
use_assay = "SCT",
general.class=c("Macrophages"),
multi.lvl = FALSE,
Expand All @@ -347,8 +347,8 @@ step.size = 0.1
modScore
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" ),
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" ),
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
general.class=c("Macrophages"),
multi.lvl = FALSE,
reduction = "umap",
Expand All @@ -359,8 +359,8 @@ step.size = 0.1
)
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" ),
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" ),
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
multi.lvl = FALSE,
reduction = "umap",
nbins = 10,
Expand All @@ -370,8 +370,8 @@ step.size = 0.1
)
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","M1","M2" ),
ms_threshold=c("Macrophages .40","M1 .25","M2 .14"),
use.columns = c("Macrophages","M1","M2" ),
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
general.class=c("Macrophages","M1","M2"),
multi.lvl = FALSE,
reduction = "umap",
Expand All @@ -383,8 +383,8 @@ step.size = 0.1
Marker_Table
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","Monocytes","CD8_T" ),
ms_threshold=c("Macrophages .40","Monocytes .25","CD8_T .14"),
use.columns = c("Macrophages","Monocytes","CD8_T" ),
ms.threshold=c("Macrophages .40","Monocytes .25","CD8_T .14"),
general.class=c("Macrophages","Monocytes","CD8_T"),
multi.lvl = FALSE,
reduction = "umap",
Expand All @@ -395,8 +395,8 @@ step.size = 0.1
)
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Macrophages","Neutrophils","CD8_T" ),
ms_threshold=c("Macrophages .40","Neutrophils .25","CD8_T .14"),
use.columns = c("Macrophages","Neutrophils","CD8_T" ),
ms.threshold=c("Macrophages .40","Neutrophils .25","CD8_T .14"),
general.class=c("Macrophages","Neutrophils","CD8_T"),
multi.lvl = FALSE,
reduction = "umap",
Expand All @@ -407,8 +407,8 @@ step.size = 0.1
)
MS_object=modScore(object=Anno_SO$object,
marker.table=Marker_Table,
use_columns = c("Neutrophils","Macrophages","CD8_T" ),
ms_threshold=c("Neutrophils .25","Macrophages .40","CD8_T .14"),
use.columns = c("Neutrophils","Macrophages","CD8_T" ),
ms.threshold=c("Neutrophils .25","Macrophages .40","CD8_T .14"),
general.class=c("Neutrophils","Macrophages","CD8_T"),
multi.lvl = FALSE,
reduction = "umap",
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ inst/doc
*.rds
/doc/
/Meta/

.github
.github.zip
decision_log.md
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ Imports:
htmlwidgets,
scDblFinder
, BiocParallel
, patchwork
Config/testthat/edition: 3
7 changes: 6 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export(dotPlotMet)
export(dualLabeling)
export(filterQC)
export(filterSeuratObjectByMetadata)
export(harmonyBatchCorrect)
export(heatmapSC)
export(launch_module_score_app)
export(modScore)
export(nameClusters)
export(object)
export(palantir_api_call)
export(plotMetadata)
export(processRawData)
Expand Down Expand Up @@ -46,12 +46,16 @@ import(httr)
import(jsonlite)
import(magrittr)
import(parallel)
importFrom(tidyr, pivot_longer)
import(plotly)
import(quantmod)
import(reshape2)
import(rlang)
import(scales)
importFrom(stringr, str_split)
import(stringr)
import(tibble)
import(tidyr)
import(tidyverse)
import(tools)
import(utils)
Expand Down Expand Up @@ -135,6 +139,7 @@ importFrom(gridExtra,arrangeGrob)
importFrom(gridExtra,tableGrob)
importFrom(htmlwidgets,saveWidget)
importFrom(magrittr,"%>%")
importFrom(patchwork,plot_layout)
importFrom(plotly,as_widget)
importFrom(plotly,ggplotly)
importFrom(plotly,plot_ly)
Expand Down
14 changes: 14 additions & 0 deletions R/3D_tSNE.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
#' @importFrom htmlwidgets saveWidget
#'
#' @export
#'
#' @return A list with a plotly 3D TSNE plot (`figure`) and TSNE coordinates
#' (`tsne.df`).
#'
#' @examples
#' \dontrun{
#' out <- tSNE3D(
#' object = seurat_obj,
#' color.variable = "cell_type",
#' label.variable = "orig.ident",
#' npcs = 15,
#' save.plot = FALSE
#' )
#' }

tSNE3D <- function(object,
color.variable,
Expand Down
76 changes: 45 additions & 31 deletions R/AggregateCounts.R
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
##' @title Aggregate Counts (Pseudobulk)
##' @description Compute pseudobulk expression by averaging expression across groups
##' defined by one or more metadata columns, and return a tidy table.
##' @details Uses Seurat's `AverageExpression()` on the `SCT` assay to compute
##' group-wise average expression for each feature. Also produces a
##' bar plot (via `ggplot2`/`plotly`) showing the number of cells per
##' pseudobulk group and warns if any group contains only one cell.
##'
##' @param object Seurat-class object.
##' @param var.group Character vector of metadata column names used to define
##' pseudobulk groups. When multiple columns are supplied, an
##' interaction of these columns defines the groups.
##' @param slot Character name of the assay data layer passed to
##' `AverageExpression()` (e.g., "data", "counts", or "scale.data").
##'
##' @return A data.frame of pseudobulk expression with columns `Gene` followed by
##' one column per pseudobulk group. Column names are sanitized to
##' contain only alphanumeric/underscore characters.
##'
##' @import Seurat
##' @import tidyverse
##' @import ggplot2
##' @import plotly
##' @importFrom dplyr select
##'
##' @export
#' @title Aggregate Counts (Pseudobulk)
#' @description Compute pseudobulk expression by averaging expression across groups
#' defined by one or more metadata columns, and return a tidy table.
#' @details Uses Seurat's `AverageExpression()` on the `SCT` assay to compute
#' group-wise average expression for each feature. Also produces a
#' bar plot (via `ggplot2`/`plotly`) showing the number of cells per
#' pseudobulk group and warns if any group contains only one cell.
#'
#' @param object Seurat-class object.
#' @param var.group Character vector of metadata column names used to define
#' pseudobulk groups. When multiple columns are supplied, an
#' interaction of these columns defines the groups.
#' @param slot Character name of the assay data layer passed to
#' `AverageExpression()` (e.g., "data", "counts", or "scale.data").
#' @param interactive If TRUE, draw plotly plot (default is FALSE)
#'
#' @import Seurat
#' @import tidyverse
#' @import ggplot2
#' @import plotly
#' @importFrom dplyr select
#'
#' @export
#'
#' @return A data.frame of pseudobulk expression with columns `Gene` followed by
#' one column per pseudobulk group. Column names are sanitized to
#' contain only alphanumeric/underscore characters.
#'
#' @examples
#' \dontrun{
#' out <- aggregateCounts(
#' object = seurat_obj,
#' var.group = c("orig.ident", "condition"),
#' slot = "data"
#' )
#' }

aggregateCounts <- function(object,
var.group,
slot){
slot="data",
interactive=FALSE){


## --------------- ##
Expand Down Expand Up @@ -73,16 +84,19 @@ aggregateCounts <- function(object,
))
}

p <- ggplotly(ggplot(df, aes(x = pseudobulk_group, y = Freq)) +
p <- ggplot(df, aes(x = pseudobulk_group, y = Freq)) +
geom_bar(stat = "identity", position = "stack") +
labs(y = "Counts", x = "Pseudobulk Groups", title = "Number of Cells in each Pseudobulk Group") +
theme(axis.text.x = element_text(angle = 90, hjust = 1)))
theme(axis.text.x = element_text(angle = 90, hjust = 1))

print(p)
if(interactive==T){
p <- ggplotly(p)
}

} else {
stop("All columns in var.group must be factors or characters")
}

return(pseudobulk)
return(list(data=pseudobulk,
plots=p))
}
26 changes: 16 additions & 10 deletions R/Annotate_Cell_Types.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#' @title Annotating cell types using SingleR module
#' @description SingleR is an automatic annotation method for single-cell
#' RNA sequencing (scRNAseq) data (Aran et al. 2019). Given a reference dataset
#' of samples (single-cell or bulk) with known labels, it labels new cells
#' from a test dataset based on similarity to the reference.
#' @title Cell Type Annotation with SingleR [CCBR] [scRNA-seq]
#' @description Annotate the cell types of your cells using SingleR (Aran et al., 2019). This
#' function takes a combined Seurat object after PC reduction and assigns cells
#' to a category (for example, stem cells or T cells) based on genomic profile.
#' @details This function is Step 5 of the basic Single-Cell RNA-seq workflow.
#' It is the starting point for downstream visualization, subsetting, and
#' analysis. It takes a combined seurat object as input, such as the one created
Expand All @@ -22,8 +21,7 @@
#' Default is NULL
#' @param use.clusters Provide cluster identities for each cell.
#' Default is NULL


#'
#'
#' @import Seurat
#' @import cowplot
Expand All @@ -36,9 +34,17 @@
#' @export
#'
#' @return a Seurat object with additional metadata



#'
#' @examples
#' \dontrun{
#' out <- annotateCellTypes(
#' object = combined_so,
#' species = "Human",
#' reduction.type = "umap"
#' )
#' }
#'
#'
annotateCellTypes <- function(object,
species = "Mouse",
reduction.type = "umap",
Expand Down
29 changes: 18 additions & 11 deletions R/Color_by_Gene.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@
#' @export
#'
#' @return a Seurat object with additional metadata or gene table and plot


#'
#' @examples
#' \dontrun{
#' out <- colorByGene(
#' object = anno_so,
#' samples.to.include = c("sample1", "sample2"),
#' gene = c("CD3D", "MS4A1"),
#' reduction.type = "umap"
#' )
#' }
#'

colorByGene <- function(object,
samples.to.include,
Expand Down Expand Up @@ -65,16 +74,14 @@ colorByGene <- function(object,
## --------------- ##


print(object)
# checking for samples
if(any(grepl('c\\(|\\[\\]',samples))) {
samples = eval(parse(text = gsub('\\[\\]', 'c()', samples)))
}else{
samples=samples
if (is.character(samples.to.include) && length(samples.to.include) == 1 &&
grepl('c\\(|\\[\\]', samples.to.include)) {
samples.to.include <- eval(parse(text = gsub('\\[\\]', 'c()', samples.to.include)))
}
# if none specified, using ALL
if (length(samples) == 0) {
samples = unique(object@meta.data$orig.ident)
if (length(samples.to.include) == 0) {
samples.to.include = unique(object@meta.data$orig.ident)
}

# Fix for underscore
Expand All @@ -85,13 +92,13 @@ colorByGene <- function(object,
names(sample.name) = names(object@active.ident)
object@active.ident <- as.factor(vector())
object@active.ident <- sample.name
object.sub = subset(object, ident = samples)
object.sub = subset(object, ident = samples.to.include)
} else {
sample.name = as.factor(object@meta.data$orig.ident)
names(sample.name) = names(object@active.ident)
object@active.ident <- as.factor(vector())
object@active.ident <- sample.name
object.sub = subset(object, ident = samples)
object.sub = subset(object, ident = samples.to.include)
}

#Check input for missing genes
Expand Down
Loading
Loading