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
b83354d4
Commit
b83354d4
authored
3 years ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Add a single unit test using the example genomes from FastANI
parent
18693fc9
No related branches found
Branches containing commit
Tags
v0.4.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/__init__.py
+0
-0
0 additions, 0 deletions
tests/__init__.py
tests/test_mapper.py
+35
-0
35 additions, 0 deletions
tests/test_mapper.py
with
35 additions
and
0 deletions
tests/__init__.py
0 → 100644
+
0
−
0
View file @
b83354d4
This diff is collapsed.
Click to expand it.
tests/test_mapper.py
0 → 100644
+
35
−
0
View file @
b83354d4
import
unittest
import
Bio.SeqIO
import
pyfastani
class
TestMapper
(
unittest
.
TestCase
):
def
test_fastani_example
(
self
):
# The example in the FastANI README is the following
# $ ./fastANI -q data/Shigella_flexneri_2a_01.fna -r data/Escherichia_coli_str_K12_MG1655.fna
# data/Shigella_flexneri_2a_01.fna data/Escherichia_coli_str_K12_MG1655.fna 97.7507 1303 1608
pass
def
test_fastani_example_reversed
(
self
):
# Same as the FastANI README example, but swapping query and reference
# $ ./fastANI -r data/Shigella_flexneri_2a_01.fna -q data/Escherichia_coli_str_K12_MG1655.fna -o fastani.txt
# $ cat fastani.txt
# data/Escherichia_coli_str_K12_MG1655.fna data/Shigella_flexneri_2a_01.fna 97.664 1322 1547
mapper
=
pyfastani
.
Mapper
()
reference
=
list
(
Bio
.
SeqIO
.
parse
(
"
vendor/FastANI/data/Shigella_flexneri_2a_01.fna
"
,
"
fasta
"
))
mapper
.
add_draft
(
reference
[
0
].
id
,
(
str
(
r
.
seq
)
for
r
in
reference
))
mapper
.
index
()
query
=
Bio
.
SeqIO
.
read
(
"
vendor/FastANI/data/Escherichia_coli_str_K12_MG1655.fna
"
,
"
fasta
"
)
hits
=
mapper
.
query_genome
(
str
(
query
.
seq
))
self
.
assertEqual
(
len
(
hits
),
1
)
self
.
assertEqual
(
hits
[
0
].
name
,
reference
[
0
].
id
)
self
.
assertEqual
(
hits
[
0
].
matches
,
1322
)
self
.
assertEqual
(
hits
[
0
].
fragments
,
1547
)
self
.
assertAlmostEqual
(
hits
[
0
].
identity
,
97.664
,
places
=
4
)
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