-
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.
Improve PILER-CR CRISPR parser (#249)
* implement parsing of CRISPR repeats & spacers * write CRISPR repeats & spacers to GFF * add CRISPR repeat & spacer output to TSV * add CRISPR PILER-CR test * refactor test * fix full black box test for expanded CRISPR features * refactor test code
- Loading branch information
1 parent
358ac16
commit 53df2bf
Showing
13 changed files
with
269 additions
and
152 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
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
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
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
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
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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
import pytest | ||
|
||
|
||
FILES = [ | ||
'test.tsv', | ||
'test.hypotheticals.tsv', | ||
|
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,43 @@ | ||
import json | ||
|
||
from pathlib import Path | ||
from subprocess import run | ||
|
||
|
||
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'] |
Oops, something went wrong.