As a part of a series on sharing components, I will share a solution for selecting atoms from molecules is very useful for developing molecular optimization scenarios.
Install
pip install streamlit-molecular-selection
Usage
import streamlit as st
#st.write(st_molecule_selection('CC(C)CN(CC(C(CC1CCCCC1)NC(OC1C(CCO2)C2OC1)=O)O)S(C(CC1)CCC1N)(=O)=O', height=100))
st.write(st_molecule_selection('CC(C)CN(CC(C(CC1CCCCC1)NC(OC1C(CCO2)C2OC1)=O)O)S(C(CC1)CCC1N)(=O)=O', nop_selection=True,
preset_selections=[0, 1, 2, 4, 5],
key='2'))
with open('examples/3d20_ligand.sdf') as f:
st.write(st_molecule_selection(f.read(), ftype='mol', key='4'))