Skip to content

Commit

Permalink
integrated workflow friom david
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonkoehn committed Sep 24, 2024
2 parents 4dd2a35 + a72f9e2 commit 2c25ba6
Show file tree
Hide file tree
Showing 24 changed files with 115,481 additions and 32 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test-snake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Snakemake CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11.2"]
poetry-version: ["1.8.3"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.6-0'
environment-file: environment.yml
init-shell: >-
bash
cache-environment: true
post-cleanup: 'all'

- name: Install dependencies
run: |
pip install -e .
- name: Snakemake Linting
run: |
snakemake --lint -s workflow/Snakefile
- name: Snakemake Testing
run: |
snakemake --cores 1 --snakefile workflow/Snakefile --directory .test --verbose
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This pipeline checks whether the package
# installs properly, passes unit tests and whether
# the code formatting is right.
name: build
name: CI/CD

on:
push:
Expand Down
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Local file system
.DS_Store
poetry.lock

# IDE
.vscode/

# Poetry
poetry.lock

# Byte-compiled / optimized / DLL files
__pycache__/
*.pyc
*.pyc

# Snakemake
workflow/.snakemake
.snakemake/
17 changes: 16 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,19 @@ repos:
entry: poetry run pyright
language: node
pass_filenames: true
types: [python]
types: [python]
- repo: local
hooks:
- id: snakemake-lint
name: Snakemake Lint
entry: bash -c 'cd workflow && snakemake --lint'
language: system
files: (Snakefile|\.smk$)
pass_filenames: false

- id: snakemake-dryrun
name: Snakemake Dry Run
entry: bash -c 'cd workflow && snakemake --lint'
language: system
files: (Snakefile|\.smk$)
pass_filenames: false
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Project Status: WIP – This project is currently under active development.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![build](https://github.com/gordonkoehn/UsefulGnom/actions/workflows/test.yml/badge.svg)](https://github.com/gordonkoehn/UsefulGnom/actions/workflows/test.yml)
[![CI/CD](https://github.com/gordonkoehn/UsefulGnom/actions/workflows/test.yml/badge.svg)](https://github.com/gordonkoehn/UsefulGnom/actions/workflows/test.yml)
![Snakemake CI](https://github.com/gordonkoehn/UsefulGnom/actions/workflows/test-snake.yml/badge.svg?branch=coverage-smk-tests)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Expand Down
1 change: 1 addition & 0 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory contains the Snakemake config file as well as ruls specific config files of input and output files.
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# some placeholder values
root: .
3 changes: 3 additions & 0 deletions config/smk_testing_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
orderbook: "data/AMZN_2012-06-21_34200000_57600000_message_1.csv"
statistics: "results/statistics.csv"
interval: 5 # interval in minutes
9 changes: 7 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.11.2
- snakemake=8.18.2
- poetry=1.8.3
- poetry=1.8.3
- matplotlib=3.9.2
- pandas=2.2.2
- seaborn=0.13.2
- pip
- pip:
- -e .
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ matplotlib = "^3.9.2"
seaborn = "^0.13.2"
pandas-stubs = "^2.2.2.240807"
click = "^8.1.7"
snakemake = "^8.20.4"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.1"
ruff = "^0.0.253"
black = "^23.1.0"
black = "^24.8.0"
pytest-cov = "^4.0.0"
pytest-xdist = "^3.2.0"
pre-commit = "^3.1.0"
Expand Down
3 changes: 2 additions & 1 deletion src/usefulgnom/analyze/basecnt_coverage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements the read coverage analysis.
"""
Implements the read coverage analysis.
Credits:
- core code: @AugusteRi ([email protected])
Expand Down
27 changes: 14 additions & 13 deletions src/usefulgnom/serialize/basecnt_coverage.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""Implements loading and converting the base nucleotide coverage data.
e.g.: of base nucleotide coverage file - bascnt.tsv:
sample B3_25_2024_08_11/20240823_2346503305 \
B3_25_2024_08_11/20240823_2346503305 B3_25_2024_08_11/20240823_2346503305 \
B3_25_2024_08_11/20240823_2346503305 B3_25_2024_08_11/20240823_2346503305
nt A C G T -
ref pos
NC_045512.2 1 0 0 0 0 0
NC_045512.2 2 0 0 0 0 0
NC_045512.2 3 0 0 0 0 0
NC_045512.2 4 0 0 0 0 0
"""
Implements loading and converting the base nucleotide coverage data.
e.g.: of base nucleotide coverage file - bascnt.tsv:
sample B3_25_2024_08_11/20240823_2346503305
B3_25_2024_08_11/20240823_2346503305 B3_25_2024_08_11/20240823_2346503305
B3_25_2024_08_11/20240823_2346503305 B3_25_2024_08_11/20240823_2346503305
nt A C G T -
ref pos
NC_045512.2 1 0 0 0 0 0
NC_045512.2 2 0 0 0 0 0
NC_045512.2 3 0 0 0 0 0
NC_045512.2 4 0 0 0 0 0
"""

Expand Down
Loading

0 comments on commit 2c25ba6

Please sign in to comment.