Skip to content

Instantly share code, notes, and snippets.

View dehaenw's full-sized avatar

dehaenw

  • Praha
View GitHub Profile
@dehaenw
dehaenw / haloalkane_smiles.csv
Created April 28, 2025 11:48
convert data from https://pubs.acs.org/doi/10.1021/ci049802u si to SMILES using RDKit
Molecule expbp reliability calcbp(m14) Residual Structure smiles
Bjkh99 47.0 2 56.827 -9.8272 CH3-CH2-CH2Cl CCCCl
Bjkh10 -51.6 2 -66.527 14.927 CH2F2 FCF
Bjkh101 41.0 1 47.896 -6.8962 CH2F-CH2-CH2F FCCCF
Bjkh102 36.0 2 38.257 -2.2567 CH3-CHCl-CH3 CC(C)Cl
Bjkh103 35.7 2 36.341 -0.64075 CF2Cl-CF2-CF2Cl FC(F)(Cl)C(F)(F)C(F)(F)Cl
Bjkh104 35.2 2 27.451 7.7489 CH3-CClF-CH3 CC(C)(F)Cl
Bjkh105 35.0 0 36.341 -1.3408 CCl2F-CF2-CF3 FC(F)(F)C(F)(F)C(F)(Cl)Cl
Bjkh106 28.0 2 29.066 -1.0663 CH2Cl-CF2-CF3 FC(F)(F)C(F)(F)CCl
Bjkh107 26.0 1 32.816 -6.8158 CH3-CH2-CClF2 CCC(F)(F)Cl
@dehaenw
dehaenw / never_go_from_inchi_to_mol.ipynb
Created October 5, 2023 12:16
Never go from inchi back to mol!!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import rdkit
from rdkit import Chem
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem.Pharm2D.SigFactory import SigFactory
from rdkit.Chem.Pharm2D import Generate
from rdkit import RDConfig
import os
featFactory = ChemicalFeatures.BuildFeatureFactory(os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef'))
sigFactory = SigFactory(featFactory,minPointCount=2,maxPointCount=3,trianglePruneBins=False)
sigFactory.SetBins([(0,2),(2,5),(5,8)])
import itertools as it
import numpy as np
import midiutil
from midiutil.MidiFile import MIDIFile
#generates about half an h of modal fingerpicking tunes using a simple markov model
#change the seed with increments of about 100K to get a new one.
#lots of parameters to play around with but you can figure it out yourself.
@dehaenw
dehaenw / gen.py
Last active December 8, 2021 16:30
SSCP
import itertools as it
allsmi=[]
maxvalence=2
def cl_ratio(Cl,C):
return Cl*35.45/((C*12.011)+(Cl*35.453)+((C*2-Cl+2)*1.008)) #ratio of chlorine vs total MW
for chainlength in [10,11,12,13]:
combinations = (list(i) for i in it.product(list(range(maxvalence+1)),repeat=chainlength) if tuple(reversed(i)) >= tuple(i)) #filter out mirror image molecules
from scipy.io import wavfile
import scipy.io
from scipy.fft import fft, ifft
import numpy as np
"""
chord.wav should be a short sound, equivalent to carrier in vocoder
impulse.wav should be a quite sparse transient heavy sound, equivalent to modulator in vocoder
play with tsmear and asmear to tweak between vocoder and convolution like sound
"""
Tsmear = 1000