Skip to content

Instantly share code, notes, and snippets.

View alexpreynolds's full-sized avatar
👋
Hello

Alex Reynolds alexpreynolds

👋
Hello
  • Altius Institute for Biomedical Sciences
  • Seattle, WA USA
View GitHub Profile
>seq0
FQTWEEFSRAAEKLYLADPMKVRVVLKYRHVDGNLCIKVTDDLVCLVYRTDQAQDVKKIEKF
>seq1
KYRTWEEFTRAAEKLYQADPMKVRVVLKYRHCDGNLCIKVTDDVVCLLYRTDQAQDVKKIEKFHSQLMRLME
LKVTDNKECLKFKTDQAQEAKKMEKLNNIFFTLM
>seq2
EEYQTWEEFARAAEKLYLTDPMKVRVVLKYRHCDGNLCMKVTDDAVCLQYKTDQAQDVKKVEKLHGK
>seq3
MYQVWEEFSRAVEKLYLTDPMKVRVVLKYRHCDGNLCIKVTDNSVCLQYKTDQAQDVK
>seq4
@alexpreynolds
alexpreynolds / randomSampleFastaWithoutReplacement.pl
Last active August 29, 2015 13:57
Randomly sample from an ordered FASTA file without replacement, preserving sequence order in output
#!/usr/bin/env perl
use strict;
use warnings;
use List::Util qw(shuffle);
use Fcntl qw(SEEK_CUR);
my $inFn = "example.fa";
my $n = 5;
@alexpreynolds
alexpreynolds / mtx2runall.pl
Created April 29, 2014 22:36
Converts a matrix of set memberships to an Eulergrid runall statement with cardinalities
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use Data::Dumper;
use EulerSet;
#
# sample input:
#
@alexpreynolds
alexpreynolds / example.mtx
Created April 29, 2014 22:39
Example matrix of set memberships to use as input to mtx2runall.pl
A B C
0 1 0
0 1 0
0 1 0
0 1 0
0 0 1
0 1 1
0 1 1
0 1 1
0 1 0
@alexpreynolds
alexpreynolds / EulerSet.pm
Created April 29, 2014 22:40
Perl module (dependency) for mtx2runall.pl
#!/usr/bin/perl
package EulerSet;
sub new {
my $class = shift;
my $self = {
_subsetRef => shift,
_indicator => shift,
_length => shift,
@alexpreynolds
alexpreynolds / candle_test.c
Last active August 29, 2015 14:15
Test of string copying with memcpy()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LETTERS 5
int main(int argc, char *argv[])
{
const char *source = "candle";
char *destination = NULL;
@alexpreynolds
alexpreynolds / fiddlehead.massif.out.30303.transcript.txt
Created February 26, 2015 00:26
debug.sort-bed transcript (fiddlehead test)
[areynolds@fiddlehead src]$ pwd
/home/areynolds/proj/sjn/25Feb2015/src
[areynolds@fiddlehead src]$ ./merge-all-dhs.parallel.debug.tcsh
set hotdir = ../data/hotspots
find -L ../data/hotspots/ -maxdepth 2 -mindepth 2 -type f -name *.gz -print0
parallel -0 -X -m zcat {}
valgrind --tool=massif --pages-as-heap=yes --peak-inaccuracy=0.1 /home/sjn/Github/BEDOPS/bedops/applications/b\
ed/sort-bed/bin/debug.sort-bed --max-mem 1G -
==30303== Massif, a heap profiler
@alexpreynolds
alexpreynolds / type_test.c
Created March 7, 2015 00:04
Test input file's POSIX type
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
struct stat st;
if (stat(argv[1], &st) == -1) {
fprintf(stderr, "Error: stat() failed\n");
@alexpreynolds
alexpreynolds / makeSimpleViewerGallery.pl
Last active August 29, 2015 14:18
Sets up a SimpleViewer-based image gallery
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use File::Basename;
use File::Path;
use File::Copy;
use Getopt::Long;
use IO::File;
@alexpreynolds
alexpreynolds / EqualTestClass.java
Last active August 29, 2015 14:23
Comparison of doubles in Java
package org.stamlab.test;
public class EqualTestClass {
private final static double kEpsilon = 1e-12;
public static boolean isEqual(double a, double b) {
return Math.abs(a - b) < kEpsilon;
}
public static void main(String[] args) {