Skip to content

Commit

Permalink
add CRISPR PILER-CR test
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwengers committed Oct 19, 2023
1 parent 67b1a6a commit 0e8ce95
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/test_crispr.py
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']

0 comments on commit 0e8ce95

Please sign in to comment.