Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/EliHei2/segger_dev into main
Browse files Browse the repository at this point in the history
Conflicts:
	docs/notebooks/segger_tutorial.ipynb
	src/segger/cli/configs/predict/default.yaml
	src/segger/cli/configs/train/default.yaml
  • Loading branch information
andrewmoorman committed Nov 30, 2024
2 parents c4cf2ee + 98861e2 commit 874e970
Show file tree
Hide file tree
Showing 88 changed files with 9,839 additions and 3,177 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/➕-performance-improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: "➕ Performance Improvement"
about: Suggest an improvement in the performance
title: ""
labels: ""
assignees: andrewmoorman, EliHei2
---

**Describe the issue with the current implementation**
A clear and concise description of what is wrong or not efficient in the implementation.

**Suggested improvement**
If you know how to fix it, provide suggestions on what to change.

**Additional context**
Any other context or screenshots that might help clarify the issue.
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/🐛-bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: "\U0001F41B Bug Report"
about: Create a report to help us improve
title: "[BUG]"
labels: ""
assignees: andrewmoorman, EliHei2
---

---

name: Bug Report
about: Report a bug or unexpected behavior
title: "[BUG] "
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots or logs**
If applicable, add screenshots or logs to help explain your problem.

**Environment (please complete the following information):**

- OS: [e.g. macOS, Windows, Linux]
- Python version: [e.g. 3.9]
- Package version: [e.g. 1.2.3]

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/🚀-feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: "\U0001F680 Feature Request"
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
33 changes: 16 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@ permissions:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
42 changes: 18 additions & 24 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Deploy MkDocs to GitHub Pages

on:
push:
branches: ["main"] # Change "main" to your default branch if necessary

# Allows you to run this workflow manually from the Actions tab
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
contents: write
pages: write
id-token: write

Expand All @@ -21,38 +19,34 @@ jobs:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: "3.10"

# Step 3: Install your package from the repository
- name: Install package
- name: Install package and documentation dependencies
run: |
export PYTHONPATH='./src'
export PYTHONPATH='./src/segger'
# Step 4: Install MkDocs and dependencies
- name: Install dependencies
pip install -e .
- name: Install MkDocs and plugins
run: |
pip install mkdocs mkdocs-material mkdocs-autorefs mkdocstrings[python] mkdocs-jupyter pymdown-extensions termynal mkdocs-minify-plugin
# Step 5: Build the MkDocs site
- name: Debug environment
run: |
python -m pip freeze
python -m mkdocs --version
- name: Build MkDocs site
run: mkdocs build --verbose

# Step 6: Upload the generated site directory as an artifact for GitHub Pages
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './site' # Only upload the generated `site` folder

# Step 7: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
mkdocs gh-deploy --force --remote-name origin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,12 @@ cython_debug/


data_*
data/*
model_*

*.egg_info
figure*

dev*
.DS_Store
.idea/
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fail_fast: false
default_language_version:
python: python3
default_stages:
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
ci:
skip: []
repos:
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
docs/*
mkdocs.yml
46 changes: 12 additions & 34 deletions .scripts/create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from pathlib import Path
from urllib import request
from segger.data.utils import XeniumSample
from segger.data.io import XeniumSample


def download_file(url, dest):
Expand Down Expand Up @@ -30,9 +30,7 @@ def main(args):
download_file(transcripts_url, transcripts_path)
download_file(nuclei_url, nuclei_path)

xs = XeniumSample().load_transcripts(
path=transcripts_path, min_qv=args.min_qv
)
xs = XeniumSample().load_transcripts(path=transcripts_path, min_qv=args.min_qv)
xs.load_nuclei(path=nuclei_path)

if args.parallel:
Expand Down Expand Up @@ -83,9 +81,7 @@ def main(args):


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Create dataset from Xenium Human Pancreatic data."
)
parser = argparse.ArgumentParser(description="Create dataset from Xenium Human Pancreatic data.")
parser.add_argument(
"--raw_data_dir",
type=str,
Expand All @@ -104,9 +100,7 @@ def main(args):
required=True,
help="URL for transcripts data.",
)
parser.add_argument(
"--nuclei_url", type=str, required=True, help="URL for nuclei data."
)
parser.add_argument("--nuclei_url", type=str, required=True, help="URL for nuclei data.")
parser.add_argument(
"--min_qv",
type=int,
Expand All @@ -125,21 +119,11 @@ def main(args):
default=180,
help="Step size in y direction for tiles.",
)
parser.add_argument(
"--x_size", type=int, default=200, help="Width of each tile."
)
parser.add_argument(
"--y_size", type=int, default=200, help="Height of each tile."
)
parser.add_argument(
"--margin_x", type=int, default=None, help="Margin in x direction."
)
parser.add_argument(
"--margin_y", type=int, default=None, help="Margin in y direction."
)
parser.add_argument(
"--r_tx", type=int, default=3, help="Radius for building the graph."
)
parser.add_argument("--x_size", type=int, default=200, help="Width of each tile.")
parser.add_argument("--y_size", type=int, default=200, help="Height of each tile.")
parser.add_argument("--margin_x", type=int, default=None, help="Margin in x direction.")
parser.add_argument("--margin_y", type=int, default=None, help="Margin in y direction.")
parser.add_argument("--r_tx", type=int, default=3, help="Radius for building the graph.")
parser.add_argument(
"--val_prob",
type=float,
Expand All @@ -158,9 +142,7 @@ def main(args):
default=3,
help="Number of nearest neighbors for nuclei.",
)
parser.add_argument(
"--dist_nc", type=int, default=10, help="Distance threshold for nuclei."
)
parser.add_argument("--dist_nc", type=int, default=10, help="Distance threshold for nuclei.")
parser.add_argument(
"--k_tx",
type=int,
Expand All @@ -179,12 +161,8 @@ def main(args):
default=True,
help="Whether to compute edge labels.",
)
parser.add_argument(
"--sampling_rate", type=float, default=1, help="Rate of sampling tiles."
)
parser.add_argument(
"--parallel", action="store_true", help="Use parallel processing."
)
parser.add_argument("--sampling_rate", type=float, default=1, help="Rate of sampling tiles.")
parser.add_argument("--parallel", action="store_true", help="Use parallel processing.")
parser.add_argument(
"--num_workers",
type=int,
Expand Down
24 changes: 6 additions & 18 deletions .scripts/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def main(args: argparse.Namespace) -> None:


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Predict using the Segger model"
)
parser = argparse.ArgumentParser(description="Predict using the Segger model")
parser.add_argument(
"--dataset_path",
type=str,
Expand All @@ -51,24 +49,16 @@ def main(args: argparse.Namespace) -> None:
required=True,
help="Path to the model checkpoint",
)
parser.add_argument(
"--init_emb", type=int, default=8, help="Initial embedding size"
)
parser.add_argument("--init_emb", type=int, default=8, help="Initial embedding size")
parser.add_argument(
"--hidden_channels",
type=int,
default=64,
help="Number of hidden channels",
)
parser.add_argument(
"--out_channels", type=int, default=16, help="Number of output channels"
)
parser.add_argument(
"--heads", type=int, default=4, help="Number of attention heads"
)
parser.add_argument(
"--aggr", type=str, default="sum", help="Aggregation method"
)
parser.add_argument("--out_channels", type=int, default=16, help="Number of output channels")
parser.add_argument("--heads", type=int, default=4, help="Number of attention heads")
parser.add_argument("--aggr", type=str, default="sum", help="Aggregation method")
parser.add_argument(
"--score_cut",
type=float,
Expand All @@ -81,9 +71,7 @@ def main(args: argparse.Namespace) -> None:
default=4,
help="Number of nearest neighbors for nuclei",
)
parser.add_argument(
"--dist_nc", type=int, default=20, help="Distance threshold for nuclei"
)
parser.add_argument("--dist_nc", type=int, default=20, help="Distance threshold for nuclei")
parser.add_argument(
"--k_tx",
type=int,
Expand Down
Loading

0 comments on commit 874e970

Please sign in to comment.