Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ jobs:
- name: Build strling help
run: ./strling -h

- name: Unit tests
- name: Run Nim unit tests
run: nimble test -y

- name: Run Python doctests
run: |
conda env update -f environment.yml
conda run -n strling python -m doctest scripts/strling-outliers.py

integration-e2e:
# Only run end-to-end tests on pushes to master to keep PRs fast
if: github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release Static Binary

on:
push:
tags:
- 'v*' # Trigger on version tags like v0.4.0

jobs:
build-static:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Pull latest changes
run: git pull

- name: Set up Singularity
run: |
sudo apt-get update
sudo apt-get install -y singularity-container

- name: Build debug static binary
run: |
singularity run --bind $(pwd):/load --bind /scratch --bind /uufs \
docker://brentp/musl-hts-nim:latest \
/usr/local/bin/nsb -n strling.nimble -s src/strling.nim -- -d:danger -d:release -d:debug
cp strling strling_debug

- name: Build release static binary
run: |
singularity run --bind $(pwd):/load --bind /scratch --bind /uufs \
docker://brentp/musl-hts-nim:latest \
/usr/local/bin/nsb -n strling.nimble -s src/strling.nim -- -d:danger -d:release

- name: Upload binaries as release assets
uses: actions/upload-artifact@v4
with:
name: strling_binaries
path: |
strling
strling_debug

- name: Create GitHub Release and attach binaries
uses: softprops/action-gh-release@v2
with:
files: |
strling
strling_debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 22 additions & 3 deletions scripts/strling-outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,30 @@ def z_score(x, df):
return (x - df['mu'][:,np.newaxis])/df['sd'][:,np.newaxis]

def p_adj_bh(x):
'''Adjust p values using Benjamini/Hochberg method'''
# Mask out nan values as they cause the multiptests algorithm to return all nan
'''Adjust p values using Benjamini/Hochberg method

Tests
-----
>>> import numpy as np
>>> p_adj_bh(np.array([np.nan, np.nan]))
array([nan, nan])
>>> p_adj_bh(np.array([np.inf, -np.inf]))
array([ inf, -inf])
>>> p_adj_bh(np.array([]))
array([], dtype=float64)
>>> out = p_adj_bh(np.array([0.01, np.nan, 0.05]))
>>> bool(np.isclose(out[0], 0.03, atol=0.01))
True
>>> bool(np.isnan(out[1]))
True
>>> bool(np.isclose(out[2], 0.05, atol=0.01))
True
'''
mask = np.isfinite(x)
pval_corrected = x.copy()
pval_corrected[mask] = multipletests(x[mask], method='fdr_bh', returnsorted = False)[1]
if not np.any(mask) or np.sum(mask) < 1: # If no finite values, or less than 1, just return the input unchanged
return pval_corrected
pval_corrected[mask] = multipletests(x[mask], method='fdr_bh', returnsorted=False)[1]
return pval_corrected

def glob_list(l):
Expand Down
2 changes: 1 addition & 1 deletion src/strpkg/version.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const strlingVersion* = "0.5.2"
const strlingVersion* = "0.6.0"

# bin file format version
const thisFmtVersion* = 0'i16
Expand Down
2 changes: 1 addition & 1 deletion strling.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ template thisModuleFile: string = instantiationInfo(fullPaths = true).filename
# # When the package is installed, the ``src`` directory disappears.
# import strpkg/version as _

version = "0.5.2"
version = "0.6.0"
author = "Harriet and Brent"
description = "Novel STR caller"
license = "MIT"
Expand Down