Skip to content

Instantly share code, notes, and snippets.

View morungos's full-sized avatar

Stuart Watt morungos

View GitHub Profile
@morungos
morungos / dcc_to_vcf.pl
Last active December 27, 2015 02:39
Quick script to convert DCC output data to VCF. It's a bit grubby to say the least (only uses core dependencies) and only handles SNPs.
#!/usr/bin/env perl -w
use strict;
use warnings;
# Basic script to convert DCC output for SNPs to a VCF file capable of being
# used for later analysis. More complex variants won't yet work, due to the need
# for reference genome information which we don't get from the DCC output yet.
#
# Written to use minimal Perl dependencies.
@morungos
morungos / server.js
Created October 3, 2013 17:38
Naive server for node.js, handling static files for testing JS sites that won't work from files
var express = require('express');
var app = module.exports.app = express();
function logErrors(err, req, res, next) {
console.error(err.stack);
next(err);
}
function clientErrorHandler(err, req, res, next) {
@morungos
morungos / mptt.pl
Created September 18, 2013 16:57
Example code for MongoDB setting left and right values for modified preorder tree traversal. Problem and data are from here: http://www.sitepoint.com/hierarchical-data-database-2/
#!/usr/bin/perl -w
=data
db.data.drop();
db.data.insert({_id: "Food"});
db.data.insert({_id: "Fruit", parent: "Food"});
db.data.insert({_id: "Red", parent: "Fruit"});
db.data.insert({_id: "Cherry", parent: "Red"});
db.data.insert({_id: "Yellow", parent: "Fruit"});
db.data.insert({_id: "Banana", parent: "Yellow"});
@morungos
morungos / dump.pl
Created July 12, 2013 16:54
Simple script to fairly safely dump a MySQL database to a bunch of tab files, with accompanying SQL definitions. It's not designed as a reliable backup, but as a way of archiving very large databases for processing by other tools.
#!/usr/bin/perl -w
use strict;
use Carp;
use DBI;
use File::Spec;
use File::Path qw(make_path);
use Getopt::Long;
my ($verbose, $username, $password, $hostname, $tabs);