Skip to content

Commit 191d1bd

Browse files
committed
experimenting with ty, a nix flake, envrc, and nextflow jobarrays
1 parent 7d95771 commit 191d1bd

File tree

11 files changed

+2006
-1895
lines changed

11 files changed

+2006
-1895
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
!README.md
66
!justfile
77
!Dockerfile
8+
!Containerfile
89
!pyproject.toml
10+
!flake.nix
911
!pixi.lock
1012
!uv.lock
1113
!_quarto.yml
1214
!.pre-commit-config.yaml
1315
!refman.toml
1416
!data_manifest.yml
17+
!.envrc
1518
!.gitignore
1619
!.gitattributes
1720
!main.nf
File renamed without changes.

flake.nix

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
description = "Reproducible dev shell for the `oneroof` bioinformatic processing pipeline";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
flake-utils = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
...
15+
}:
16+
flake-utils.lib.eachDefaultSystem (
17+
system:
18+
let
19+
pkgs = import nixpkgs {
20+
inherit system;
21+
};
22+
23+
dorado = pkgs.stdenv.mkDerivation {
24+
name = "dorado";
25+
src = pkgs.fetchurl {
26+
url = "https://cdn.oxfordnanoportal.com/software/analysis/dorado-0.7.1-linux-x64.tar.gz";
27+
sha256 = "<fill-me-in>"; # run nix with fake sha256 to get it
28+
};
29+
30+
unpackPhase = "tar -xvf $src";
31+
installPhase = ''
32+
set -euo pipefail
33+
mkdir -p $out
34+
cp -r dorado-0.7.1-linux-x64/* $out/
35+
'';
36+
};
37+
38+
in
39+
{
40+
devShells.default = pkgs.mkShell {
41+
name = "oneroof-env";
42+
43+
buildInputs = [
44+
pkgs.stdenv
45+
pkgs.gcc
46+
pkgs.curl
47+
pkgs.wget
48+
pkgs.make
49+
pkgs.git
50+
pkgs.cmake
51+
pkgs.libxml2
52+
pkgs.libxslt
53+
pkgs.libffi
54+
pkgs.pixi
55+
dorado
56+
];
57+
58+
shellHook = ''
59+
export PATH=$PATH:${dorado}/bin:${dorado}/lib
60+
export NXF_CACHE_DIR=/scratch
61+
export NXF_HOME=/scratch
62+
echo "Activating pixi..."
63+
cd ~/ # or $HOME if you define it
64+
pixi install --verbose --color=always --frozen
65+
pixi shell hook >> ~/.bashrc
66+
67+
'';
68+
};
69+
}
70+
);
71+
}

modules/bedtools.nf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ process GET_PRIMER_SEQS {
22

33
/* */
44

5+
array 1000
6+
57
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
68
maxRetries 2
79

@@ -18,4 +20,4 @@ process GET_PRIMER_SEQS {
1820
bedtools getfasta -fi ${refseq} -bed ${bed} > ${primer_combo}.fasta
1921
"""
2022

21-
}
23+
}

modules/chopper.nf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ process FILTER_WITH_CHOPPER {
66
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
77
maxRetries 2
88

9+
array 1000
910
cpus 4
1011

1112
input:

modules/cutadapt.nf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ process TRIM_ENDS_TO_PRIMERS {
55
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
66
maxRetries 2
77

8+
array 1000
89
cpus 3
910

1011
input:

modules/primer_patterns.nf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ process GET_PRIMER_PATTERNS {
22

33
/* */
44

5+
array 1000
6+
57
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
68
maxRetries 2
79

@@ -21,4 +23,4 @@ process GET_PRIMER_PATTERNS {
2123
-r ""
2224
"""
2325

24-
}
26+
}

modules/seqkit.nf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ process FIND_COMPLETE_AMPLICONS {
55
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
66
maxRetries 2
77

8+
array 1000
89
cpus 3
910

1011
input:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ dev-dependencies = [
109109
"quarto>=0.1.0",
110110
"ruff>=0.9.6",
111111
"tox>=4.18.1",
112+
"ty>=0.0.0a8",
112113
]
113114
compile-bytecode = true
114115

0 commit comments

Comments
 (0)