Skip to content

Instantly share code, notes, and snippets.

View jandot's full-sized avatar

Jan Aerts jandot

View GitHub Profile
require 'open-uri'
require 'json'
require 'mongo'
class FriendFeed
attr_accessor :user, :database, :collection
def initialize(user, database, collection)
@user = user
@database = XGen::Mongo::Driver::Mongo.new.db(database)
@jandot
jandot / get_aa.rb
Created February 3, 2010 16:15
Getting the wt/mutant AA based on genomic SNP position
require 'rubygems'
require '/nfs/team29/ruby-ensembl-api/lib/ensembl'
codon_table = Bio::CodonTable[1]
include Ensembl::Core
DBConnection.connect('homo_sapiens', 52)
STDIN.each do |line|
gene_name, transcript_acc, chr, pos, ref, alleles = line.chomp.split(/\t/)
@jandot
jandot / mongodb_index_and_exists.js
Created February 23, 2010 16:09
mongodb index and exists
// Suppose we have a collection "my_coll" with documents that look like this (we're talking about things that have positions on chromosomes):
// { _id: "1_123",
// chr: "1",
// pos: 123,
// accession_in_external_db: "an_id"
// },
// { _id: "1_456",
// chr: "1",
// pos: 456
// },
@jandot
jandot / ps1_git_coloured.rb
Created April 19, 2010 15:36
Add git branch to bash prompt. Green if OK; red if uncommitted changes or if ahead of master.
#Based on http://www.furmanek.net/39/unix-prompt-for-usage-with-git/
green = "\033[0;32m"
reset = "\033[0m"
red = "\033[0;31m"
current_branch = `git branch 2>/dev/null`.grep(/^\*/).first
if current_branch
branch_name = current_branch.gsub(/^\*\s*/,'').strip
status_lines = `git status`.split(/\n/)
status = ( status_lines.length == 2 ) ? 'clean' : 'dirty'
@jandot
jandot / _.md
Created July 29, 2013 19:24
tributary-bozar
@jandot
jandot / _.md
Created July 30, 2013 17:00
sv-graph
@jandot
jandot / _.md
Created August 3, 2013 06:42
stacked-barchart
@jandot
jandot / _.md
Created August 6, 2013 14:37
drag
@jandot
jandot / _.md
Created August 6, 2013 18:23
dnart3d
@jandot
jandot / _.md
Created August 7, 2013 07:07
crossfilter example