forked from enviPath/enviPy
adjusted migration
Initial bayer app Show Pack Classification Adjusted docker compose to bayer specifics Adjusted Dockerfile for Bayer Adding secret flags to group, add secret pools to packages Adjusted View for Package creation Prep configs, added Package Create Modal wip More on PES wip wip Wip minor PW interactions API PES wip Make Select Widget reflect required make required generallay available Update UI if pathway mode is set to build Added ais circle adjustments Initial Zoom, fix AD Creation wip auth log, bb4g fix missing import Added viz hint if PES is part of reaction Add Edge check for pes flip boolean ... pes Added extra ... In / Out Edges Viz, Submitting Button Text ... Make PES Link clickable Return proper http response instead of error Fixed error return, removed unused options Fix PES Link HTML for other entities Fixed molfile assignment, adjusted Export Package Export/Import cycle highlight Description links implemented non persistent Harmonised proposed field in Json output Added pesLink field to PW Api output PES Fields in API Output removed debug Fix Classification import, Fix PES Deserialization underline pes link in templates Fix alter name/desc for node, make /node /edge funcitonal provide setting link and copy button Implemented Compound Names / Reaction Names View Option Unconnected Nodes Make links thicker, reduce timeout trigger time Show proposed info in popover Pathway Build no stereo removal Include probs in reaction name option viz Detect clicks outside nodes/edges
This commit is contained in:
@ -389,6 +389,9 @@ def get_base_context(request, for_user=None) -> Dict[str, Any]:
|
||||
"debug": s.DEBUG,
|
||||
"external_databases": ExternalDatabase.get_databases(),
|
||||
"site_id": s.MATOMO_SITE_ID,
|
||||
# EDIT START
|
||||
"secret_groups": Group.objects.filter(secret=True),
|
||||
# EDIT END
|
||||
},
|
||||
}
|
||||
|
||||
@ -588,10 +591,38 @@ def packages(request):
|
||||
"package-description", s.DEFAULT_VALUES["description"]
|
||||
)
|
||||
|
||||
# EDIT START
|
||||
data_pool = None
|
||||
package_classification = request.POST.get("package-classification")
|
||||
classification = Package.Classification(int(package_classification))
|
||||
# For SECRET we'll need a data pool which will be an additional perm check later
|
||||
if classification == Package.Classification.SECRET:
|
||||
package_data_pool = request.POST.get("package-data-pool")
|
||||
|
||||
if package_data_pool is None:
|
||||
return error(request, "Invalid data pool.", "Data Pool is required!")
|
||||
|
||||
data_pool = GroupManager.get_group_by_url(current_user, package_data_pool)
|
||||
|
||||
if data_pool is None:
|
||||
return error(request, "Invalid data pool.", "Data Pool does not exist or no access!")
|
||||
|
||||
if not data_pool.secret:
|
||||
return error(request, "Invalid data pool.", "Data Pool is not a secret group!")
|
||||
|
||||
created_package = PackageManager.create_package(
|
||||
current_user, package_name, package_description
|
||||
)
|
||||
|
||||
created_package.classification_level = classification
|
||||
|
||||
# Set previously determined data pool
|
||||
if classification == Package.Classification.SECRET:
|
||||
created_package.data_pool = data_pool
|
||||
|
||||
created_package.save()
|
||||
# EDIT END
|
||||
|
||||
return redirect(created_package.url)
|
||||
|
||||
elif request.method == "OPTIONS":
|
||||
@ -775,13 +806,11 @@ def models(request):
|
||||
}
|
||||
|
||||
if s.ENVIFORMER_PRESENT:
|
||||
context["model_types"]["EnviFormer"] = (
|
||||
{
|
||||
"type": "enviformer",
|
||||
"requires_rule_packages": False,
|
||||
"requires_data_packages": True,
|
||||
},
|
||||
)
|
||||
context["model_types"]["EnviFormer"] = {
|
||||
"type": "enviformer",
|
||||
"requires_rule_packages": False,
|
||||
"requires_data_packages": True,
|
||||
}
|
||||
|
||||
if s.FLAGS.get("PLUGINS", False):
|
||||
for k, v in s.CLASSIFIER_PLUGINS.items():
|
||||
@ -2102,12 +2131,14 @@ def package_pathways(request, package_uuid):
|
||||
else:
|
||||
prediction_setting = current_user.prediction_settings()
|
||||
|
||||
is_predict_mode = pw_mode in {"predict", "incremental"}
|
||||
|
||||
pw = Pathway.create(
|
||||
current_package,
|
||||
stand_smiles,
|
||||
stand_smiles if is_predict_mode else smiles,
|
||||
name=name,
|
||||
description=description,
|
||||
predicted=pw_mode in {"predict", "incremental"},
|
||||
predicted=is_predict_mode,
|
||||
)
|
||||
|
||||
# set mode
|
||||
@ -2466,7 +2497,22 @@ def package_pathway_node(request, package_uuid, pathway_uuid, node_uuid):
|
||||
|
||||
return JsonResponse({"success": current_node.url})
|
||||
|
||||
return HttpResponseBadRequest()
|
||||
new_node_name = request.POST.get("node-name")
|
||||
new_node_description = request.POST.get("node-description")
|
||||
|
||||
if any([new_node_name, new_node_description]):
|
||||
if new_node_name is not None and new_node_name.strip() != "":
|
||||
new_node_name = nh3.clean(new_node_name.strip(), tags=s.ALLOWED_HTML_TAGS).strip()
|
||||
current_node.name = new_node_name
|
||||
|
||||
if new_node_description is not None and new_node_description.strip() != "":
|
||||
new_node_description = nh3.clean(new_node_description.strip(), tags=s.ALLOWED_HTML_TAGS).strip()
|
||||
current_node.description = new_node_description
|
||||
|
||||
current_node.save()
|
||||
return redirect(current_node.url)
|
||||
|
||||
return error(request, "Node update failed!", "No changes were made to the node")
|
||||
else:
|
||||
return HttpResponseNotAllowed(["GET", "POST"])
|
||||
|
||||
@ -2998,9 +3044,15 @@ def settings(request):
|
||||
new_default = request.POST.get("prediction-setting-new-default", "off") == "on"
|
||||
|
||||
# min 2, max s.DEFAULT_MAX_NUMBER_OF_NODES
|
||||
temp_max_nodes = request.POST.get("prediction-setting-max-nodes")
|
||||
if temp_max_nodes is None or temp_max_nodes == "" or int(temp_max_nodes) == -1:
|
||||
temp_max_nodes = s.DEFAULT_MAX_NUMBER_OF_NODES
|
||||
else:
|
||||
temp_max_nodes = int(request.POST.get("prediction-setting-max-nodes", 1))
|
||||
|
||||
max_nodes = min(
|
||||
max(
|
||||
int(request.POST.get("prediction-setting-max-nodes", 1)),
|
||||
temp_max_nodes,
|
||||
2,
|
||||
),
|
||||
s.DEFAULT_MAX_NUMBER_OF_NODES,
|
||||
@ -3021,6 +3073,7 @@ def settings(request):
|
||||
|
||||
model_uuid = model_url.split("/")[-1]
|
||||
params["model"] = EPModel.objects.get(uuid=model_uuid)
|
||||
# TODO Check if removed if request contains "" or not at all
|
||||
params["model_threshold"] = request.POST.get(
|
||||
"model-based-prediction-setting-threshold", s.DEFAULT_MODEL_THRESHOLD
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user