Skip to content

Instantly share code, notes, and snippets.

@sczizzo
sczizzo / analyze_separations_and_pka.py
Created March 15, 2013 03:23
Examine the relationship between the sidechain separation and local pKa
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
from __future__ import print_function
from marshal import dump, load
from random import sample
from glob import glob
from pdb import *
import subprocess as sub
import sys
@sczizzo
sczizzo / analyze_ph.py
Created March 15, 2013 03:19
In-depth analysis of the sidechain separation distance in a set of PDB files separated by pH
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
from marshal import dump, load
from random import sample
from glob import glob
from pdb import *
import subprocess as sub
import sys
import re
@sczizzo
sczizzo / analyze_neighboring_residues.py
Created March 15, 2013 03:12
Analyze the neighborhood around special residues in a set of PDB files
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
from marshal import dump, load
from random import sample
from glob import glob
from pdb import *
import sys
@sczizzo
sczizzo / analyze_peaks.py
Created March 15, 2013 02:59
In-depth analysis of the sidechain separation distance in a set of PDB files
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from marshal import dump, load
from random import sample
from glob import glob
from pdb import *
import sys
@sczizzo
sczizzo / analyze_separations_and_volumes.py
Created March 15, 2013 02:47
Analyze sidechain separation and volume in PDB files
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from marshal import dump, load
from random import sample
from glob import glob
from pdb import *
import sys
def run_experiment(residues, interests, ss_code=None, mind=0.0, maxd=100.0):
@sczizzo
sczizzo / pdb.py
Created March 13, 2013 23:07
Ugly PDB processing utilities for Python
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
import numpy as np
import math
def flatten(l):
out = []
for item in l:
if isinstance(item, (list, tuple)):
@sczizzo
sczizzo / lbm2gif_almost.rb
Created January 15, 2013 05:39
Convert a gzipped LBM file into a GIF animation (not totally working...)
#!/usr/bin/env ruby
#
# Offset | Length | Description
# ========================================
# 0 | 1 | minor width offset
# 1 | 1 | major width offset
# 2 | 1 | minor height offset
# 3 | 1 | major height offset
# 4 | 768 | 256-color pallet
# 772 | 1 | number of cycles (N)
@sczizzo
sczizzo / lbm2gif_simple.rb
Created January 15, 2013 03:14
Convert a gzipped LBM file into a simple GIF without animation
#!/usr/bin/env ruby
#
# Offset | Length | Description
# ========================================
# 0 | 1 | minor width offset
# 1 | 1 | major width offset
# 2 | 1 | minor height offset
# 3 | 1 | major height offset
# 4 | 768 | 256-color pallet
# 772 | 1 | number of cycles (N)
@sczizzo
sczizzo / practice2.rb
Created January 3, 2013 08:43
More practice
#!/usr/bin/env ruby -w
# ✓ FizzBuzz
# ✓ Fibonacci
# ✓ Bubblesort
# ✓ Mergesort
# ✓ Search Tree
# ✓ Rotated minimum
# ✓ Prime factorization
def fizz_buzz n
@sczizzo
sczizzo / LL.hs
Created December 25, 2012 01:22
Linked List Exercise
-- Linked List
data LL a = Empty | Cons a (LL a)
instance (Show a) => Show (LL a) where
show Empty = "[]"
show (Cons a l) = (show a) ++ ":" ++ (show l)
nth :: LL a -> Int -> a
nth (Cons a _) 0 = a