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
// We need this to build our post string | |
var querystring = require('querystring'); | |
var http = require('http'); | |
var fs = require('fs'); | |
function PostCode(codestring) { | |
// Build the post string from an object | |
var post_data = querystring.stringify({ | |
'compilation_level' : 'ADVANCED_OPTIMIZATIONS', | |
'output_format': 'json', |
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
from random import random, shuffle | |
def monte_carlo(draws, reds, blues): | |
cases = [] | |
for i in xrange(draws): | |
red_draws = [1] * reds | |
blue_draws = [0] * blues | |
total = red_draws + blue_draws | |
shuffle(total) | |
utility = total.pop() + total.pop() # pop two off |
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
oparray = [ \ | |
lambda x, y: False, # FALSE | |
lambda x, y: x and y, # AND | |
lambda x, y: x and (not y), # X AND NOT Y | |
lambda x, y: x, # X | |
lambda x, y: (not x) and y, # NOT X AND Y | |
lambda x, y: y, # Y, | |
lambda x, y: x != y, # XOR | |
lambda x, y: x or y, # OR | |
lambda x, y: not (x or y), # NOR |
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
from math import exp | |
class Edge: | |
def __init__(self, edgetup, weight): | |
self.vertex_out = edgetup[0] | |
self.vertex_in = edgetup[1] | |
self.weight = weight | |
class Unit: | |
def __init__(self, number, input_edges, output_edges): |
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
clear all; close all; | |
A = imread('BrownDischer079.tiff'); | |
A = single(A); | |
scale = max(max(A))/256; | |
A = A/scale; | |
figure(1); | |
co=[0:255]/256; colormap([co;co;co]'); | |
image(A); axis off tight; title('original image'); | |
[x,y] = meshgrid(-25:25); |
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 csv | |
import requests | |
import bs4 as bs | |
def wormbase_url(gene_id): | |
""" | |
Return the correct REST API URL, given the gene ID. | |
""" | |
url = "http://www.wormbase.org/rest/widget/cds/" + gene_id + "/sequences" | |
return url |
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
""" | |
genet - Python screen scraper for the Cystic Fibrosis Mutation Database | |
Installation | |
------------- | |
$ pip install requests pyquery | |
$ python | |
> import genet |
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 genet | |
aa_values = genet.extract_aa_values("Cyto loop1 (56 aa) 139/140-194/195") | |
raw_html = genet.search_by_consequence(aa_values) | |
print genet.parse_result_data(raw_html) |
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
// Module dependencies | |
var express = require('express'), | |
mysql = require('mysql'); | |
// Application initialization | |
var connection = mysql.createConnection({ | |
host : 'localhost', | |
user : 'root', |
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
web: node server.js |
OlderNewer