Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Standardize parameters so that _->. and fix typo in parameter
  • Loading branch information
phoman14 committed Mar 24, 2026
commit 548fd8b4f15b982491943635541b4f4949ceb329
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
Comment thread
phoman14 marked this conversation as resolved.
)
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
42 changes: 21 additions & 21 deletions R/Filter_QC.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
#' Usage c(lower limit, Upper Limit). E.g. setting to c(5,5) will remove all
#' cells with more than 5 absolute deviations greater than or 5 absolute
#' deviations less than the median percentage. (Default: c(5,5))
#' @param n.topgnes Select the number of top highly expressed genes used to
#' @param n.topgenes Select the number of top highly expressed genes used to
#' calculate the percentage of reads found in these genes.
#' E.g. a value of 20 calculates the percentage of reads found in the top 20
#' most highly expressed Genes.
#' (Default: 20)
#' @param do.doublets.fitler Use scDblFinder to identify and remove doublet
#' @param do.doublets.filter Use scDblFinder to identify and remove doublet
#' cells. Doublets are defined as two cells that are sequenced under the same
#' cellular barcode, for example, if they were captured in the same droplet.
#' (Default: TRUE)
Expand Down Expand Up @@ -125,8 +125,8 @@ filterQC <- function(object,
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=TRUE,

## dim Reduction settings
plot.outliers="None", #options(None,UMAP,tSNE)
Expand All @@ -138,7 +138,7 @@ filterQC <- function(object,
high.cut.disp = 100000,
selection.method = "vst",
npcs = 30,
vars_to_regress=NULL,
vars.to.regress=NULL,
seed.for.PCA = 42,
seed.for.TSNE = 1,
seed.for.UMAP = 42
Expand All @@ -155,15 +155,15 @@ filterQC <- function(object,

### Helper Functions #####

.topNGenes <- function(so,n.topgnes) {
.topNGenes <- function(so,n.topgenes) {
##Extract counts table
counts_matrix = GetAssayData(so, slot="counts")

## calculate Counts in Top n genes
tbl= apply(counts_matrix,2,function(i){
cnts=i[order(i,decreasing=T)]

t20=sum(cnts[1:n.topgnes])
t20=sum(cnts[1:n.topgenes])
total=sum(cnts)

pertop20=(t20/total)*100
Expand Down Expand Up @@ -214,7 +214,7 @@ filterQC <- function(object,
.plotViolin2=function(count.df,value){
axis.lab = unique(count.df$filt)
ylabs=gsub(" \\(", "\n\\(",value)
ylabs=gsub(paste0(" Top",n.topgnes), paste0("\nTop",n.topgnes),ylabs)
ylabs=gsub(paste0(" Top",n.topgenes), paste0("\nTop",n.topgenes),ylabs)

### Set up table fore cut off lines
## clean up cutoff values
Expand Down Expand Up @@ -301,7 +301,7 @@ filterQC <- function(object,
# count.df$filt=factor(count.df$filt,levels = c('filt','raw'))
count.df$filt=factor(count.df$filt,levels = c('raw','filt'))
ylabs=gsub(" \\(", "\n\\(",value)
ylabs=gsub(paste0(" Top",n.topgnes), paste0("\nTop",n.topgnes),ylabs)
ylabs=gsub(paste0(" Top",n.topgenes), paste0("\nTop",n.topgenes),ylabs)

### Set up table fore cut off lines
## clean up cutoff values
Expand Down Expand Up @@ -469,7 +469,7 @@ filterQC <- function(object,
xlab = as.character(xaxis)
ylab = as.character(yaxis)
ylab=gsub(" \\(", "\n\\(",ylab)
ylab=gsub(paste0(" Top",n.topgnes), paste0("\nTop",n.topgnes),ylab)
ylab=gsub(paste0(" Top",n.topgenes), paste0("\nTop",n.topgenes),ylab)

name = paste(ylab,"vs.",xlab)
g =ggplot(count.df, aes(x=.data[[xaxis]], y=.data[[yaxis]],color = Sample))+
Expand Down Expand Up @@ -510,7 +510,7 @@ filterQC <- function(object,
.plotViolinPost2=function(count.df,yaxis){
axis.lab = unique(count.df$Sample)
ylabs=gsub(" \\(", "\n\\(",yaxis)
ylabs=gsub(paste0(" Top",n.topgnes), paste0("\nTop",n.topgnes),ylabs)
ylabs=gsub(paste0(" Top",n.topgenes), paste0("\nTop",n.topgenes),ylabs)


g=ggplot(count.df, aes(x=Sample, y=(.data[[yaxis]]))) +
Expand Down Expand Up @@ -548,7 +548,7 @@ filterQC <- function(object,

if(plot.outliers!="none"){
so.nf.qcFiltr <- SCTransform(so.nf,do.correct.umi = TRUE,
vars.to.regress=vars_to_regress,
vars.to.regress=vars.to.regress,
return.only.var.genes = FALSE)
so.nf.qcFiltr = FindVariableFeatures(object = so.nf.qcFiltr,
nfeatures = nfeatures,
Expand Down Expand Up @@ -625,7 +625,7 @@ filterQC <- function(object,
## Caluclate filter Metrics

## calculate Counts in Top 20 Genes
so=.topNGenes(so,n.topgnes)
so=.topNGenes(so,n.topgenes)

## Counts(umi) Filter
mad.ncounts.limits=.madCalc(so,'nCount_RNA',mad.ncounts.limits)
Expand Down Expand Up @@ -700,7 +700,7 @@ filterQC <- function(object,
)

## doublets Filter
if(do.doublets.fitler==T){
if(do.doublets.filter==T){
doublets.fitler <- so@meta.data$Doublet%in%"singlet"
}else{
doublets.fitler=rep(TRUE,nrow(so@meta.data))
Expand Down Expand Up @@ -749,7 +749,7 @@ filterQC <- function(object,
filtSum[,"Cells before Filtering"]=nrow(filter_matrix)
filtSum[,"Cells after all Filters"]=sum(filterIndex)
filtSum[,"Percent Remaining"]=perc.remain
topN.filterRename=paste0('% Counts in Top',n.topgnes,' Genes filter')
topN.filterRename=paste0('% Counts in Top',n.topgenes,' Genes filter')
filtTbl=colSums(filter_matrix==F)%>%t()%>%as.data.frame()
filtTbl=rename(filtTbl,
'UMI Count (nCount_RNA)' = 'ncounts.filter',
Expand All @@ -767,7 +767,7 @@ filterQC <- function(object,

########################################################## #
## create Filter Limits table
topN.filterRename=paste0('% Counts in Top',n.topgnes,' Genes')
topN.filterRename=paste0('% Counts in Top',n.topgenes,' Genes')
cat('VDJ Genes Removed: ',length(VDJgenesOut), '\n')
cat('Minimum Cells per Gene: ',min.cells,'\n')
cat('UMI Count (nCount_RNA) Limits: ',ncounts.limits,'\n')
Expand All @@ -780,7 +780,7 @@ filterQC <- function(object,
cat('MAD Complexity (log10GenesPerUMI) Limits: ',mad.complexity.limits,'\n')
cat(topN.filterRename,' Limits: ',topNgenes.limits,'\n')
cat('MAD ',topN.filterRename,' Limits: ',mad.topNgenes.limits,'\n')
cat('Doublets Filter: ',do.doublets.fitler,'\n')
cat('Doublets Filter: ',do.doublets.filter,'\n')



Expand Down Expand Up @@ -821,7 +821,7 @@ filterQC <- function(object,
paste0(c("Low:","High:"),topNgenes.limits)%>%paste(collapse = "\n")
FiltLmts[,paste0('MAD ',topN.filterRename,'')]=
paste0(c("Low:","High:"),mad.topNgenes.limits)%>%paste(collapse = "\n")
FiltLmts[,'DoubletFinder (scDblFinder)']=do.doublets.fitler
FiltLmts[,'DoubletFinder (scDblFinder)']=do.doublets.filter
rownames(FiltLmts)=i

### Apply Filters ####
Expand Down Expand Up @@ -878,13 +878,13 @@ filterQC <- function(object,

## calculate Counts in Top 20 Genes
##calculated after min.cell filter as well
so=.topNGenes(so,n.topgnes)
so=.topNGenes(so,n.topgenes)

## Annotate Doublets: ####
## Gene filter does not effect doublet ident and so not recalculated


if( do.doublets.fitler==T){
if( do.doublets.filter==T){
sce <- as.SingleCellExperiment(so)

set.seed(123)
Expand Down Expand Up @@ -995,7 +995,7 @@ filterQC <- function(object,
table.meta$nFeature_RNA=as.numeric(table.meta$nFeature_RNA)
table.meta$filt=factor(table.meta$filt,levels = c('raw','filt'))

topN.filterRename=paste0('% Counts in Top',n.topgnes,' Genes')
topN.filterRename=paste0('% Counts in Top',n.topgenes,' Genes')

table.meta=rename(table.meta,
'UMI Count (nCount_RNA)' = 'nCount_RNA',
Expand Down
6 changes: 3 additions & 3 deletions R/Harmony.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ harmonyBatchCorrect <- function(object,
nvar = 2000,
genes.to.add = c(),
group.by.var,
return_lognorm = T,
return.lognorm = T,
npc = 30) {

library(patchwork)
Expand Down Expand Up @@ -145,7 +145,7 @@ library(RColorBrewer)
object@reductions$pca@stdev <- pppca$d

# Store original log-normalized data and scaling parameters for back-calculation
if (return_lognorm) {
if (return.lognorm) {
library(Matrix)
# Get log-normalized data for the variable features
lognorm_data <- object@assays$SCT@data[mvf, , drop = FALSE]
Expand Down Expand Up @@ -225,7 +225,7 @@ library(RColorBrewer)

# Store batch-corrected scaled data in Harmony assay

if (return_lognorm) {
if (return.lognorm) {
# Fast conversion back to log-normalized space
# Direct vectorized operations on the transposed matrix
harm.lvl.backcalc.lognorm <- t(harm.lvl.backcalc.scaled) * scaling_params$scale[mvf] + scaling_params$center[mvf]
Expand Down
Loading