Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add support of SDF/MOL2 Files #22

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions mdonatello/mdonatello.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class MoleculeVisualizer:

def __init__(
self,
ag: mda.core.groups.AtomGroup,
name: str,
ag: str = None,
show_atom_indices: bool = False,
width: int = -1,
height: int = -1,
Expand All @@ -67,7 +68,15 @@ def __init__(
self.height = height
self.show_atom_indices = show_atom_indices

self.mol: Chem.Mol = ag.convert_to("RDKit")
self.name = name
self.ag = ag

if ".sdf" not in self.name and ".mol2" not in self.name:
self.u = mda.Universe(self.name)
if self.ag != None:
self.ag = u.select_atoms(f"resname {self.ag}")
self.mol: Chem.Mol = ag.convert_to("RDKit")

self.mol_noh: Chem.Mol = Chem.RemoveHs(self.mol)
AllChem.Compute2DCoords(self.mol_noh)

Expand Down
Loading