Skip to content

Instantly share code, notes, and snippets.

@idoan
idoan / kmer_probability.py
Created January 13, 2017 00:59
Computing probabilities of patterns in a string
# method to calculate a k-mer's minimum number of appearance in a dna sequence
# from Bioinformatics Specialization on Coursera.
import operator as op
def ncr(n, r):
r = min(r, n-r)
if r == 0: return 1
numer = reduce(op.mul, xrange(n, n-r, -1))
denom = reduce(op.mul, xrange(1, r+1))
return numer//denom
@idoan
idoan / main_kernel_k_means.py
Last active October 17, 2015 04:13
Main file of Kernel K-Means implementation for DataMining - Clustering class in Coursera with my changes added.
import sys
from LoadData import *
from k_means import *
from evaluation import *
from kernel_k_means import *
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
if __name__ == "__main__":