Tags: SwanHubX/SwanLab
Tags
[Feature] Molecule Meida Object3D Support. (#920) * feat: Add Molecule class for 3D molecule visualization This commit introduces the Molecule class, which is used to visualize 3D molecules. The class can be initialized with PDB data or from an RDKit Mol object. It includes methods for parsing the molecule data into a buffer and for returning metadata for visualization. * feat: Add molecule visualization test This commit introduces a test case for visualizing molecules using swanlab.data.modules.object3d.Molecule. * chore: english comment. * Add Molecule class to object3d module This commit introduces the Molecule class for handling molecule data from various formats using the RDKit library, and add it to `__all__` in `__init__.py`. * Feat: Add Molecule class methods for file inputs Adds from_pdb_file, from_sdf_file, from_smiles and from_mol_file methods to the Molecule class. These methods allow creating Molecule instances from various file formats (PDB, SDF, Mol) and SMILES strings, providing more flexibility in how molecule data is loaded and displayed. * Support molecule objects in Object3D Enable creation of Object3D from rdkit.Chem.Mol objects and add file handlers for common molecule file formats. * test: add pdb file molecule test example. * chore: update molecule test example. * chore: change test example molecule file path. * chore: add requirements rdkit for molecule * chore: update code sytle for import. * test: Add test for `swanlab.data.modules.object3d.Molecule` This commit introduces a comprehensive test suite for the `Molecule` class within the `swanlab.data.modules.object3d` module. The tests cover various functionalities including: - Creating `Molecule` objects from different file formats (PDB, SDF, Mol) and SMILES strings. - Parsing `Molecule` objects. - Verifying metadata such as caption and chart type. - Ensures that `Object3D` correctly dispatches `Molecule` objects. * chore: some misc * chore: change chart type * fix: test --------- Co-authored-by: KAAANG <79990647+SAKURA-CAT@users.noreply.github.com>
PreviousNext