-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67b1a6a
commit 0e8ce95
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import json | ||
|
||
from pathlib import Path | ||
from subprocess import run | ||
|
||
import bakta.config as cfg | ||
|
||
import pytest | ||
|
||
CRISPR_ARRAYS = [ | ||
{ | ||
'repeat_consensus': 'CGGTTTATCCCCGCTGGCGCGGGGAACACA', | ||
'spacers': [ | ||
'AACCGAAACACACGATCAATCCGAATATGAG', | ||
'TTGGTGACAGTTTTTGTCACTGTTTTGGTGA', | ||
'CTAAGCATACATATCTGTTTTTAAACA' | ||
], | ||
'repeats': 3 | ||
} | ||
] | ||
|
||
|
||
|
||
|
||
def test_crispr_arrays(tmpdir): | ||
proc = run( | ||
[ | ||
'bin/bakta', '--db', 'test/db', '--output', tmpdir, '--force', '--prefix', 'test', | ||
'--skip-tmrna', '--skip-trna', '--skip-rrna', '--skip-ncrna', '--skip-ncrna-region', '--skip-cds', '--skip-sorf', '--skip-ori', '--skip-gap', '--skip-plot', | ||
'test/data/GCF_000008865.2.fna.gz' | ||
] | ||
) | ||
assert proc.returncode == 0 | ||
|
||
results_path = Path(tmpdir).joinpath('test.json') | ||
assert Path.exists(results_path) | ||
|
||
results = None | ||
with results_path.open() as fh: | ||
results = json.load(fh) | ||
assert results is not None | ||
|
||
crispr_arrays = [feat for feat in results['features'] if feat['type'] == 'crispr'] | ||
assert len(crispr_arrays) == 1 | ||
|
||
for idx, crispr_array in enumerate(crispr_arrays): | ||
assert crispr_array['repeat_consensus'] == CRISPR_ARRAYS[idx]['repeat_consensus'] | ||
assert len(crispr_array['repeats']) == CRISPR_ARRAYS[idx]['repeats'] |