forked from enviPath/enviPy
[Feature] Generate Compounds by Molfile (#423)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#423
This commit is contained in:
@ -791,6 +791,7 @@ def get_package_compound_structure(request, package_uuid, compound_uuid, structu
|
||||
|
||||
class CreateCompound(Schema):
|
||||
compoundSmiles: str
|
||||
compoundMolFile: str | None = None
|
||||
compoundName: str | None = None
|
||||
compoundDescription: str | None = None
|
||||
inchi: str | None = None
|
||||
@ -804,9 +805,13 @@ def create_package_compound(
|
||||
):
|
||||
try:
|
||||
p = get_package_for_write(request.user, package_uuid)
|
||||
# inchi is not used atm
|
||||
c = Compound.create(
|
||||
p, c.compoundSmiles, c.compoundName, c.compoundDescription, inchi=c.inchi
|
||||
p,
|
||||
c.compoundSmiles,
|
||||
molfile=c.compoundMolFile,
|
||||
name=c.compoundName,
|
||||
description=c.compoundDescription,
|
||||
inchi=c.inchi,
|
||||
)
|
||||
return redirect(c.url)
|
||||
except ValueError as e:
|
||||
@ -1899,6 +1904,7 @@ def get_package_pathway_node(request, package_uuid, pathway_uuid, node_uuid):
|
||||
|
||||
class CreateNode(Schema):
|
||||
nodeAsSmiles: str
|
||||
nodeAsMolFile: str | None = None
|
||||
nodeName: str | None = None
|
||||
nodeReason: str | None = None
|
||||
nodeDepth: str | None = None
|
||||
@ -1918,7 +1924,14 @@ def add_pathway_node(request, package_uuid, pathway_uuid, n: Form[CreateNode]):
|
||||
else:
|
||||
node_depth = -1
|
||||
|
||||
n = Node.create(pw, n.nodeAsSmiles, node_depth, n.nodeName, n.nodeReason)
|
||||
n = Node.create(
|
||||
pw,
|
||||
n.nodeAsSmiles,
|
||||
node_depth,
|
||||
molfile=n.nodeAsMolFile,
|
||||
name=n.nodeName,
|
||||
description=n.nodeReason,
|
||||
)
|
||||
|
||||
return redirect(n.url)
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user