Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyFastANI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
PyFastANI
Commits
9838cfad
Commit
9838cfad
authored
2 years ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Test the number of minimizers extracted from FastANI reference genomes
parent
f831dfcd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfastani/tests/test_ani.py
+47
-8
47 additions, 8 deletions
pyfastani/tests/test_ani.py
with
47 additions
and
8 deletions
pyfastani/tests/test_ani.py
+
47
−
8
View file @
9838cfad
...
...
@@ -34,9 +34,10 @@ class _TestANI(object):
# data/Shigella_flexneri_2a_01.fna data/Escherichia_coli_str_K12_MG1655.fna 97.7507 1303 1608
sketch
=
Sketch
()
ref
=
self
.
_load_fasta
(
ECOLI
)
sketch
.
add_genome
(
"
Escherichia_coli_str_K12_MG1655
"
,
self
.
_get_sequence
(
ref
[
0
]))
sketch
.
add_draft
(
"
Escherichia_coli_str_K12_MG1655
"
,
[
self
.
_get_sequence
(
r
)
for
r
in
self
.
_load_fasta
(
ECOLI
)]
)
mapper
=
sketch
.
index
()
...
...
@@ -49,9 +50,49 @@ class _TestANI(object):
self
.
assertEqual
(
hits
[
0
].
fragments
,
1608
)
self
.
assertAlmostEqual
(
hits
[
0
].
identity
,
97.7507
,
places
=
4
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001425
),
"
missing FastANI data files
"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001427
),
"
missing FastANI data files
"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001428
),
"
missing FastANI data files
"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
ECOLI
),
"
missing FastANI data files
"
)
def
test_escherichia_minimizers
(
self
):
"""
Check that we extract as many minimizers as FastANI on their data.
"""
contigs
=
[
self
.
_get_sequence
(
r
)
for
r
in
self
.
_load_fasta
(
ECOLI
)]
sketch
=
Sketch
()
self
.
assertEqual
(
sketch
.
window_size
,
24
)
sketch
.
add_draft
(
"
Escherichia_coli_str_K12_MG1655
"
,
contigs
)
self
.
assertEqual
(
len
(
sketch
.
minimizers
),
371301
)
mapper
=
sketch
.
index
()
self
.
assertEqual
(
len
(
mapper
.
lookup_index
),
361568
)
hits
=
mapper
.
query_draft
(
contigs
)
self
.
assertEqual
(
len
(
hits
),
1
)
self
.
assertEqual
(
hits
[
0
].
name
,
"
Escherichia_coli_str_K12_MG1655
"
)
self
.
assertEqual
(
hits
[
0
].
matches
,
1547
)
self
.
assertEqual
(
hits
[
0
].
fragments
,
1547
)
self
.
assertAlmostEqual
(
hits
[
0
].
identity
,
100.0
)
@unittest.skipUnless
(
os
.
path
.
exists
(
SFLEXNERI
),
"
missing FastANI data files
"
)
def
test_shigella_minimizers
(
self
):
"""
Check that we extract as many minimizers as FastANI on their data.
"""
contigs
=
[
self
.
_get_sequence
(
r
)
for
r
in
self
.
_load_fasta
(
SFLEXNERI
)]
sketch
=
Sketch
()
self
.
assertEqual
(
sketch
.
window_size
,
24
)
sketch
.
add_draft
(
"
Shigella_flexneri_2a_01
"
,
contigs
)
self
.
assertEqual
(
len
(
sketch
.
minimizers
),
386387
)
mapper
=
sketch
.
index
()
self
.
assertEqual
(
len
(
mapper
.
lookup_index
),
347908
)
hits
=
mapper
.
query_draft
(
contigs
)
self
.
assertEqual
(
len
(
hits
),
1
)
self
.
assertEqual
(
hits
[
0
].
name
,
"
Shigella_flexneri_2a_01
"
)
self
.
assertEqual
(
hits
[
0
].
matches
,
1600
)
self
.
assertEqual
(
hits
[
0
].
fragments
,
1608
)
self
.
assertAlmostEqual
(
hits
[
0
].
identity
,
100.0
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001425
),
"
missing test data files
"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001427
),
"
missing test data files
"
)
@unittest.skipUnless
(
os
.
path
.
exists
(
BGC0001428
),
"
missing test data files
"
)
def
test_myxochromide_bgcs
(
self
):
"""
Check that we get expected hits between homologous BGCs.
"""
...
...
@@ -74,8 +115,6 @@ class _TestANI(object):
self
.
assertEqual
(
hits
[
1
].
fragments
,
176
)
class
TestANIString
(
_TestANI
,
unittest
.
TestCase
):
def
_load_fasta
(
self
,
path
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment