Spaces:
Sleeping
Sleeping
eachanjohnson
commited on
Commit
·
05fa320
1
Parent(s):
0a916d4
Sat Oct 12 18:02:57 UTC 2024 :: HF Spaces deployment
Browse files
README.md
CHANGED
@@ -30,9 +30,10 @@ to...
|
|
30 |
- InChI
|
31 |
- InChIKey
|
32 |
- Name
|
33 |
-
-
|
|
|
34 |
- TPSA
|
35 |
-
-
|
36 |
-
-
|
37 |
|
38 |
... and several others!
|
|
|
30 |
- InChI
|
31 |
- InChIKey
|
32 |
- Name
|
33 |
+
- Murcko scaffold
|
34 |
+
- Crippen LogP
|
35 |
- TPSA
|
36 |
+
- Molecular weight
|
37 |
+
- Charge
|
38 |
|
39 |
... and several others!
|
app.py
CHANGED
@@ -38,11 +38,12 @@ def _convert_input(
|
|
38 |
output_representation: Union[Iterable[str], str] = 'smiles'
|
39 |
) -> List[str]:
|
40 |
strings = _clean_split_input(strings)
|
41 |
-
|
42 |
strings=strings,
|
43 |
input_representation=input_representation,
|
44 |
output_representation=output_representation,
|
45 |
-
)
|
|
|
46 |
|
47 |
|
48 |
def convert_one(
|
@@ -74,8 +75,7 @@ def convert_file(
|
|
74 |
):
|
75 |
message = f"Converting from {input_representation} to {output_representation}..."
|
76 |
print_err(message)
|
77 |
-
gr.Info(message, duration=
|
78 |
-
print_err(df)
|
79 |
errors, df = converter(
|
80 |
df=df,
|
81 |
column=column,
|
@@ -101,8 +101,11 @@ def draw_one(
|
|
101 |
strings: Union[Iterable[str], str],
|
102 |
input_representation: str = 'smiles'
|
103 |
):
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
mols = cast(_x2mol(_clean_split_input(strings), input_representation), to=list)
|
107 |
if isinstance(mols, Mol):
|
108 |
mols = [mols]
|
@@ -110,7 +113,7 @@ def draw_one(
|
|
110 |
mols,
|
111 |
molsPerRow=min(3, len(mols)),
|
112 |
subImgSize=(300, 300),
|
113 |
-
legends=[
|
114 |
)
|
115 |
|
116 |
|
@@ -131,6 +134,12 @@ with gr.Blocks() as demo:
|
|
131 |
"""
|
132 |
)
|
133 |
with gr.Tab(label="Paste one per line"):
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
input_line = gr.Textbox(
|
135 |
label="Input",
|
136 |
placeholder="Paste your molecule here, one per line",
|
@@ -138,12 +147,6 @@ with gr.Blocks() as demo:
|
|
138 |
interactive=True,
|
139 |
submit_btn=True,
|
140 |
)
|
141 |
-
input_format_single = gr.Dropdown(
|
142 |
-
label="Input string format",
|
143 |
-
choices=list(_FROM_FUNCTIONS),
|
144 |
-
value="smiles",
|
145 |
-
interactive=True,
|
146 |
-
)
|
147 |
output_format_single = gr.CheckboxGroup(
|
148 |
label="Output format",
|
149 |
choices=list(_TO_FUNCTIONS),
|
|
|
38 |
output_representation: Union[Iterable[str], str] = 'smiles'
|
39 |
) -> List[str]:
|
40 |
strings = _clean_split_input(strings)
|
41 |
+
converted = convert_string_representation(
|
42 |
strings=strings,
|
43 |
input_representation=input_representation,
|
44 |
output_representation=output_representation,
|
45 |
+
)
|
46 |
+
return {key: list(map(str, cast(val, to=list))) for key, val in converted.items()}
|
47 |
|
48 |
|
49 |
def convert_one(
|
|
|
75 |
):
|
76 |
message = f"Converting from {input_representation} to {output_representation}..."
|
77 |
print_err(message)
|
78 |
+
gr.Info(message, duration=3)
|
|
|
79 |
errors, df = converter(
|
80 |
df=df,
|
81 |
column=column,
|
|
|
101 |
strings: Union[Iterable[str], str],
|
102 |
input_representation: str = 'smiles'
|
103 |
):
|
104 |
+
_ids = _convert_input(
|
105 |
+
strings,
|
106 |
+
input_representation,
|
107 |
+
["inchikey", "id"],
|
108 |
+
)
|
109 |
mols = cast(_x2mol(_clean_split_input(strings), input_representation), to=list)
|
110 |
if isinstance(mols, Mol):
|
111 |
mols = [mols]
|
|
|
113 |
mols,
|
114 |
molsPerRow=min(3, len(mols)),
|
115 |
subImgSize=(300, 300),
|
116 |
+
legends=["\n".join(items) for items in zip(*_ids.values())],
|
117 |
)
|
118 |
|
119 |
|
|
|
134 |
"""
|
135 |
)
|
136 |
with gr.Tab(label="Paste one per line"):
|
137 |
+
input_format_single = gr.Dropdown(
|
138 |
+
label="Input string format",
|
139 |
+
choices=list(_FROM_FUNCTIONS),
|
140 |
+
value="smiles",
|
141 |
+
interactive=True,
|
142 |
+
)
|
143 |
input_line = gr.Textbox(
|
144 |
label="Input",
|
145 |
placeholder="Paste your molecule here, one per line",
|
|
|
147 |
interactive=True,
|
148 |
submit_btn=True,
|
149 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
output_format_single = gr.CheckboxGroup(
|
151 |
label="Output format",
|
152 |
choices=list(_TO_FUNCTIONS),
|