Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: poetry install -E dev --no-interaction

- name: Run pre-commit (required)
run: poetry run pre-commit run --all-files --show-diff-on-failure

test-build:
needs: pre-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: poetry install -E dev --no-interaction

- name: Run tests with coverage (Ubuntu 3.12)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: poetry run pytest --cov=buscar --cov-report=term-missing --cov-report=xml

- name: Upload coverage artifact
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml

- name: Run tests
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.12'
run: poetry run pytest

- name: Build package
run: poetry build

- name: Validate wheel import
shell: bash
run: |
poetry run python -m pip install --upgrade pip
poetry run python -m pip install dist/*.whl
poetry run python -c "import buscar; print(buscar.__name__)"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ data/

# ignoring prototype files
_*
!**/__init__.py
!**/__main__.py

# ignoring results files as they are generated when running the notebooks
# also to prevent storing large datasets
Expand All @@ -176,3 +178,6 @@ results/

# ignore .vscode settings
.vscode/

# ignore analytical notebooks
notebooks*
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repos:
rev: v6.0.0
hooks:
- id: check-yaml
exclude: ^recipe/meta\.yaml$
- id: check-json
- id: check-merge-conflict
- id: check-added-large-files
Expand Down Expand Up @@ -35,7 +36,7 @@ repos:

# Ruff for linting and formatting Python files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
rev: v0.15.5
hooks:
- id: ruff-check
args: ["--fix"]
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Erik Serrano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,58 @@ buscar has 5 main modules:
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Signatures | Identifies morphological features between two profiles (e.g., healthy vs. disease). Features altered by perturbations are "on-morphology signatures"; unchanged features are "off-morphological features." This distinction helps pinpoint impacted features and track off-target effects. |
| Heterogeneity | Assesses heterogeneity within single-cell populations using (1) dimensionality reduction (e.g., UMAP or PCA), and (2) clustering. Cells are mapped back to their original space to assign cluster labels. |
| Refinement | Evaluates clusters from the Heterogeneity module to remove uninformative or small clusters (e.g., those with few cells), which can skew phenotypic measurements due to label imbalance. |
| Activity | Measures the phenotypic activity of selected treatment groups versus controls using both on-morphology and off-morphological signatures. Produces two scores: one for on-morphology activity, and one for off-morphology activity. |
| Hits | Identifies compounds that perform well based on both on-morphology and off-morphological activity scores from the Activity module. |

## How to install

### 1. Clone the Repository
### Option 1: Use Buscar (pip install)

Start by cloning the buscar repository and navigating into the project directory:
If you only want to use the package, install it directly from PyPI:

```bash
python -m pip install buscar
```

### Option 2: Develop Buscar (clone + Poetry)

If you want to modify code, run tests, or contribute:

1. Clone the repository

```bash
git clone https://github.com/WayScience/buscar.git
cd buscar
```

### 2. Set Up a Conda Environment

Create and activate a dedicated Conda environment for buscar:
2. Create a Python 3.10+ environment

```bash
conda create -n buscar python=3.12
conda activate buscar
```

### 3. Install Poetry

Install Poetry within your Conda environment to manage project dependencies:
3. Install Poetry

```bash
conda install poetry
conda install -c conda-forge poetry
```

### 4. Install Project Dependencies
4. Run tests

```bash
poetry run pytest
```

With Poetry installed and your environment activated, install all required dependencies:
Run tests with coverage:

```bash
poetry install
poetry run pytest --cov=buscar --cov-report=term-missing
```

This command will set up all packages as specified in the `pyproject.toml` and `poetry.lock` files.
5. Build and install wheel with pip (optional release check)

```bash
poetry build
pip install dist/*.whl
```
Loading