Commit 6e42744f authored by Nicolas  MAILLET's avatar Nicolas MAILLET
Browse files

Change the way of getting enzyme name

parent f3aa9599
......@@ -26,16 +26,16 @@
import os
import re
from pathlib import Path
import core
import rule
from rpg import core
from rpg import rule
DEFENZFILE = "enzymes_definition.py"
DEFUSERENZFILE = str(Path.home()) + "/rpg_user.py"
# Create the enzymes_user file if it does not exist
if not os.path.isfile(DEFUSERENZFILE):
with open(DEFUSERENZFILE, "w") as out_file:
out_file.write("import enzyme\nimport rule\nimport enzymes_definition"\
out_file.write("from rpg import enzyme\nfrom rpg import rule\n"\
"from rpg import enzymes_definition"\
"\n\nAVAILABLE_ENZYMES_USER = []\nCPT_ENZ = enzymes_de"\
"finition.CPT_ENZ\n\n### ENZYMES DECLARATION ###\n")
......@@ -246,7 +246,7 @@ def check_enzyme_name(name_new_enz, all_name_enz):
return ret
# Not tested
def user_creation_enzyme():
def user_creation_enzyme(all_enzymes):
"""Text-mod form to input a new enzyme.
.. warning:: Not tested
......@@ -259,21 +259,8 @@ def user_creation_enzyme():
all_name_enz = set()
# Get all used names
# Done here to prevent multiple time opening those files
try:
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 ")
for enz in all_enzymes:
all_name_enz.add(enz.name)
# Name of the enzyme
name_new_enz = input("Name of the new enzyme?\n")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment