Skip to content

Instantly share code, notes, and snippets.

View acruzpr's full-sized avatar

Anthony Cruz acruzpr

View GitHub Profile
@acruzpr
acruzpr / pip-cache-install.py
Created March 20, 2018 20:28 — forked from jacobian/pip-cache-install.py
Install a package from your local pip download cache without touching the 'net.
#!/usr/bin/env python
"""
Install a package from your local pip download cache without having to touch
the 'net at all.
You'll need to be using a pip download cache; that is, you'll need the
following in your ~/.pip/pip.cfg:
[install]
@acruzpr
acruzpr / visualstudiocode.sh
Created March 29, 2018 20:49 — forked from ted-piotrowski/visualstudiocode.sh
Visual Studio Code on ARM Debian Linux
# building Visual Studio Code Debian package on ARM
# get source code
git clone git@github.com:Microsoft/vscode.git
cd vscode
# build debian package
./scripts/npm.sh install --arch=armhf
./node_modules/.bin/gulp vscode-linux-arm-build-deb
@acruzpr
acruzpr / visualstudiocode.sh
Created March 29, 2018 20:49 — forked from ted-piotrowski/visualstudiocode.sh
Visual Studio Code on ARM Debian Linux
# building Visual Studio Code Debian package on ARM
# get source code
git clone git@github.com:Microsoft/vscode.git
cd vscode
# build debian package
./scripts/npm.sh install --arch=armhf
./node_modules/.bin/gulp vscode-linux-arm-build-deb
@acruzpr
acruzpr / visualstudiocode.sh
Created March 29, 2018 20:49 — forked from ted-piotrowski/visualstudiocode.sh
Visual Studio Code on ARM Debian Linux
# building Visual Studio Code Debian package on ARM
# get source code
git clone git@github.com:Microsoft/vscode.git
cd vscode
# build debian package
./scripts/npm.sh install --arch=armhf
./node_modules/.bin/gulp vscode-linux-arm-build-deb
@acruzpr
acruzpr / aminoacids.py
Created January 24, 2019 02:21 — forked from cstein/aminoacids.py
Generating and depicting structures using the Open Babel API
def getAminoAcids(include_protonated=False):
molecules = dict()
molecules['GLY'] = 'NCC(=O)O'
molecules['ALA'] = 'NC(C)C(=O)O'
molecules['SER'] = 'NC(CO)C(=O)O'
molecules['THR'] = 'NC(C(C)O)C(=O)O'
molecules['CYS'] = 'NC(CS)C(=O)O'
molecules['VAL'] = 'NC(C(C)C)C(=O)O'
molecules['LEU'] = 'NC(CC(C)C)C(=O)O'
molecules['ILE'] = 'NC(C(C)CC)C(=O)O'
@acruzpr
acruzpr / pbconstraint.py
Created January 24, 2019 02:39 — forked from andersx/pbconstraint.py
Constraint optimization in Python with Open Babel
import openbabel as ob
# Standard openbabel molecule load
conv = ob.OBConversion()
conv.SetInAndOutFormats('xyz','xyz')
mol = obOBMol()
conv.ReadFile(mol,'my_mol.xyz')
# Define constraints
constraints = ob.OBFFConstraints()
@acruzpr
acruzpr / generate_limited_rotamer_set.py
Created January 24, 2019 02:43 — forked from kylebarlow/generate_limited_rotamer_set.py
Python script using openbabel to generate 3d conformers for a small molecule for a limited subset of atoms
# Copyright (c) 2016 Kyle Barlow
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
@acruzpr
acruzpr / cg.py
Created March 28, 2019 01:58 — forked from sfujiwara/cg.py
conjugate gradient method implemented with python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.sparse.linalg import cg
import tensorflow as tf
import time
def conjugate_grad(A, b, x=None):
"""
@acruzpr
acruzpr / convert_molecules.py
Created June 10, 2020 19:41 — forked from leelasd/convert_molecules.py
Convert Smiles code to 3D and save to SDF
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem
df = pd.read_csv('SMILES.csv')
mols = [Chem.MolFromSmiles(smi) for smi in df.SMILES]
hmols = [Chem.AddHs(m) for m in mols]
for mol in hmols:
AllChem.EmbedMolecule(mol,AllChem.ETKDG())
print(AllChem.UFFOptimizeMolecule(mol,1000))
smiles = list(df.SMILES)