Created
March 6, 2020 12:54
-
-
Save bougui505/94d6457346727b654301111bea4da937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: UTF8 -*- | |
# Author: Guillaume Bouvier -- [email protected] | |
# https://research.pasteur.fr/en/member/guillaume-bouvier/ | |
# 2020-03-06 13:17:44 (UTC+0100) | |
from pymol import cmd | |
from pymol import exporting | |
cmd.load('small03.mol2', 'mol2_in') | |
nstates = cmd.count_states('mol2_in') | |
for i in range(1, nstates + 1): | |
cmd.split_states('mol2_in', i, i) | |
molname = cmd.get_object_list()[-1] | |
# ------------------------------ Save a mol2 file ------------------------------ | |
cmd.save('out.mol2', molname) | |
# ---------------------------- or get a mol2 string ---------------------------- | |
mol2str = exporting.get_mol2str('mol2_in') | |
print(mol2str) | |
# ------------------------------------- - -------------------------------------- | |
cmd.delete(molname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment