This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def PowerSet(base): | |
power_set = [] | |
b = len(base) | |
map(lambda g: power_set.append(map(lambda x: base[x], | |
filter(lambda x: g[x], range(0, b)))), | |
map(lambda value: map(lambda x: (value >> x) & 1, range(b - 1, -1, -1)), | |
map(lambda value: value ^ (value / 2), range(0, 2**b)))) | |
return power_set | |
print PowerSet([1,2,3]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
res_val = 19872 | |
approx_list = [] | |
parallel = lambda r1, r2: float(r1 * r2) / float(r1 + r2) | |
for sig in range(0, 4): | |
if len(approx_list) > 0: | |
pass | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sieve of Eratosthenes | |
def GetPrimes(p, i=1): | |
if i**2 < p[-1]: | |
p[i:] = filter(lambda x: x % p[i-1] != 0, p[i:]) | |
return GetPrimes(p, i + 1) | |
return p | |
print GetPrimes(range(2,51)) | |
#[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def PhiFrac(i): # 25 iterations will produce 10 digits of precision | |
if (i >= 0): | |
return 1.0 + (1.0 / phi_frac(i - 1)) | |
return 1.0 | |
def PhiSqrt(i): # 25 iterations will produce 10 digits of precision | |
if (i >= 0): | |
return math.sqrt(1.0 + phi_sqrt(i - 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Compares a list of chromosome regions from one file to a list of probes generated for NimbleGen.""" | |
from optparse import OptionParser | |
import math | |
parser = OptionParser() | |
parser.usage = "%prog file1 file2 [options]" | |
parser.add_option("-r", "--range", type="int", dest="range", metavar="INT", default="200", help="set range tolerance [default: %default]") | |
parser.add_option("-p", "--percentage", action="store_true", help="display percentage of range covered instead of difference") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import math | |
def moveBlank(boardValue, row, col): | |
temp = boardValue[row * 3 + col] | |
boardValue = boardValue.replace('9', ' ') | |
boardValue = boardValue.replace(temp, '9') | |
boardValue = boardValue.replace(' ', temp) | |
return boardValue | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3, re, math, os | |
con = sqlite3.connect(':memory:') | |
db = con.cursor() | |
contigs = [390,389,166,690,6907,6993,2656,3501,6990,1530,7291,7069,7277,7290,6922,7257,7126,1500,7214] | |
# Set filename and open input | |
in_file = open("trimmed.ace", "r") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
x264opts = ["b-adapt=2", | |
"rc-lookahead=50", | |
"ref=6", | |
"bframes=6", | |
"direct=spatial", | |
"b-pyramid=1", | |
"me=umh", | |
"merange=24", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Course: CSC345 | |
* Due Date: 2009-10-07 23:59 | |
* | |
* Purpose: Implement a B-tree as well as a range and fast range function. | |
* | |
* Not Implemented: I was only able to implement insert and in order traversal. | |
*/ | |
import java.util.Arrays; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedList; | |
import java.util.Queue; | |
import java.util.SortedMap; | |
import java.util.TreeMap; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.IOException; |
OlderNewer