Skip to content

Commit

Permalink
Merge pull request #582 from AlexsLemonade/allyhawkins/compress-v0.6.3
Browse files Browse the repository at this point in the history
Compress cluster output and update tag
  • Loading branch information
allyhawkins committed Nov 17, 2023
2 parents cf78909 + 847319d commit 01f6b19
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 78 deletions.
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# All available hooks: https://pre-commit.com/hooks.html
repos:
- repo: local
hooks:
- id: spell-check
name: Spell check files
language: r
entry: Rscript scripts/spell-check.R
additional_dependencies:
- readr
- rprojroot
- spelling
- tidyr
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .RData, or .Rds files.
language: fail
files: '(?i)\.(Rhistory|RData|rds)$'
# `exclude: <regex>` to allow committing specific files
- repo: https://github.com/thlorenz/doctoc
# Update TOCs
rev: v2.2.0
hooks:
- id: doctoc
args: [--update-only]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff for linting and formatting python
rev: v0.1.5
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- repo: https://github.com/lorenzwalthert/precommit
# R styling and linting
rev: v0.3.2.9025
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
# - id: lintr #skip R linting for now...
- id: parsable-R
- repo: https://github.com/pre-commit/mirrors-prettier
# Format YAML and other languages
rev: v3.0.3
hooks:
- id: prettier
exclude: '\.md$'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=200"]
- id: end-of-file-fixer
exclude: '\.Rd'
6 changes: 2 additions & 4 deletions bin/cluster_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ sce <- readr::read_rds(opt$processed_sce_file)

# only perform clustering if reduced dimension embeddings are present
# otherwise just return the object
if(!opt$pca_name %in% reducedDimNames(sce)) {
if (!opt$pca_name %in% reducedDimNames(sce)) {
warning("No reduced dimensions present with provided `pca_name`, skipping clustering")
} else {

# Perform clustering ----------------

# extract the principal components matrix
Expand All @@ -89,9 +88,8 @@ if(!opt$pca_name %in% reducedDimNames(sce)) {
metadata(sce)$cluster_algorithm <- opt$cluster_algorithm
metadata(sce)$cluster_weighting <- opt$cluster_weighting
metadata(sce)$cluster_nn <- opt$nearest_neighbors

}

# export -------------------
# we are overwriting the `processed_sce_file` here
readr::write_rds(sce, opt$processed_sce_file)
readr::write_rds(sce, opt$processed_sce_file, compress = "gz")

0 comments on commit 01f6b19

Please sign in to comment.