Skip to content
Merged

V1.2 #29

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7eb09f9
add MSE and MSD evaluation
Aug 30, 2025
82302e2
updated NAMESPACE
Sep 1, 2025
a17e0a9
add Hellinger and KL divergence metrics
Sep 3, 2025
e525ee4
add functions to compute modularity score
Sep 10, 2025
eab57c1
correct ARI estimate for comparing singleton clusters
Sep 11, 2025
814320e
v1.1 updates, fix CyTOF
natalie-23-gill Dec 2, 2025
b3929ea
try fix for large package files due to vignette caching
natalie-23-gill Dec 15, 2025
dc37d05
Merge branch 'add_mse_assessment' into v1.1
natalie-23-gill Dec 15, 2025
6aea877
fix docs
natalie-23-gill Dec 16, 2025
0895652
Reorganize package, fix the flipped sign for KL divergence
natalie-23-gill Dec 17, 2025
fc4c02b
Add KL/Hellinger metric functions and rank-based resolution suggestio…
natalie-23-gill Dec 20, 2025
58ed899
fixes
natalie-23-gill Feb 1, 2026
55d126f
account for edge case
natalie-23-gill Feb 1, 2026
d23470f
another edge case
natalie-23-gill Feb 1, 2026
8959093
improve verbosity
natalie-23-gill Feb 13, 2026
ac9b94a
add another method for suggest resolution
natalie-23-gill Feb 18, 2026
8d99744
logging and performance improvements
natalie-23-gill Feb 19, 2026
9434aa8
performance improvements
natalie-23-gill Feb 20, 2026
15408de
bump version to 1.2, add changelog
natalie-23-gill Feb 20, 2026
7275e3a
logging improvements
natalie-23-gill Feb 20, 2026
9e29d63
bump R version
natalie-23-gill Mar 13, 2026
e7a11e9
Add vignette-check CI workflow and contribution guide
natalie-23-gill Mar 25, 2026
c5b4851
Update visualization, suggest_resolution docs, and rebuild site
natalie-23-gill Mar 25, 2026
23ae916
Add code of conduct, vignette cache, and update gitignore
natalie-23-gill Mar 25, 2026
867cc10
Add vignette cache to gitignore
natalie-23-gill Mar 25, 2026
e69a818
remove vignette cache
natalie-23-gill Mar 25, 2026
4cfe3d4
fix tests
natalie-23-gill Mar 25, 2026
e18b030
fix CI
natalie-23-gill Mar 25, 2026
b40b66b
fix tests
natalie-23-gill Mar 25, 2026
51a5456
use simpler thresholds
natalie-23-gill 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
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
^\.vscode$
^Dockerfile$
^_pkgdown\.yml$
^docs$
^docs$
^vignettes/.*_cache$
6 changes: 3 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: '4.4'}
- {os: windows-latest, r: '4.4'}
- {os: ubuntu-latest, r: '4.4'}
- {os: macos-latest, r: '4.5'}
- {os: windows-latest, r: '4.5'}
- {os: ubuntu-latest, r: '4.5'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
pull_request:
branches: [main, master]

name: vignette-check

permissions: read-all

jobs:
vignette-check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check vignette freshness
id: check
run: |
# Check if any source files changed that could affect the vignette
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- 'R/' 'man/' 'DESCRIPTION' 'NAMESPACE' 'vignettes/*.Rmd' '_pkgdown.yml')
if [ -z "$CHANGED" ]; then
echo "source_changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "source_changed=true" >> "$GITHUB_OUTPUT"

# Check the rendered vignette for its compile date
VIGNETTE="docs/articles/quick_start_guide.html"
if [ ! -f "$VIGNETTE" ]; then
echo "status=missing" >> "$GITHUB_OUTPUT"
exit 0
fi

# Extract the "Compiled: YYYY-MM-DD" date from the rendered HTML
COMPILE_DATE=$(grep -oP 'Compiled: \K[0-9]{4}-[0-9]{2}-[0-9]{2}' "$VIGNETTE" || true)
if [ -z "$COMPILE_DATE" ]; then
echo "status=no_date" >> "$GITHUB_OUTPUT"
exit 0
fi

# Find the most recent commit date for source files on this branch
LAST_SOURCE_CHANGE=$(git log -1 --format=%cs origin/${{ github.base_ref }}...HEAD -- 'R/' 'man/' 'DESCRIPTION' 'NAMESPACE' 'vignettes/*.Rmd')
echo "compile_date=$COMPILE_DATE" >> "$GITHUB_OUTPUT"
echo "last_source_change=$LAST_SOURCE_CHANGE" >> "$GITHUB_OUTPUT"

if [[ "$COMPILE_DATE" < "$LAST_SOURCE_CHANGE" ]]; then
echo "status=stale" >> "$GITHUB_OUTPUT"
else
echo "status=fresh" >> "$GITHUB_OUTPUT"
fi

- name: Post vignette status comment
if: steps.check.outputs.source_changed == 'true' && steps.check.outputs.status != 'fresh'
uses: marocchino/sticky-pull-request-comment@v3
with:
header: vignette-check
message: |
${{ steps.check.outputs.status == 'stale' && format('⚠️ **Vignette and site are out of date.** Compiled on {0} but source files were changed on {1}.', steps.check.outputs.compile_date, steps.check.outputs.last_source_change) || steps.check.outputs.status == 'missing' && '⚠️ **Rendered vignette not found.** No `docs/articles/quick_start_guide.html` in this branch.' || '⚠️ **Could not determine vignette compile date.** Please verify it has been re-rendered.' }}

Please rebuild the site locally before merging:

```r
pkgdown::build_site()
```

The vignette requires the tutorial dataset and ~32GB RAM, so it cannot be built in CI.

- name: Clear stale comment if vignette is fresh
if: steps.check.outputs.status == 'fresh'
uses: marocchino/sticky-pull-request-comment@v3
with:
header: vignette-check
delete: true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ inst/doc
/Meta/
.vscode/
CLAUDE.md
.claude
.claude
local_only
vignettes/quick_start_guide_cache/
133 changes: 133 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[natalie.gill@gladstone.ucsf.edu](mailto:natalie.gill@gladstone.ucsf.edu).

All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[faq]: https://www.contributor-covenant.org/faq
[homepage]: https://www.contributor-covenant.org
[mozilla coc]: https://github.com/mozilla/diversity
[translations]: https://www.contributor-covenant.org/translations
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
77 changes: 77 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributing to clustOpt

## Before You Start

- **Open an issue first.** Before writing code, open an issue describing the bug or feature so we can discuss the approach. This avoids wasted effort on changes that may not fit the project direction.
- **Keep PRs focused.** One bug fix or feature per PR. Smaller PRs are easier to review and merge.
- **Run `devtools::check()` before submitting.** CI can be slow with the R dependency install -- catching issues locally saves time for everyone.
- **Questions?** Open a [GitHub issue](https://github.com/gladstone-institutes/clustOpt/issues) if you get stuck or need guidance.

## Development Workflow

1. [Fork the repository and create a feature branch](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) from `main`.
2. Make code changes in `R/`, `man/`, etc.
3. `devtools::document()` to regenerate roxygen docs.
4. `devtools::test()` to run tests.
5. When ready to merge, rebuild the site (includes the vignette):
```r
pkgdown::build_site()
```
6. Commit everything including `docs/`.
7. Open a pull request against `main`. CI will run R-CMD-check and verify the vignette compile date is current.

## Development Setup

```r
# Install dependencies
devtools::install_deps(dependencies = TRUE)

# Load package for interactive development
devtools::load_all()

# Run tests
devtools::test()

# Check package
devtools::check()
```

## Code Style

This package follows the [tidyverse style guide](https://style.tidyverse.org/). The [`styler`](https://styler.r-lib.org/) package can help format code automatically:

```r
# Style a single file
styler::style_file("R/clust_opt.R")

# Style the whole package
styler::style_pkg()
```

Use `roxygen2` for documentation and run `devtools::document()` to regenerate man pages.

Verbosity levels for user-facing functions: 0 = silent, 1 = milestones, 2 = detailed, 3 = includes Seurat output. Use `cli` for all user-facing messages.

## Versioning

This package uses [semantic versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`). Most PRs should **not** bump the version -- version bumps are coordinated by maintainers at release time.

- **PATCH** (e.g., 1.2 -> 1.2.1): Bug fixes, documentation updates, internal refactors with no user-facing changes.
- **MINOR** (e.g., 1.2 -> 1.3): New features, new exported functions, or changes to default behavior.
- **MAJOR** (e.g., 1.3 -> 2.0): Breaking changes to the API (renamed/removed functions, changed return types).

When a version bump is needed, update `Version` and `Date` in `DESCRIPTION` and add a section to `NEWS.md`.

## Rebuilding the Vignette and Site

The vignette requires the tutorial dataset and ~32GB RAM, so it cannot be built in CI. Before merging any PR that changes package source or documentation, rebuild the site locally:

```r
pkgdown::build_site()
```

This rebuilds the full site including reference docs and the vignette.

Commit the updated `docs/` directory with your PR.

The CI will warn on PRs if the vignette's compile date is older than the most recent source change. The check uses day granularity, so rebuild after all source changes are finalized -- any source commits made after the vignette was last rendered will trigger the warning.
27 changes: 15 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: clustOpt
Version: 1.0
Date: 2024-07-22
Version: 1.2
Date: 2025-02-20
Title: Optimizing Clustering Resolution for Multi-subject Single Cell Studies
Description: Optimal clustering resolution parameters determined through Random Forests, a silhouette score-based assessment of clustering validity, and subject-wise cross-validation.
Author: Natalie Gill [aut, cre], Reuben Thomas [aut], Min-Gyoung Shin [aut], Ayushi Agrawal [aut]
Expand All @@ -11,8 +11,9 @@ Authors@R: c(person("Natalie", "Gill", role = c("aut", "cre"), email = "natalie.
person("Erwin", "Perez", role = c("aut"), email = "perezerw@usc.edu"),
person("Reuben", "Thomas", role = c("aut"), email = "reuben.thomas@gladstone.ucsf.edu"))
Depends:
R (>= 4.4)
R (>= 4.5.0)
Imports:
cli,
progressr,
future.apply,
ranger,
Expand All @@ -22,24 +23,26 @@ Imports:
dplyr (>= 1.1.3),
ggplot2 (>= 3.3.5),
purrr (>= 0.3.4),
tibble (>= 3.2.1),
tidyr,
Matrix,
methods,
stats,
rlang
License: MIT + file LICENSE
URL: https://gladstone-institutes.github.io/clustOpt, https://github.com/gladstone-institutes/clustOpt
BugReports: https://github.com/gladstone-institutes/clustOpt/issues
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Encoding: UTF-8
Collate:
'pca_split.R'
'utils.R'
'clustOpt.R'
'plot.R'
Suggests:
Collate:
'metrics.R'
'data_preparation.R'
'sketching.R'
'validation.R'
'clust_opt.R'
'visualization.R'
Suggests:
knitr,
rmarkdown,
tidyr,
testthat (>= 3.0.0),
BPCells,
glmGamPoi
Expand Down
Loading
Loading