Skip to content

Instantly share code, notes, and snippets.


Matt Ralston MatthewRalston

View GitHub Profile
MatthewRalston / Random_subsample.xml
Last active Aug 29, 2015
Galaxy tool for subsampling a fastq file.
View Random_subsample.xml
<tool name="Random Subsample" id="subsample_fastq" version="0.0.1">
<description>Subsamples a fastq file</description>
RandomSubFq -w $readsRequested
-i $paired_fastq_files.forward
-i $paired_fastq_files.reverse
-o $paired_list_output.forward
-o $paired_list_output.reverse
MatthewRalston / summarize_fastqc.xml
Created Jul 15, 2015
Galaxy tool for summarizing fastqc information
View summarize_fastqc.xml
<tool name="Summarize FastQC" id="summarizeFastQCMetrics" version="0.0.1">
<description>summarizes data from FastQC</description>
#def pairfunc($theList)
#set $left = []
#set $right = []
#for $file1, $file2 in $theList
MatthewRalston / log.conf
Created Oct 28, 2015
Python logging: configuration file and root_logger setup.
View log.conf
import logging
import logging.config
def get_root_logger(loglevel, logfile=None, log_config="log.conf"):
# Requires 'import logging' and 'import logging.config'
def log_level(loglevel):
case = {"DEBUG": logging.DEBUG,
"INFO": logging.INFO,
MatthewRalston / example.rb
Created Nov 16, 2015
log4r YAML configuration
View example.rb
require 'log4r'
require 'log4r/yamlconfigurator'
include Log4r
ycfg = YamlConfigurator
ycfg["LOGFILE"] = "/home/matt/logs/myapp.log"
root_logger = Logger['root_logger']
MatthewRalston / Autogen.log
Created Nov 24, 2015
Slurm-drmaa compilation logs
View Autogen.log
checking for aclocal... yes
checking for autoheader... yes
checking for autoconf... yes
checking for libtoolize... yes
checking for automake... yes
running aclocal -I m4 (/opt/slurm-drmaa-slurm-drmaa-1.2.0-clusters)
running libtoolize --automake --copy --force (/opt/slurm-drmaa-slurm-drmaa-1.2.0-clusters)
running autoheader --warnings=all (/opt/slurm-drmaa-slurm-drmaa-1.2.0-clusters)
running automake --foreign --add-missing --copy --warnings=all (/opt/slurm-drmaa-slurm-drmaa-1.2.0-clusters)
MatthewRalston / fancy_scientific.R
Created Mar 21, 2016
Scientific notation (5x10^5)
View fancy_scientific.R
fancy_scientific <- function(l) {
# turn in to character string in scientific notation
l <- format(l, scientific = TRUE)
# quote the part before the exponent to keep all the digits
l <- gsub("^(.*)e", "'\\1'e", l)
# turn the 'e+' into plotmath format
l <- gsub("e", "%*%10^", l)
# return this as an expression
When you want to match files that only differ by one character: sample_1.fastq.gz sample_2.fastq.gz
def is_hamming_match(seq1, seq2):
if len(seq1) == len(seq2): # The sequences must be of equal length
zipped = zip(seq1, seq2)
is_mismatch = list([c1 != c2 for c1, c2 in zipped])
if sum(is_mismatch) == 1: # The sequences must have only one mismatch
mismatches = list([[c1, c2] for c1, c2 in zipped if c1 != c2])
if mismatches[0] == ['1', '2'] or mismatches[0] == ['2', '1']: # The mismatch must only be the numbers 1 and 2
MatthewRalston /
Created May 5, 2016 — forked from gbuesing/
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby


View Hello.rb
partner =
def my_most_sincere_apology
"I'm sorry for everything that I've done. But when I call you never seem to be home."
1000.times do |t|
catch e:
MatthewRalston /
Created Apr 7, 2017 — forked from naholyr/
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)