Upload app.py
Browse files
app.py
CHANGED
|
@@ -906,6 +906,45 @@ app_ui = ui.page_fluid(
|
|
| 906 |
.btn-info {
|
| 907 |
margin-top: 15px;
|
| 908 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
""")
|
| 910 |
),
|
| 911 |
ui.div(
|
|
@@ -973,38 +1012,39 @@ app_ui = ui.page_fluid(
|
|
| 973 |
)
|
| 974 |
)
|
| 975 |
),
|
| 976 |
-
ui.
|
| 977 |
-
|
| 978 |
-
ui.
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 982 |
ui.div(
|
| 983 |
-
{"class": "viewer-
|
| 984 |
-
ui.
|
| 985 |
-
"selected_pdb",
|
| 986 |
-
"Select PDB ID",
|
| 987 |
-
choices=[]
|
| 988 |
-
),
|
| 989 |
ui.div(
|
| 990 |
-
{"class": "viewer-
|
| 991 |
-
ui.
|
|
|
|
|
|
|
|
|
|
| 992 |
)
|
| 993 |
)
|
| 994 |
-
)
|
| 995 |
-
|
| 996 |
-
# Sequence Results Column
|
| 997 |
-
ui.column(6,
|
| 998 |
-
ui.div(
|
| 999 |
-
{"class": "sequence-section"},
|
| 1000 |
-
ui.h4("Sequences"),
|
| 1001 |
ui.div(
|
| 1002 |
-
{"class": "
|
| 1003 |
-
ui.
|
| 1004 |
-
"selected_seq_pdb",
|
| 1005 |
-
"Select PDB ID",
|
| 1006 |
-
choices=[]
|
| 1007 |
-
),
|
| 1008 |
ui.div(
|
| 1009 |
{"class": "sequence-content"},
|
| 1010 |
ui.output_text("sequence_output")
|
|
@@ -1041,6 +1081,11 @@ def server(input, output, session):
|
|
| 1041 |
for line in input.query().split():
|
| 1042 |
if re.match(r'^[0-9A-Za-z]{4}$', line):
|
| 1043 |
pdb_ids.append(line.upper())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1044 |
else:
|
| 1045 |
df = pd.DataFrame(query_results["results"])
|
| 1046 |
if df.empty:
|
|
@@ -1055,17 +1100,11 @@ def server(input, output, session):
|
|
| 1055 |
|
| 1056 |
if pdb_ids:
|
| 1057 |
pdb_ids_store.set(pdb_ids)
|
| 1058 |
-
# Update both dropdowns with the same PDB IDs
|
| 1059 |
ui.update_select(
|
| 1060 |
"selected_pdb",
|
| 1061 |
choices=pdb_ids,
|
| 1062 |
selected=pdb_ids[0]
|
| 1063 |
)
|
| 1064 |
-
ui.update_select(
|
| 1065 |
-
"selected_seq_pdb",
|
| 1066 |
-
choices=pdb_ids,
|
| 1067 |
-
selected=pdb_ids[0]
|
| 1068 |
-
)
|
| 1069 |
else:
|
| 1070 |
pdb_ids_store.set([])
|
| 1071 |
ui.update_select(
|
|
@@ -1073,11 +1112,6 @@ def server(input, output, session):
|
|
| 1073 |
choices=[],
|
| 1074 |
selected=None
|
| 1075 |
)
|
| 1076 |
-
ui.update_select(
|
| 1077 |
-
"selected_seq_pdb",
|
| 1078 |
-
choices=[],
|
| 1079 |
-
selected=None
|
| 1080 |
-
)
|
| 1081 |
|
| 1082 |
@output
|
| 1083 |
@render.text
|
|
@@ -1087,7 +1121,7 @@ def server(input, output, session):
|
|
| 1087 |
@output
|
| 1088 |
@render.text
|
| 1089 |
def sequence_output():
|
| 1090 |
-
selected_pdb = input.
|
| 1091 |
if not selected_pdb:
|
| 1092 |
return "No PDB ID selected"
|
| 1093 |
|
|
|
|
| 906 |
.btn-info {
|
| 907 |
margin-top: 15px;
|
| 908 |
}
|
| 909 |
+
.structure-details-section {
|
| 910 |
+
margin-top: 20px;
|
| 911 |
+
background-color: #f8f9fa;
|
| 912 |
+
border: 1px solid #dee2e6;
|
| 913 |
+
border-radius: 8px;
|
| 914 |
+
padding: 20px;
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
.pdb-selector {
|
| 918 |
+
display: flex;
|
| 919 |
+
align-items: center;
|
| 920 |
+
justify-content: flex-start;
|
| 921 |
+
gap: 5px;
|
| 922 |
+
margin-bottom: 20px;
|
| 923 |
+
margin-left: 20px;
|
| 924 |
+
}
|
| 925 |
+
|
| 926 |
+
.pdb-select-label {
|
| 927 |
+
font-weight: bold;
|
| 928 |
+
margin: 0;
|
| 929 |
+
white-space: nowrap;
|
| 930 |
+
display: inline-block;
|
| 931 |
+
vertical-align: middle;
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
.pdb-selector select {
|
| 935 |
+
margin-left: 0;
|
| 936 |
+
vertical-align: middle;
|
| 937 |
+
display: inline-block;
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
.viewer-section, .sequence-section {
|
| 941 |
+
background-color: white;
|
| 942 |
+
border: 1px solid #dee2e6;
|
| 943 |
+
border-radius: 8px;
|
| 944 |
+
padding: 20px;
|
| 945 |
+
margin-top: 20px;
|
| 946 |
+
height: 100%;
|
| 947 |
+
}
|
| 948 |
""")
|
| 949 |
),
|
| 950 |
ui.div(
|
|
|
|
| 1012 |
)
|
| 1013 |
)
|
| 1014 |
),
|
| 1015 |
+
ui.div(
|
| 1016 |
+
{"class": "structure-details-section"},
|
| 1017 |
+
ui.div(
|
| 1018 |
+
{"class": "pdb-selector"},
|
| 1019 |
+
ui.tags.label(
|
| 1020 |
+
"Select PDB ID",
|
| 1021 |
+
{"class": "pdb-select-label"}
|
| 1022 |
+
),
|
| 1023 |
+
ui.input_select(
|
| 1024 |
+
"selected_pdb",
|
| 1025 |
+
"", # Label is empty as we're using a separate label
|
| 1026 |
+
choices=[],
|
| 1027 |
+
width="200px"
|
| 1028 |
+
)
|
| 1029 |
+
),
|
| 1030 |
+
ui.row(
|
| 1031 |
+
ui.column(6,
|
| 1032 |
ui.div(
|
| 1033 |
+
{"class": "viewer-section"},
|
| 1034 |
+
ui.h4("3D Structure Viewer"),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1035 |
ui.div(
|
| 1036 |
+
{"class": "viewer-content"},
|
| 1037 |
+
ui.div(
|
| 1038 |
+
{"class": "viewer-iframe"},
|
| 1039 |
+
ui.output_ui("output_iframe")
|
| 1040 |
+
)
|
| 1041 |
)
|
| 1042 |
)
|
| 1043 |
+
),
|
| 1044 |
+
ui.column(6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1045 |
ui.div(
|
| 1046 |
+
{"class": "sequence-section"},
|
| 1047 |
+
ui.h4("Sequences"),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1048 |
ui.div(
|
| 1049 |
{"class": "sequence-content"},
|
| 1050 |
ui.output_text("sequence_output")
|
|
|
|
| 1081 |
for line in input.query().split():
|
| 1082 |
if re.match(r'^[0-9A-Za-z]{4}$', line):
|
| 1083 |
pdb_ids.append(line.upper())
|
| 1084 |
+
# Clear the results table for sequence queries
|
| 1085 |
+
@output
|
| 1086 |
+
@render_widget
|
| 1087 |
+
def results_table():
|
| 1088 |
+
return create_interactive_table(pd.DataFrame())
|
| 1089 |
else:
|
| 1090 |
df = pd.DataFrame(query_results["results"])
|
| 1091 |
if df.empty:
|
|
|
|
| 1100 |
|
| 1101 |
if pdb_ids:
|
| 1102 |
pdb_ids_store.set(pdb_ids)
|
|
|
|
| 1103 |
ui.update_select(
|
| 1104 |
"selected_pdb",
|
| 1105 |
choices=pdb_ids,
|
| 1106 |
selected=pdb_ids[0]
|
| 1107 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1108 |
else:
|
| 1109 |
pdb_ids_store.set([])
|
| 1110 |
ui.update_select(
|
|
|
|
| 1112 |
choices=[],
|
| 1113 |
selected=None
|
| 1114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1115 |
|
| 1116 |
@output
|
| 1117 |
@render.text
|
|
|
|
| 1121 |
@output
|
| 1122 |
@render.text
|
| 1123 |
def sequence_output():
|
| 1124 |
+
selected_pdb = input.selected_pdb()
|
| 1125 |
if not selected_pdb:
|
| 1126 |
return "No PDB ID selected"
|
| 1127 |
|