This file contains hidden or 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
The lyf so short, the craft so long to lerne. | |
-- Chaucer |
This file contains hidden or 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
def sdfsingledata(filename, data): | |
if filename.endswith(".gz"): | |
input = gzip.open(filename, "r") | |
else: | |
input = open(filename, "r") | |
fieldname = "> <%s>\n" % data | |
for line in input: | |
if line == fieldname: | |
line = input.next().strip() | |
yield line |
This file contains hidden or 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
# Find errors with Implicit Hs | |
import pybel | |
import glob | |
sdfs = glob.glob("C:\Tools\openbabel\PubChem3D\*.sdf") | |
print sdfs | |
for sdf in sdfs: |
This file contains hidden or 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
import time | |
import pybel | |
ob = pybel.ob | |
molecules = list(pybel.readfile("sdf", "pubchem_416_benzenes.sdf")) | |
t = time.time() | |
query = ob.CompileSmilesQuery("c1ccccc1") |
This file contains hidden or 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
from pylab import * | |
inputfile = open("tmp3.txt", "r") | |
for line in inputfile: | |
if line.startswith(" ENERGY DELTA MAP(S) (W.R. TO THE LOWEST FOUND)"): | |
break | |
blank = inputfile.next() | |
dash = inputfile.next() |
This file contains hidden or 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
Use "Fit to Printable Area", in combination with 2 pages per sheet. The default setting is "Shrink to Printable Area". |
This file contains hidden or 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
import pybel | |
def dodgywedge(sdffile): | |
tot = probs = potential_probs = 0 | |
for mol in pybel.readfile("sdf", sdffile): | |
tot += 1 | |
facade = pybel.ob.OBStereoFacade(mol.OBMol) | |
tetcenters = [atom.OBAtom for atom in mol | |
if facade.HasTetrahedralStereo(atom.OBAtom.GetId())] | |
for idx, atom_a in enumerate(tetcenters[:-1]): |
This file contains hidden or 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
Here's part of extconf.rb from OB after some edits to add support for --prefix. Unfortunately, this doesn't work (see discussion of mkmf2 which tries to fix some of these problems) | |
require 'getoptlong' | |
makeopts = {} | |
opts = GetoptLong.new(["--prefix", "-p", GetoptLong::OPTIONAL_ARGUMENT], | |
["--with-openbabel-lib", "-L", GetoptLong::OPTIONAL_ARGUMENT], | |
["--with-openbabel-include", "-I", GetoptLong::OPTIONAL_ARGUMENT] | |
).each{|o, a| makeopts[o[%r/[^-].*/]] = a} | |
prefix = makeopts.delete('prefix') || nil | |
oblib = makeopts.delete('with-openbabel-lib') || nil |
This file contains hidden or 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
import os | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
##import sys | |
##sys.path.append("C:\\Python26\\Lib\\site-packages") | |
##sys.path.append("C:\\Python26\\lib") | |
import Avogadro as avo |
This file contains hidden or 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
from PyQt4.Qt import * | |
import Avogadro | |
class Engine(QObject): | |
# declare the changed() signal | |
__pyqtSignals__ = ("changed()",) | |
# constructor | |
def __init__(self): |