Skip to content

Instantly share code, notes, and snippets.

View matteoferla's full-sized avatar

Matteo Ferla matteoferla

View GitHub Profile
@matteoferla
matteoferla / docstrings2md.py
Last active April 3, 2024 12:26
Python codeblock to generate a file called 'autogenerated_docs.md' which has all the docstrings converted to markdown via Sphinx 🐍📝🦁
# for details see https://stackoverflow.com/questions/36237477/python-docstrings-to-github-readme-md
# further details in https://blog.matteoferla.com/2019/11/convert-python-docstrings-to-github.html
import re
import shutil
import os
import subprocess
# ## Settings
repo_path = '/Users/👾👾👾/👾👾👾'
@matteoferla
matteoferla / fixes-found.md
Last active March 16, 2024 19:26
I am going to write a comment for every damn IT issue/fix I get...

This is an experiment. Is a GitHub Gist comment a good way to log publically how I fixed an installation or similar issue?

See comments

@matteoferla
matteoferla / set_to_neutral_pH
Last active March 15, 2024 19:13
A small function to fix the pH protonation/deprotonation of RDKit Chem objects —fixes the charge of simple, i.e. biological cases. So amino acid is fine, but complex artificial drug won't be.
from rdkit import mol
def set_to_neutral_pH(mol: Chem):
"""
Not great, but does the job.
* Protonates amines, but not aromatic bound amines.
* Deprotonates carboxylic acid, phosphoric acid and sulfuric acid, without ruining esters.
"""
protons_added = 0
@matteoferla
matteoferla / slimmer
Created March 6, 2024 17:38
Slim down PSE file with superposed chains in multiple objects
import numpy as np
import pymol2
token_resi = 25 # this present in all chains
filename = '👾👾👾.pse'
coords = {}
with pymol2.PyMOL() as pymol:
pymol.cmd.load('crysalin_lattice.pse')
for name in pymol.cmd.get_object_list():
for chain in pymol.cmd.get_chains(name):
@matteoferla
matteoferla / cuda11.8.md
Last active January 26, 2024 17:01
Singularity and CUDA

I want Pytorch, Jax and Tensorflow.

Check: nvidia-smi still gives 'NVIDIA-SMI 510.85.02 Driver Version: 510.85.02 CUDA Version: 11.6 '

conda activate base
unset LD_LIBRARY_PATH
unset CUDA_HOME
export NEW_ENV='cuda118redux'
export CONDA_ALWAYS_YES=yes
@matteoferla
matteoferla / bashrc.sh
Last active December 21, 2023 10:08
A bunch of scripts used on the HTCondor cluster
# ========================
# Sets presents...
# tries to source $HOME/.bashrc
# or $HOME2/.bashrc;
# or a fallback
# ========================
# source /data/xchem-fragalysis/shared/bashrc.sh
# universal fixes
@matteoferla
matteoferla / best_template.ipynb
Last active December 12, 2023 09:54
Find the best Fragalysis template retrospectively. Namely, a compound was positioned against a template under an induced fit assumption, whereas for visualisation lock and key is needed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matteoferla
matteoferla / adding_xyz_in_NGL.js
Created December 12, 2023 06:16
Add xyz to origin in NGL.js
// In NGL it may be handy to show an XYZ system axes / caltrop / cube edge
// the following is called via `addAxis(stage)`
const addAxis = (stage) => {
let shape = new NGL.Shape("shape", { dashedCylinder: true })
shape.addArrow([ 0, 0, 0 ], [ 10, 0, 0 ], [ 1, 0, 0 ], 1.0);
shape.addText([ 12, 0, 0 ], [ 1, 0, 0 ], 2.5, "x");
shape.addArrow([ 0, 0, 0 ], [ 0, 10, 0 ], [ 0, 1, 0 ], 1.0);
shape.addText([ 0, 12, 0 ], [ 0, 1, 0 ], 2.5, "y");
shape.addArrow([ 0, 0, 0 ], [ 0, 0, 10 ], [ 0, 0, 1 ], 1.0);
@matteoferla
matteoferla / notes_on_OESpicoli_tests.md
Last active December 4, 2023 16:30
Get void with OpenEye Spicoli

I wanted to get the void volume with OpenEye Spicoli for use in OERocs.

But it did not create a usable surface.

This here is for my reference as I am missing something.

Standard reading:

# -----------------------------------
@matteoferla
matteoferla / test-cset.ipynb
Created November 13, 2023 13:38
Testing cset-uload
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.