This file contains hidden or 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
require 'open-uri' | |
require 'rubygems' | |
require 'hpricot' | |
ARGV.each do |gi| | |
# Fetch the URL and pass the contents to Hpricot | |
url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=#{gi}&rettype=fasta&retmode=xml" | |
doc = Hpricot.XML(open(url).read) | |
This file contains hidden or 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
library(reshape) | |
library(lattice) | |
# | |
# Categorical example | |
# | |
data1 <- read.csv(file="plots/categorical.csv") | |
# Reshape the data into long format |
This file contains hidden or 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
# Prompt with just directory basename | |
PS1="\W $ " | |
# Colourise ls output an sort by size | |
alias ls='ls -l -G -t' |
This file contains hidden or 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
desc 'Loads all the alignment codon data' | |
task :load_alignment_codons => :clear_alignment_codons do | |
starfish = %x|which starfish|.strip | |
loader = PROJECT_ROOT + '/model/starfish/load_alignment_codons.rb' | |
p = lambda{ system( "qsub -cwd -j y -V #{starfish} #{loader}") } | |
p.call | |
sleep(120) | |
16.times { p.call } | |
end |
This file contains hidden or 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
Task: Blast | |
Run BLAST | |
Using the protein sequence for YDL177C | |
On uniprot | |
Return all hits with e < 0.00001 |
This file contains hidden or 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
BLAST protein YDL177C | |
BLAST dna YDL177C |
This file contains hidden or 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
# Given the location of an SQL query file, this method will | |
# execute the query on the database, and print each line to | |
# the supplied target file. | |
# This method relies on the MySQL adapter for the fetch_fields | |
# method, but should not suffer in performance from pulling | |
# large amounts of data into memory. | |
public | |
def export_csv_from_sql(sql_file,target_file) |
This file contains hidden or 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
# Example activerecord interator based on using an indexed 'id' column. | |
# See http://schuerig.de/michael/blog/index.php/2007/02/03/ar-enumerable/ | |
# and http://weblog.jamisbuck.org/2007/4/6/faking-cursors-in-activerecord | |
class << ActiveRecord::Base | |
def each(chunk_size=1000) | |
(0..self.last.id / chunk_size).each do |offset| | |
self.find(:all, | |
:limit => chunk_size, | |
:conditions => ["id > ?", offset * chunk_size]).each do |i| |
This file contains hidden or 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
require 'fileutils' | |
require 'find' | |
class Latex < Thor | |
desc "build","builds thesis document" | |
method_options :src => 'src', | |
:dest => 'out', | |
:tmp => 'tmp' | |
def build(file) |
This file contains hidden or 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
- Example where | |
- cost of alanine is being considered | |
- in glucose limitation | |
- at biomass flux of 0.5 | |
- Set all exchange fluxes to have a lower bound of -10000. | |
- Effectively unlimited nutrients with respect to biomass flux | |
- Set biomass flux reaction rate to have upper and lower bounds of 0.05 | |
OlderNewer