Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Wiki
Commits
3d00a27d
Commit
3d00a27d
authored
9 months ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
Eleos special case
parent
4a92d484
Branches
operon-struct-type
operon-struct-type-article
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#131977
failed with stages
in 8 minutes and 32 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/df-wiki-cli/df_wiki_cli/content/main.py
+76
-38
76 additions, 38 deletions
packages/df-wiki-cli/df_wiki_cli/content/main.py
with
76 additions
and
38 deletions
packages/df-wiki-cli/df_wiki_cli/content/main.py
+
76
−
38
View file @
3d00a27d
...
...
@@ -304,44 +304,82 @@ def system_operon_structure(
in_exchangeables
=
False
current_gene
=
{}
exchangeables
=
[]
with
open
(
def_path
[
"
path
"
])
as
file
:
for
event
,
elem
in
ET
.
iterparse
(
file
,
events
=
(
"
start
"
,
"
end
"
)):
if
event
==
"
start
"
:
if
(
elem
.
tag
==
"
gene
"
and
not
in_exchangeables
and
elem
.
attrib
[
"
presence
"
]
!=
"
forbidden
"
):
current_gene
=
{
"
system
"
:
system
,
"
subsystem
"
:
subsystem
,
"
gene
"
:
elem
.
attrib
[
"
name
"
],
"
version
"
:
def_path
[
"
version
"
],
"
exchangeables
"
:
None
,
}
# get hmm definition to extract the size
base_path_list
=
def_path
[
"
path
"
].
parts
[
0
:
-
4
]
profile_path
=
(
Path
(
*
base_path_list
)
/
f
"
profiles/
{
current_gene
[
'
gene
'
]
}
.hmm
"
)
with
open
(
profile_path
)
as
profile_file
:
for
line
in
profile_file
:
if
line
.
startswith
(
"
LENG
"
):
size
=
int
(
re
.
split
(
r
"
\s+
"
,
line
)[
1
])
current_gene
[
"
size
"
]
=
size
system_genes
.
append
(
current_gene
)
if
elem
.
tag
==
"
gene
"
and
in_exchangeables
:
exchangeables
.
append
(
elem
.
attrib
[
"
name
"
])
if
elem
.
tag
==
"
exchangeables
"
:
in_exchangeables
=
True
exchangeables
=
[]
elif
event
==
"
end
"
:
if
elem
.
tag
==
"
exchangeables
"
:
in_exchangeables
=
False
current_gene
[
"
exchangeables
"
]
=
"
,
"
.
join
(
exchangeables
)
exchangeables
=
[]
# <model inter_gene_max_space="5" min_mandatory_genes_required="2" min_genes_required="2" vers="2.0">
# <gene name="Eleos__LeoA" presence="mandatory">
# <exchangeables>
# <gene name="Eleos__LeoA2"/>
# </exchangeables>
# </gene>
# <gene name="Eleos__LeoBC" presence="mandatory"/>
# <gene name="Eleos__LeoB" presence="mandatory"/>
# <gene name="Eleos__LeoC" presence="mandatory"/>
# </model>
if
system
==
'
Eleos
'
:
eleos_struct
=
[
{
"
system
"
:
system
,
"
subsystem
"
:
"
Eleos
"
,
"
gene
"
:
"
Eleos__LeoA
"
,
"
version
"
:
"
1.2.4
"
,
"
exchangeables
"
:
"
Eleos__LeoA2
"
,
"
size
"
:
559
,
},
{
"
system
"
:
system
,
"
subsystem
"
:
"
Eleos
"
,
"
gene
"
:
"
Eleos__LeoBC
"
,
"
version
"
:
"
1.2.4
"
,
"
exchangeables
"
:
None
,
"
size
"
:
601
,
},
]
system_genes
+=
eleos_struct
else
:
with
open
(
def_path
[
"
path
"
])
as
file
:
for
event
,
elem
in
ET
.
iterparse
(
file
,
events
=
(
"
start
"
,
"
end
"
)):
if
event
==
"
start
"
:
if
(
elem
.
tag
==
"
gene
"
and
not
in_exchangeables
and
elem
.
attrib
[
"
presence
"
]
!=
"
forbidden
"
):
current_gene
=
{
"
system
"
:
system
,
"
subsystem
"
:
subsystem
,
"
gene
"
:
elem
.
attrib
[
"
name
"
],
"
version
"
:
def_path
[
"
version
"
],
"
exchangeables
"
:
None
,
}
# get hmm definition to extract the size
base_path_list
=
def_path
[
"
path
"
].
parts
[
0
:
-
4
]
profile_path
=
(
Path
(
*
base_path_list
)
/
f
"
profiles/
{
current_gene
[
'
gene
'
]
}
.hmm
"
)
with
open
(
profile_path
)
as
profile_file
:
for
line
in
profile_file
:
if
line
.
startswith
(
"
LENG
"
):
size
=
int
(
re
.
split
(
r
"
\s+
"
,
line
)[
1
])
current_gene
[
"
size
"
]
=
size
system_genes
.
append
(
current_gene
)
if
elem
.
tag
==
"
gene
"
and
in_exchangeables
:
exchangeables
.
append
(
elem
.
attrib
[
"
name
"
])
if
elem
.
tag
==
"
exchangeables
"
:
in_exchangeables
=
True
exchangeables
=
[]
elif
event
==
"
end
"
:
if
elem
.
tag
==
"
exchangeables
"
:
in_exchangeables
=
False
current_gene
[
"
exchangeables
"
]
=
"
,
"
.
join
(
exchangeables
)
exchangeables
=
[]
with
open
(
output
,
"
w
"
)
as
f
:
fieldnames
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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