Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rpg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
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
Nicolas MAILLET
rpg
Commits
6e42744f
Commit
6e42744f
authored
6 years ago
by
Nicolas MAILLET
Browse files
Options
Downloads
Patches
Plain Diff
Change the way of getting enzyme name
parent
f3aa9599
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
rpg/enzyme.py
+7
-20
7 additions, 20 deletions
rpg/enzyme.py
with
7 additions
and
20 deletions
rpg/enzyme.py
+
7
−
20
View file @
6e42744f
...
@@ -26,16 +26,16 @@
...
@@ -26,16 +26,16 @@
import
os
import
os
import
re
import
re
from
pathlib
import
Path
from
pathlib
import
Path
import
core
from
rpg
import
core
import
rule
from
rpg
import
rule
DEFENZFILE
=
"
enzymes_definition.py
"
DEFUSERENZFILE
=
str
(
Path
.
home
())
+
"
/rpg_user.py
"
DEFUSERENZFILE
=
str
(
Path
.
home
())
+
"
/rpg_user.py
"
# Create the enzymes_user file if it does not exist
# Create the enzymes_user file if it does not exist
if
not
os
.
path
.
isfile
(
DEFUSERENZFILE
):
if
not
os
.
path
.
isfile
(
DEFUSERENZFILE
):
with
open
(
DEFUSERENZFILE
,
"
w
"
)
as
out_file
:
with
open
(
DEFUSERENZFILE
,
"
w
"
)
as
out_file
:
out_file
.
write
(
"
import enzyme
\n
import rule
\n
import enzymes_definition
"
\
out_file
.
write
(
"
from rpg import enzyme
\n
from rpg import rule
\n
"
\
"
from rpg import enzymes_definition
"
\
"
\n\n
AVAILABLE_ENZYMES_USER = []
\n
CPT_ENZ = enzymes_de
"
\
"
\n\n
AVAILABLE_ENZYMES_USER = []
\n
CPT_ENZ = enzymes_de
"
\
"
finition.CPT_ENZ
\n\n
### ENZYMES DECLARATION ###
\n
"
)
"
finition.CPT_ENZ
\n\n
### ENZYMES DECLARATION ###
\n
"
)
...
@@ -246,7 +246,7 @@ def check_enzyme_name(name_new_enz, all_name_enz):
...
@@ -246,7 +246,7 @@ def check_enzyme_name(name_new_enz, all_name_enz):
return
ret
return
ret
# Not tested
# Not tested
def
user_creation_enzyme
():
def
user_creation_enzyme
(
all_enzymes
):
"""
Text-mod form to input a new enzyme.
"""
Text-mod form to input a new enzyme.
.. warning:: Not tested
.. warning:: Not tested
...
@@ -259,21 +259,8 @@ def user_creation_enzyme():
...
@@ -259,21 +259,8 @@ def user_creation_enzyme():
all_name_enz
=
set
()
all_name_enz
=
set
()
# Get all used names
# Get all used names
# Done here to prevent multiple time opening those files
for
enz
in
all_enzymes
:
try
:
all_name_enz
.
add
(
enz
.
name
)
with
open
(
DEFENZFILE
)
as
enz_file
:
for
line
in
enz_file
:
if
line
[
0
:
29
]
==
"
ENZYME = enzyme.Enzyme(CPT_ENZ,
"
:
all_name_enz
.
add
(
line
.
split
(
"
\"
"
)[
1
])
except
IOError
:
core
.
handle_errors
(
"
fail to open
"
+
DEFENZFILE
,
0
,
"
File
"
)
try
:
with
open
(
DEFUSERENZFILE
)
as
user_enz_file
:
for
line
in
user_enz_file
:
if
line
[
0
:
29
]
==
"
ENZYME = enzyme.Enzyme(CPT_ENZ,
"
:
all_name_enz
.
add
(
line
.
split
(
"
\"
"
)[
1
])
except
IOError
:
core
.
handle_errors
(
"
fail to open
"
+
DEFUSERENZFILE
,
0
,
"
File
"
)
# Name of the enzyme
# Name of the enzyme
name_new_enz
=
input
(
"
Name of the new enzyme?
\n
"
)
name_new_enz
=
input
(
"
Name of the new enzyme?
\n
"
)
...
...
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