Skip to content

Commit cc691ab

Browse files
authored
Merge pull request #30 from klebgenomics/development
Bump to version 3.0.0b1
2 parents 0fd362f + 40f2bda commit cc691ab

File tree

10 files changed

+69
-60
lines changed

10 files changed

+69
-60
lines changed

__init__.py

Whitespace-only changes.

docs/source/Installation.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Kaptive requires the following software and libraries to be installed and availa
99

1010
* `Python <https://python.org/>`_ >=3.9
1111
* `Biopython <https://biopython.org/>`_ >=1.83
12-
* `minimap2 <https://lh3.github.io/minimap2/>`_.
12+
* `minimap2 <https://lh3.github.io/minimap2/>`_
1313
* `DNA Features Viewer <https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/>`_
1414

1515

@@ -18,10 +18,14 @@ Download and install Kaptive
1818

1919
With pip::
2020

21-
git clone https://github.com/klebgenomics/Kaptive.git
22-
pip install Kaptive/
23-
21+
pip install kaptive
2422

2523
With conda::
2624

27-
conda install -c bioconda kaptive
25+
conda install -c bioconda kaptive
26+
27+
From source::
28+
29+
git clone https://github.com/klebgenomics/Kaptive.git
30+
python -m pip install Kaptive/
31+

kaptive/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
from kaptive.version import __version__
2828
from kaptive.log import bold, quit_with_error
29-
from kaptive.misc import check_python_version, check_programs, get_logo, check_cpus, check_dir, check_file
29+
from kaptive.misc import (check_python_version, check_biopython_version, check_programs, get_logo, check_cpus,
30+
check_dir, check_file)
3031
from kaptive.database import Database, get_database
3132
from kaptive.assembly import typing_pipeline, TypingResult
3233

@@ -276,7 +277,8 @@ def plot_result(result: TypingResult, outdir: Path, fmt: str):
276277

277278
# Main -----------------------------------------------------------------------------------------------------------------
278279
def main():
279-
check_python_version()
280+
check_python_version(3, 9)
281+
check_biopython_version(1, 83)
280282
args = parse_args(sys.argv[1:])
281283

282284
# Assembly mode ----------------------------------------------------------------------------------------------------

kaptive/assembly.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ def typing_pipeline(
236236
previous_result = gene_result # Set the previous result to the current result
237237
# FINALISE CONTIG ---------------------------------------------------------------------------------------------
238238
for piece in pieces: # Add sequences to pieces and add them to the result
239+
if not piece.expected_genes: # If the piece has no expected genes, skip it
240+
continue
239241
piece.strand = "+" if max(i.strand == i.gene.strand for i in piece.expected_genes) else "-"
240242
piece.sequence = contig.sequence[piece.start:piece.end] if piece.strand == "+" else \
241243
contig.sequence[piece.start:piece.end].reverse_complement()

kaptive/misc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ def check_python_version(major: int = 3, minor: int = 8):
8888
quit_with_error(f'Python version {major}.{minor} or greater required')
8989

9090

91+
def check_biopython_version(major: int = 1, minor: int = 79):
92+
try:
93+
from Bio import __version__ as biopython_version
94+
except ImportError:
95+
quit_with_error('BioPython is required')
96+
if (major_version := int(biopython_version.split('.')[0])) < major or (minor_version := int(biopython_version.split('.')[1])) < minor:
97+
quit_with_error(f'Biopython version {major}.{minor} or greater required, got {major_version}.{minor_version}')
98+
99+
91100
def parse_fasta(fasta: Path, skip_plasmids: bool = False, verbose: bool = False) -> Generator[tuple[str, str, str], None, None]:
92101
log(f'Parsing {fasta.name}', verbose)
93102
with open(fasta, 'rb') as f: # Read the first two bytes to determine the compression format

kaptive/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def phenotype(self) -> str:
130130
def problems(self) -> str:
131131
if self._problems is not None:
132132
return self._problems
133-
problems = f'?{x}' if (x := len(self.pieces)) > 1 else ''
133+
problems = f'?{x}' if (x := len(self.pieces)) != 1 else ''
134134
problems += '-' if self.missing_genes else ''
135135
problems += '+' if self.unexpected_genes_inside_locus else ''
136136
problems += '*' if any(

kaptive/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
If not, see <https://www.gnu.org/licenses/>.
1515
"""
1616

17-
__version__ = '3.0.0b'
17+
__version__ = '3.0.0b1'

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "kaptive"
7+
authors = [
8+
{name="Tom Stanton", email="tomdstanton@gmail.com" },
9+
]
10+
description = "In silico serotyping"
11+
readme = {file = "README.md", content-type = "text/markdown"}
12+
requires-python = ">=3.9"
13+
dependencies = ["biopython", "dna_features_viewer"]
14+
keywords = ["bioinformatics", "serotyping", "microbiology"]
15+
license = {file = "LICENSE"}
16+
classifiers = [
17+
"Environment :: Console",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python",
20+
]
21+
dynamic = ["version"]
22+
23+
[project.scripts]
24+
kaptive = "kaptive.__main__:main"
25+
26+
[tool.setuptools.packages.find]
27+
include = ["kaptive"]
28+
exclude = ["test", 'development']
29+
30+
[tool.setuptools.package-data]
31+
kaptive = ['../reference_database/*']
32+
33+
[tool.setuptools.dynamic]
34+
version = {attr = "kaptive.version.__version__"}

reference_database/Klebsiella_o_locus_primary_reference.gbk

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ FEATURES Location/Qualifiers
4848
RDWLYVEDHARALYKVATEGKSGETYNIGGHNERKNIDVVRTICTILDKVVAQKPGNIT
4949
HFADLITFVTDRPGHDLRYAIDATKIQHDLGWVPQETFESGIEKTVHWYLNNQTWWQRV
5050
LDGSYAGERLGLNN"
51-
/locus_tag="OL101_01_rfbB"
51+
/locus_tag="OL13_01_rfbB"
5252
gene 1092..1961
5353
/gene="rfbA"
5454
CDS 1092..1961
@@ -67,7 +67,7 @@ FEATURES Location/Qualifiers
6767
PKSDWAVTGLYFYDNNVVEMAKDVKPSERGELEITTLNQMYLEQGDLHVELLGRGFAWL
6868
DTGTHDSLMDASQFIHTIEKRQGMKVACLEEIAYRNQWLSAEGVAAQAERLKKTEYGAY
6969
LKRLLNER"
70-
/locus_tag="OL101_02_rfbA"
70+
/locus_tag="OL13_02_rfbA"
7171
gene 1993..2883
7272
/gene="rfbD"
7373
CDS 1993..2883
@@ -86,7 +86,7 @@ FEATURES Location/Qualifiers
8686
KTMLRLAGEKETLTIIDDQHGAPTGAELLADCTATAIRETLRNPALAGTYHLVASGETS
8787
WCDYARYVFEVARAHGAELAIQEVKGIPTTAYPTPAKRPLNSRLSNEKFQQAFGVTLPD
8888
WRQGVARVVTEVLGK"
89-
/locus_tag="OL101_03_rfbD"
89+
/locus_tag="OL13_03_rfbD"
9090
gene 2898..3452
9191
/gene="rfbC"
9292
CDS 2898..3452
@@ -103,7 +103,7 @@ FEATURES Location/Qualifiers
103103
VQDNHSQSQKGVLRGLHYQLDPHAQGKLVRCVEGEVFDVAVDIRRSSSTFGKWVGAVLS
104104
AENKRQLWIPEGFAHGFMALSDTVQFVYKATNYYAPQSERSIIWNDPEIGIDWPALNDC
105105
ALSLSEKDLQAHTLATAEVYA"
106-
/locus_tag="OL101_04_rfbC"
106+
/locus_tag="OL13_04_rfbC"
107107
gene 3539..4369
108108
/gene="wbbL"
109109
CDS 3539..4369
@@ -121,7 +121,7 @@ FEATURES Location/Qualifiers
121121
LVSFAWVNEYNFVSPQIIYKNGERQYSCRLLPTPSNLFLRRFLPTTAIKYDATYELKDA
122122
EYDKVFSPPSVSGCFMLLTNVLLQKLNGFDERYFMYLEDVDLCRRALQLTKIYYCPETT
123123
IVHVFNKGSYKSKLLLWYHVRSAITYFNKWGWFFDKKRYAYNESALRNIPRKLS"
124-
/locus_tag="OL101_05_wbbL"
124+
/locus_tag="OL13_05_wbbL"
125125
gene 4398..5231
126126
/gene="wzm"
127127
CDS 4398..5231
@@ -138,7 +138,7 @@ FEATURES Location/Qualifiers
138138
QIILNNTNYVKKVIFPLETLSVISLVAALFHTTISLLVLLTAFVIFNGFIHWTIIFIPL
139139
VFLPLVIFSLGLSWILASLGVFLRDVSQTTVIITTVLMFLSPVFFPISALPEKYHIWIM
140140
LNPVTFIIEQARTVLIWGGLPNFMGILLYTVGASIVAWLGFVFFQKTRKGFADVL"
141-
/locus_tag="OL101_06_wzm"
141+
/locus_tag="OL13_06_wzm"
142142
gene 5221..6552
143143
/gene="wzt"
144144
CDS 5221..6552
@@ -159,7 +159,7 @@ FEATURES Location/Qualifiers
159159
AIQNTQTNSEVDEKRFGSGRAIIEDFSIMKADGTPLSEKPLVKPNEEIYFSFKLNSSEN
160160
INDVVLGVSLSRTQGGDIWGDNNIFAGHKIDLAPGLRKLKYKVKLPINTGDYLVHCGLA
161161
CFNNGEREELDQRRPIAKVKFWSSRELGGVIHSPVNVIEGDELS"
162-
/locus_tag="OL101_07_wzt"
162+
/locus_tag="OL13_07_wzt"
163163
gene 6549..10115
164164
/gene="wbbB"
165165
CDS 6549..10115
@@ -192,7 +192,7 @@ FEATURES Location/Qualifiers
192192
RIINWDISFQRMSELWRQAIADFDGFFQQQSVDPMPDVSSETRVDHFYRDYYIRDSWWR
193193
ESELGRIDFKTLIDSFYSSDNITIVEEKISQPQGRKEKLLAILWMLRQNPALSWVTKLI
194194
PYRLQRYVKRQLSRRALHEIVR"
195-
/locus_tag="OL101_08_wbbB"
195+
/locus_tag="OL13_08_wbbB"
196196
gene complement(10274..12064)
197197
/gene="glycosylhydrolase"
198198
CDS complement(10274..12064)
@@ -215,7 +215,7 @@ FEATURES Location/Qualifiers
215215
GRERTFSHQIAPMFNADWNEEKIAAEDSLKKNNHYNIGLNTYGSAFYGDYLFNWLKTSG
216216
IERYGIPEVHPMVENEEVIYDALEHHHNNGAIFISPYYLEIKPDSFGVDKEHEKFSINE
217217
NNTNYYSSSFYHALKKIMKE"
218-
/locus_tag="OL101_09_glycosylhydrolase"
218+
/locus_tag="OL13_09_glycosylhydrolase"
219219
ORIGIN
220220
1 atgaagattc ttgtcaccgg gggtgcaggc tttatcggtt ctgccgtggt tcgtcatatc
221221
61 attgaaaata ccctggacga agtccgtgtg atggactgcc tgacctacgc cggcaacctt

setup.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)