Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panacota
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Amandine PERRIN
panacota
Commits
072bbd29
Commit
072bbd29
authored
3 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into dev
parents
4fc48470
64c45ef9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PanACoTA/align_module/post_align.py
+12
-1
12 additions, 1 deletion
PanACoTA/align_module/post_align.py
test/test_unit/test_align/test_postalign.py
+14
-6
14 additions, 6 deletions
test/test_unit/test_align/test_postalign.py
with
26 additions
and
7 deletions
PanACoTA/align_module/post_align.py
+
12
−
1
View file @
072bbd29
...
...
@@ -320,10 +320,21 @@ def get_genome(header, all_genomes):
name of genome from which the header is
None if no genome found
"""
# Name of protein is not always genome-name_num
# Ex: in gembase complete DB: >TOTO.0215.00002.i006_00065 is from genome TOTO.0215.00002
# So, genome name cannot be deduced directly from header. But it is always included in header
header
=
header
.
split
(
"
>
"
)[
1
].
split
()[
0
]
for
genome
in
all_genomes
:
if
genome
in
header
:
return
genome
# header should be genome<something>_num
# -> header.split(genome) should be empty for the first field
# If not empty, means that genome name is included into another genome name, so
# we must not return this genome.
# For example, genome "8-KG" is in header "98-KG_xxx", but the correct genome for this
# header is "98-KG"
if
not
header
.
split
(
genome
)[
0
]:
return
genome
logger
.
error
((
f
"
Protein
{
header
}
does not correspond to any genome name
"
f
"
given...
{
all_genomes
}
"
))
return
None
This diff is collapsed.
Click to expand it.
test/test_unit/test_align/test_postalign.py
+
14
−
6
View file @
072bbd29
...
...
@@ -55,14 +55,22 @@ def test_get_genome():
assert
pal
.
get_genome
(
header
,
genomes
)
==
"
TOTO.0215.00002
"
def
test_get_genome_
not_start
():
def
test_get_genome_
included
():
"""
Given a header and a list of genomes, check that it returns the expected genome. The genome
name is not at the beginning of the protein name
Given a header and a list of genomes, check that it returns the expected genome
"""
header
=
"
>mongenome,TOTO.0215.00002.i006_00065
"
genomes
=
[
"
TOTO.0315.00001
"
,
"
ESCO.0215.00002
"
,
"
ESCO.0215.00001
"
,
"
TOTO.0215.00002
"
]
assert
pal
.
get_genome
(
header
,
genomes
)
==
"
TOTO.0215.00002
"
header
=
"
>aTOTO.0215.00002.i006_00065
"
genomes
=
[
"
TOTO.0215.00002
"
,
"
TOTO.0315.00001
"
,
"
ESCO.0215.00002
"
,
"
aTOTO.0215.00002
"
]
assert
pal
.
get_genome
(
header
,
genomes
)
==
"
aTOTO.0215.00002
"
# def test_get_genome_not_start():
# """
# Given a header and a list of genomes, check that it returns the expected genome. The genome
# name is not at the beginning of the protein name
# """
# header = ">mongenome,TOTO.0215.00002.i006_00065"
# genomes = ["TOTO.0315.00001", "ESCO.0215.00002", "ESCO.0215.00001", "TOTO.0215.00002"]
# assert pal.get_genome(header, genomes) == "TOTO.0215.00002"
def
test_get_genome_notfound
(
caplog
):
...
...
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