Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

Commit

Permalink
linting infix operators
Browse files Browse the repository at this point in the history
  • Loading branch information
agdenadel committed Feb 12, 2024
1 parent 4ed1090 commit c12547d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
22 changes: 11 additions & 11 deletions R/callback.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#' @title Runs a typical Seurat workflow on a Seurat object (up to
#' @title Runs a typical Seurat workflow on a Seurat object (up to
#' dimensionality reduction and clustering).
#'
#' @description Given a Seurat object, returns a new Seurat that has been
#' normalized, had variable features identified, scaled, had principal
#' components computed, hadclusters identified, and had tSNE and UMAP
#' embeddings determined.
#'
#' @details
#' @details
#'
#' @param seurat_obj The Seurat object that will be analyzed.
#' @param resolution_start The starting resolution to be used for the
Expand All @@ -20,22 +20,22 @@
#' @param assay The assay to generate knockoffs from.
#' @param cores The number of cores to compute marker genes in parallel.
#' @returns Returns a Seurat object where the idents have been updated with the
#' clusters determined via the callback algorithm.
#' clusters determined via the callback algorithm.
#' @param verbose Whether or not to show all logging.
#' Latest clustering results will be stored in the object metadata under
#' callback_clusters'. Note that 'callback_clusters' will be overwritten ever
#' time FindClustersKC is run.
#' @name FindClustersCallback
#' @export
FindClustersCallback <- function(seurat_obj,

Check warning on line 30 in R/callback.R

View workflow job for this annotation

GitHub Actions / run-lint

file=/github/workspace/R/callback.R,line=30,col=1,[cyclocomp_linter] Functions should have cyclomatic complexity of less than 15, this has 22.

Check warning on line 30 in R/callback.R

View workflow job for this annotation

GitHub Actions / run-lint

file=/github/workspace/R/callback.R,line=30,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.
resolution_start=0.8,
reduction_percentage=0.2,
num_clusters_start=20,
dims=1:10,
algorithm="louvain", # todo implement all algos
assay="RNA",
cores=1,
verbose=TRUE) {
resolution_start = 0.8,
reduction_percentage = 0.2,
num_clusters_start = 20,
dims = 1:10,
algorithm = "louvain", # todo implement all algos
assay = "RNA",
cores = 1,
verbose = TRUE) {

# todo check function arguments for validity

Check warning on line 41 in R/callback.R

View workflow job for this annotation

GitHub Actions / run-lint

file=/github/workspace/R/callback.R,line=41,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
Expand Down
15 changes: 10 additions & 5 deletions R/seurat_workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param assay The assay to generate knockoffs from.
#' @returns A Seurat object that contains the original variable features and an equal number of knockoff features.
#' @name get_seurat_obj_with_knockoffs
get_seurat_obj_with_knockoffs <- function(seurat_obj, assay="RNA") {
get_seurat_obj_with_knockoffs <- function(seurat_obj, assay = "RNA") {
var.features <- Seurat::VariableFeatures(seurat_obj)
#seurat_obj_data <- as.data.frame(t(as.matrix(seurat_obj@assays$RNA@counts)))

Expand Down Expand Up @@ -47,9 +47,9 @@ get_seurat_obj_with_knockoffs <- function(seurat_obj, assay="RNA") {
cluster_optimal_louvain_resolution_parameter <- function(seurat_obj,
original_num_clusters,
num_variable_features,
res_start=0.1,
res_end=3,
res_increment=0.05) {
res_start = 0.1,
res_end = 3,
res_increment = 0.05) {

# todo make this more efficient
# todo move this function into flow so that it happens automatically and doesn't repeat computation
Expand Down Expand Up @@ -108,7 +108,12 @@ cluster_optimal_louvain_resolution_parameter <- function(seurat_obj,
#' @returns A Seurat object containing the relevant analysis results.
#' @export
#' @name seurat_workflow
seurat_workflow <- function(seurat_obj, num_variable_features, resolution_param=0.5, visualization_method="umap", num_dims=10, algorithm="louvain") {
seurat_workflow <- function(seurat_obj,
num_variable_features,
resolution_param = 0.5,
visualization_method = "umap",
num_dims = 10,
algorithm = "louvain") {
seurat_obj <- Seurat::NormalizeData(seurat_obj)

seurat_obj <- Seurat::FindVariableFeatures(seurat_obj, selection.method = "vst", nfeatures = num_variable_features)
Expand Down

0 comments on commit c12547d

Please sign in to comment.