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
/* | |
* I updated to Ubiquity 0.5 but found that broke | |
* Julien Couvreur's set-proxy command: | |
* http://blog.monstuff.com/archives/000342.html. | |
* So here is a re-write for the new parser. | |
*/ | |
CmdUtils.CreateCommand({ | |
names: ["set proxy", "proxy", "setproxy"], | |
description: "Switch you proxy without going through the preferences menu", |
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
/* | |
* This is a command to use the very cool NameLink API provided by the | |
* Encyclopedia of Life for adding links to biodiversity databases for | |
* any taxonomic names in a webpage: | |
* http://hickory.eol.org:8081/display/public/NameLink+Documentation | |
*/ | |
CmdUtils.CreateCommand({ | |
names: ["taxonomise", "taxonomy", "tax-links"], | |
icon: "http://www.gbif.org/favicon.ico", |
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
# -*- coding: utf-8 -*- | |
import random | |
class Lineage: | |
""" Model one independantly evolving lineage """ | |
def __init__(self, complexity= 0, min = None): | |
self.complexity = complexity | |
self.min = min | |
def __repr__(self): |
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
class ORFFinder: | |
"""Find the longest ORF in a given sequence | |
"seq" is a string, if "start" is not provided any codon can be the start of | |
and ORF. If muliple ORFs have the longest length the first one encountered | |
is printed | |
""" | |
def __init__(self, seq, start=[], stop=["TAG", "TAA", "TGA"]): | |
self.seq = seq | |
self.start = start |
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
# -*- coding: utf-8 -*- | |
import random | |
def round(switch=True): | |
doors = ['car', 'goat', 'goat'] | |
pick = random.randrange(3) | |
print "the RNG picked door %s" % (pick + 1) | |
#monty knows where the car is | |
car = doors.index('car') | |
#and he opens a door without the car |
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
""" | |
Code writted to answer this challenge at Biostar: | |
http://biostar.stackexchange.com/questions/5902/ | |
(This code includes improvements from Brad Chapman) | |
""" | |
class ORFFinder: | |
"""Find the longest ORF in a given sequence | |
"seq" is a string, if "start" is not provided any codon can be the start of |
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
""" | |
Code written to answer stackoverflow question on substitution matrices: | |
http://stackoverflow.com/questions/5686211/ | |
""" | |
from Bio.SubsMat import MatrixInfo | |
def score_match(pair, matrix): | |
""" | |
Return score for a given pair of residues in a give matrix. |
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 numpy as np | |
from scipy import cluster | |
from matplotlib import pyplot | |
#fake some data | |
tests = np.reshape( np.random.uniform(0,100,60), (30,2) ) | |
#plot remaining variance for each value for 'k' between 1,10 | |
initial = [cluster.vq.kmeans(tests,i) for i in range(1,10)] | |
pyplot.plot([var for (cent,var) in initial]) |
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 Bio import Entrez | |
#Let NCBI know who you are in case you do something stupid :) | |
Entrez.email = '[email protected]' | |
search_s ='"ectomycorrhizal root tip" AND "New Zealand"' | |
handle = Entrez.esearch(db='nucleotide', term=search_s, retmax=100) | |
ids = Entrez.read(handle)['IdList'] | |
ids[:5] |
OlderNewer