Skip to content

Instantly share code, notes, and snippets.

import math
import pybel
def sqr_dist(a, b):
ac = a.coords
bc = b.coords
return (ac[0]-bc[0])**2 + (ac[1]-bc[1])**2 + (ac[2]-bc[2])**2
# Definitions taken from
# http://baoilleach.blogspot.com/2007/07/pybel-hack-that-sd-file.html
import os
import glob
import subprocess
testprogram = """
#include <openbabel/parsmart.h>
using namespace OpenBabel;
int main(int argc, char *argv[]) {
import urllib
import random
import pdb
import pybel
def getfromPubChem(N = 100, filenames = None):
"""Download N random PubChem molecules as 2D and 3D"""
if filenames == None:
filenames = ["2Ddataset.sdf", "3Ddataset.sdf"]
# Requires PyActiveResource (http://code.google.com/p/pyactiveresource/)
from pyactiveresource.activeresource import ActiveResource
registry_id = "16" # Replace this with your registry_id
password = "password"
user = "baoilleach@gmail.com"
site = "https://chemcaster.com/registries/$registry_id/"
class Structure(ActiveResource):
_site = site
Generate the enol from the ketone...OBChemTsfm..not quite..
>>> t.Init("[C:2](C)(=[O:1])[CH2]", "[C:2](C)([O:1])=C")
True
Chris says:
[*:2][C:3](=[O:1])[C:4] >> [*:2][C:3]([O:1])=[C:4]
works for ketones, except t-butyl ketones are wrong.
"""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
#!/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")
#!/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
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