Skip to content

Instantly share code, notes, and snippets.

View neilfws's full-sized avatar

Neil Saunders neilfws

View GitHub Profile
@neilfws
neilfws / gist:1dff7fceb641dba374db
Last active August 29, 2015 14:06
BioStars 111791
gse <- getGEO("GSE45016") # you want GSEMatrix = TRUE
# ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE45nnn/GSE45016/matrix/
# Found 1 file(s)
# GSE45016_series_matrix.txt.gz
# trying URL 'ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE45nnn/GSE45016/matrix/GSE45016_series_matrix.txt.gz'
# ftp data connection made, file length 1486394 bytes
# opened URL
# ==================================================
# downloaded 1.4 Mb
@neilfws
neilfws / bioruby-pubmed-demo
Created August 10, 2009 03:17
Search PubMed using esearch, return results as BibTeX
#!/usr/bin/ruby
# save as pubmed.rb and test using 'ruby pubmed.rb 19662644'
# keyword search may return > 1 record due to retmax bug
# http://github.com/bioruby/bioruby/commit/51c3223e033b2992a7bd95da282f88164406ff92
require 'rubygems'
require 'bio'
keywords = ARGV.join(' ')
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)
@neilfws
neilfws / mongodb.rake
Created August 14, 2009 03:15
Start/stop mongod for a Rails app.
# mongodb.rake for Rails
# assumes that mongodb installed in Rails.root/lib/mongodb
namespace :db do
namespace :mongo do
# start db server
task :start do
pr = get_pids
if pr.length == 0
@neilfws
neilfws / gdsinfo.rb
Created September 1, 2009 03:16
Fetch field names and descriptions from NCBI GEO database
#!/usr/bin/ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
doc = Hpricot(open("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi?db=gds"))
(doc/'//fieldlist/field').each do |f|
puts "#{(f/'/name').inner_html},#{(f/'/fullname').inner_html},#{(f/'description').inner_html}"
@neilfws
neilfws / friendfeed2mongodb.rb
Created January 6, 2010 11:59
Archive a FriendFeed feed in MongoDB
namespace :db do
require "mongo"
require "json/pure"
require "open-uri"
feed = ENV['feed']
db = Mongo::Connection.new.db('friendfeed')
col = db.collection('entries')
desc "Seed database with feed entries"
# install GEOmetadb
source("http://bioconductor.org/biocLite.R")
biocLite("GEOmetadb")
library(GEOmetadb)
# connect to database
getSQLiteFile()
con <- dbConnect(SQLite(), "GEOmetadb.sqlite")
# count samples per GDS
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@neilfws
neilfws / Delayed::Job daemon script for delayed_job
Created January 31, 2010 14:52 — forked from lukeredpath/Delayed::Job daemon script for delayed_job
Daemon script with minor alteration to use Navvy instead of delayed_job
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
daemon_options = {
:multiple => false,
:dir_mode => :normal,
:dir => File.join(dir, 'tmp', 'pids'),
:backtrace => true
@neilfws
neilfws / boson-pubmed.txt
Created February 22, 2010 22:59
boson/pubmed issue
sau103@gymea-nh:~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
sau103@gymea-nh:~$ boson -hv
boson [GLOBAL OPTIONS] [COMMAND] [ARGS] [COMMAND OPTIONS]
GLOBAL OPTIONS
+-------------------+-------+---------+-------------------------------------------------------------------+------------------+
| Name | Alias | Type | Desc | Values |
+-------------------+-------+---------+-------------------------------------------------------------------+------------------+