Skip to content

Commit 5b5084b

Browse files
authored
Merge branch 'main' into switch-to-skani-cli
2 parents 853354f + a007e0d commit 5b5084b

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

.github/workflows/test-galah.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ jobs:
1212
matrix:
1313
os: ["ubuntu-latest"]
1414
steps:
15-
- uses: actions/checkout@v2
16-
- uses: conda-incubator/setup-miniconda@v2
15+
- uses: actions/checkout@v4
16+
- uses: conda-incubator/setup-miniconda@v3
1717
with:
1818
activate-environment: test
1919
environment-file: galah.yml
2020
auto-activate-base: false
21-
mamba-version: "*"
2221
channels: conda-forge,defaults,bioconda
2322
- run: |
2423
conda info

src/skani.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,45 @@ pub fn calculate_skani(fasta1: &str, fasta2: &str, min_aligned_threshold: f32) -
212212
finish_command_safely(process, "skani");
213213
to_return
214214
}
215+
216+
#[cfg(test)]
217+
mod tests {
218+
use super::*;
219+
220+
fn init() {
221+
let _ = env_logger::builder().is_test(true).try_init();
222+
}
223+
224+
#[test]
225+
#[should_panic(
226+
expected = "Error: skani produces inaccurate results with ANI less than 85%. Provided: 80"
227+
)]
228+
fn test_precluster_skani_with_low_ani() {
229+
init();
230+
precluster_skani(
231+
&[
232+
"tests/data/abisko4/73.20120800_S1X.13.fna",
233+
"tests/data/abisko4/73.20120600_S2D.19.fna",
234+
"tests/data/abisko4/73.20120700_S3X.12.fna",
235+
"tests/data/abisko4/73.20110800_S2D.13.fna",
236+
],
237+
80.0,
238+
0.2,
239+
);
240+
}
241+
242+
#[test]
243+
fn test_precluster_skani_with_valid_ani() {
244+
init();
245+
precluster_skani(
246+
&[
247+
"tests/data/abisko4/73.20120800_S1X.13.fna",
248+
"tests/data/abisko4/73.20120600_S2D.19.fna",
249+
"tests/data/abisko4/73.20120700_S3X.12.fna",
250+
"tests/data/abisko4/73.20110800_S2D.13.fna",
251+
],
252+
95.0,
253+
0.2,
254+
);
255+
}
256+
}

tests/test_cmdline.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,37 @@ mod tests {
312312
.unwrap();
313313
}
314314

315+
#[test]
316+
fn test_skani_with_low_ani() {
317+
Assert::main_binary()
318+
.with_args(&[
319+
"cluster",
320+
"--genome-fasta-files",
321+
"tests/data/abisko4/73.20120800_S1X.13.fna",
322+
"tests/data/abisko4/73.20120600_S2D.19.fna",
323+
"tests/data/abisko4/73.20120700_S3X.12.fna",
324+
"tests/data/abisko4/73.20110800_S2D.13.fna",
325+
"--precluster-method",
326+
"skani",
327+
"--cluster-method",
328+
"skani",
329+
"--precluster-ani",
330+
"80",
331+
"--ani",
332+
"80",
333+
"--output-cluster-definition",
334+
"/dev/stdout",
335+
"--checkm-tab-table",
336+
"tests/data/abisko4/abisko4.csv",
337+
])
338+
.fails()
339+
.stderr()
340+
.contains(
341+
"Error: skani produces inaccurate results with ANI less than 85%. Provided: 80",
342+
)
343+
.unwrap();
344+
}
345+
315346
#[test]
316347
fn test_github7() {
317348
Assert::main_binary()

0 commit comments

Comments
 (0)