Skip to content

Commit 84709e6

Browse files
committed
update to v1.3.4 - patch to account for updates to dependency
1 parent f97934f commit 84709e6

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "skDER"
33
authors = [{name="Rauf Salamzade", email="salamzader@gmail.com"}]
4-
version = "1.3.3"
4+
version = "1.3.4"
55
description = "Program to select distinct representatives from an input set of microbial genomes."
66

77
[build-system]

run_tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ skder -t "Cutibacterium granulosum" -o skder_gtdb_results/ -c 4 -auto -s -tc
1515
printf "\n##############################################\n\n"
1616

1717
cidder -g Cutibacterium_granulosum_Genomes_in_GTDB_R214/*.fna -o cidder_results/ -c 4 -n -ns
18+
19+
printf "\n##############################################\n\n"
20+
21+
skder -t "Cutibacterium granulosum" -o skder_gtdb_low_mem_results/ -c 4 -d low_mem_greedy -auto

src/skDER/skder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import os
21
import sys
3-
import gzip
4-
import traceback
52
from skDER import util
63
from operator import itemgetter
74
import subprocess
@@ -101,6 +98,9 @@ def lowMemGreedyDerep(all_genomes_listing_file, skder_lm_workspace, concat_n50_r
10198

10299
sketch_db_file = skder_lm_workspace + 'skani_sketch_all.db'
103100
skder_sketch_cmd = ['skani', 'sketch', '-l', all_genomes_listing_file, '-o', sketch_db_file, '-t', str(threads)]
101+
if util.is_skani_version_at_least_0_3_0():
102+
skder_sketch_cmd += ['--separate-sketches']
103+
104104
util.runCmd(skder_sketch_cmd, logObject, check_directories=[sketch_db_file])
105105

106106
n50_data = []

src/skDER/util.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import resource
1818
import gzip
1919
import importlib.metadata
20+
import re
21+
from functools import lru_cache
2022

2123
ACCEPTED_FASTA_SUFFICES = set(['fasta', 'fas', 'fna', 'fa'])
2224
ACCEPTED_PROTEIN_FASTA_SUFFICES = set(['fasta', 'faa', 'fa'])
@@ -29,6 +31,28 @@ def get_version():
2931
package_version = "NA"
3032
return package_version
3133

34+
@lru_cache(maxsize=1)
35+
def is_skani_version_at_least_0_3_0() -> bool:
36+
"""
37+
Return True if installed skani version is >= 0.3.0. Falls back to False on error.
38+
"""
39+
try:
40+
completed = subprocess.run(
41+
["skani", "--version"],
42+
capture_output=True,
43+
text=True,
44+
check=False,
45+
)
46+
output = (completed.stdout or completed.stderr or "").strip()
47+
match = re.search(r"(\d+)\.(\d+)\.(\d+)", output)
48+
if not match:
49+
return False
50+
major, minor, patch = (int(match.group(1)), int(match.group(2)), int(match.group(3)))
51+
return (major, minor, patch) >= (0, 3, 0)
52+
except Exception:
53+
return False
54+
55+
3256
def memory_limit(mem):
3357
"""
3458
Description:

0 commit comments

Comments
 (0)