Skip to content

Instantly share code, notes, and snippets.

@rmrao
rmrao / auc_extract.ipynb
Created May 8, 2020 21:59
Various ways of extracting info from ipynb
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.
@rmrao
rmrao / smithwaterman_torch.py
Last active October 26, 2021 14:12
Initial implementation of vecorized smithwaterman in torch
from typing import Tuple
import torch
import torch.nn.functional as F
import itertools
from timeit import default_timer as timer
class SoftmaxWeightedMean(torch.autograd.Function):
@staticmethod
@rmrao
rmrao / .pymol_functions.py
Last active January 21, 2026 01:19
My pymol rc script
from pymol import preset, cmd
from glob import glob
from os.path import sep, basename
from pathlib import Path
def bns(sel: str = "bb."):
preset.ball_and_stick(selection=sel, mode=1)
@rmrao
rmrao / countseqs
Created June 12, 2023 21:26
Count the number of sequences or the total number of amino acids in a fasta file
#!/bin/bash
count_nseqs() {
file="$1"
if [ -f "$file" ]; then
if [[ "$file" == *.gz ]]; then
count=$(zcat "$file" | grep -c "^>")
else
count=$(grep -c "^>" "$file")
fi
@rmrao
rmrao / pymol_utils.py
Last active March 24, 2026 16:22
Pymol functions for creating low depth cartoony images and generating color palettes programmatically.
"""
To use these, open PyMOL separately and type:
run <path/to/this_file.py>
Alternatively, place the above command in your ~/.pymolrc file.
"""
import math
# ESMFold2 vs AlphaFold3 antibody/nanobody-antigen docking benchmark
# 106 targets (50 antibody + 56 nanobody), bound complexes from NooriFatima/AF3_AbNb_Benchmark
# (Hitawala & Gray 2024). PDB_short = crystal PDB + Fv-copy index.
PDB_short protein_type n_chains folded_len
7q6c_0 antibody 3 601
7so5_0 antibody 3 970
7t17_0 antibody 3 625
7t7b_0 antibody 3 628
7tow_0 antibody 3 465
7tow_1 antibody 3 472