Skip to content

Instantly share code, notes, and snippets.

"""sdfdatareader.py
Super fast skimmer over sdf files just to return the data
fields
"""
def sdf(filename):
input = open(filename, "r")
data = {}
for line in input:
/server freenode
/nick baoilleach
/msg NickServ identify ******
/join openbabel
#!/bin/bash
root=/home/oboyle/not-backed-up
prefix=$root/tree
if [ ! -d $root ]
then
echo "Cannot find the autobuild folder: $root"
exit 1
fi
#!/usr/bin/python
import os, os.path
import sys
import smtplib
import datetime
nightly_dir = '/home/oboyle/not-backed-up'
output = open(os.path.join(nightly_dir, 'log.txt'),"a")
Download Visual C++ 2008 Express Edition.
C:\Tools\OpenBabel\trunk>"C:\Program Files\CMake 2.6\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=..\buildtrunk -G "Visual Studio 9 2008" -DLIBXML2_LIBRARIES=windows-vc2005\libxml2.lib -DZLIB_LIBRARY=windows-vc2005\zlib1.lib -DLIBXML2_INCLUDE_DIR=windows-vc2005 -DZLIB_INCLUDE_DIR=windows-vc2005
Open openbabel.sln and build
The lyf so short, the craft so long to lerne.
-- Chaucer
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
# Find errors with Implicit Hs
import pybel
import glob
sdfs = glob.glob("C:\Tools\openbabel\PubChem3D\*.sdf")
print sdfs
for sdf in sdfs:
@baoilleach
baoilleach / gist:663914
Created November 5, 2010 10:10
Substructure benchmark
import time
import pybel
ob = pybel.ob
molecules = list(pybel.readfile("sdf", "pubchem_416_benzenes.sdf"))
t = time.time()
query = ob.CompileSmilesQuery("c1ccccc1")
@baoilleach
baoilleach / gist:706453
Created November 19, 2010 12:25
Plot PES from Firefly
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()