Skip to content

Instantly share code, notes, and snippets.

View cgoliver's full-sized avatar

Carlos Oliver cgoliver

View GitHub Profile
@cgoliver
cgoliver / sasm.txt
Created November 2, 2023 06:58
SASM BLOSUM-like structure-based substitution matrix (ref: https://doi.org/10.1186/gb-2007-8-3-r31)
A 5 3 2 2 2 -12 -12 -9 -1 -2 0 -8 -7 -7 -7 -5 -4 -6 -6 -3 -5 -3 -4
Y 5 2 3 2 -15 -10 -10 -1 -2 -1 -8 -8 -7 -7 -5 -6 -7 -7 -3 -5 -3 -4
B 5 2 2 -12 -10 -10 1 -2 -2 -7 -7 -6 -6 -5 -4 -6 -5 -2 -5 -3 -4
C 5 1 -11 -9 -9 -1 1 -1 -8 -7 -7 -6 -5 -5 -6 -6 -3 -5 -3 -4
D 5 -10 -9 -9 1 0 1 -6 -5 -5 -5 -4 -1 -4 -4 -1 -4 -2 -3
E 6 1 2 -8 -9 -8 -2 -1 -4 -4 -8 -6 -3 -4 -6 -6 -7 -3
F 6 0 -6 -7 -7 1 -1 -3 -3 -6 -5 -2 -4 -4 -4 -5 -2
H 6 -5 -6 -6 -1 2 -3 -2 -6 -4 0 -3 -4 -2 -4 -2
G 7 0 -1 -4 -4 -3 -3 -3 -1 -2 -1 2 -2 1 -2
I 9 3 -4 -3 -4 -4 -2 2 -3 -3 -1 -2 -1 -2
@cgoliver
cgoliver / DBSCAN.py
Last active December 7, 2022 08:20
Simple implementation of DBSCAN in python with scikit-learn
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import NearestNeighbors
def get_eps_nei(neigh, X, i):
""" Wrap the unnecessary output from sklearn.
Returns the indices of the k nearest neigbhors of a point,
excluding the query point.
"""
e = list(neigh.radius_neighbors(X[i].reshape(1, -1),
from mycsv import *
if __name__ == "__main__":
#creating parser object
#these are default values anyway
#passing them explicitly just to show funcionatity
parser = MyCSV(delimiter=",", header=True)
#parsing test file
data = parser.parse("test.csv")
## Nussinov RNA folding algorithm + recursive backtrack. Implemented by Carlos G. Oliver ##
import numpy as np
min_loop_length = 4
def ss_to_bp(ss):
pairs = []
stack = []
for i, b in enumerate(ss):
"set nocompatible " required
filetype plugin on " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
0x8F31Ac74713f91f0A1b096b2731E925871AEba2E