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
@alexpreynolds
alexpreynolds / plotEulergrid.R
Last active December 17, 2015 01:49
plotEulergrid.R
plotEulergrid <- function (plotTitle, offCellColor, onCellColor, setNames, setCardinalities, setTotal, setTotalWithout, outputFilename, showWholeSets, ctsCardinalities)
{
library(grDevices)
library(gplots)
showWholeSets <- as.numeric(showWholeSets)
if (showWholeSets == 1) wholeColors <- c("red", "green", "blue", "darkgoldenrod2", "purple", "grey50", "gold3")
setTotal <- as.numeric(setTotal)
unadjSetTotal <- setTotal
@alexpreynolds
alexpreynolds / eulergrid.pl
Last active December 17, 2015 02:29
eulergrid.pl is a wrapper script to call plotEulergrid.R
#!/usr/bin/env perl
use warnings;
use strict;
use Getopt::Long;
# -------------------------------------------------------------------------------------------
# options
my ($plotTitle, $offCellColor, $onCellColor, $setNames, $setCardinalities, $setTotal, $setTotalWithout, $outputFilename, $showWholeSets, $rGraphScript, $ctsCounts);
@alexpreynolds
alexpreynolds / hg19.gaps.bed
Created July 31, 2013 22:58
Unmappable hg19 regions via UCSC browser search
chr1 0 10000
chr1 177417 227417
chr1 267719 317719
chr1 471368 521368
chr1 2634220 2684220
chr1 3845268 3995268
chr1 13052998 13102998
chr1 13219912 13319912
chr1 13557162 13607162
chr1 17125658 17175658
@alexpreynolds
alexpreynolds / hg19.extents.bed
Created July 31, 2013 23:01
Sorted chromosome extents for hg19 via UCSC genome browser search
chr1 0 249250621
chr10 0 135534747
chr11 0 135006516
chr12 0 133851895
chr13 0 115169878
chr14 0 107349540
chr15 0 102531392
chr16 0 90354753
chr17 0 81195210
chr18 0 78077248
@alexpreynolds
alexpreynolds / first_fit.py
Last active December 20, 2015 11:59
First-fit bin packing for gapped genomic data
#!/usr/bin/env python
''' Using first-fit bin packing algorithm implementation from: https://bitbucket.org/kent37/python-tutor-samples/src/f657aeba5328/BinPacking.py '''
class Bin(object):
def __init__(self):
self.elements = []
self.size = 0
self.index = 0
@alexpreynolds
alexpreynolds / hg19.gapped_extents.bed
Created July 31, 2013 23:06
Chromosome extents for hg19 with unmappable regions removed via BEDOPS partition and difference operations
chr1 10000 177417 167417
chr1 227417 267719 40302
chr1 317719 471368 153649
chr1 521368 2634220 2112852
chr1 2684220 3845268 1161048
chr1 3995268 13052998 9057730
chr1 13102998 13219912 116914
chr1 13319912 13557162 237250
chr1 13607162 17125658 3518496
chr1 17175658 29878082 12702424
@alexpreynolds
alexpreynolds / index.html
Created October 29, 2013 20:51
Effect of adding tickSize() to d3 axis
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Demo: Axes</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
.axis path,
.axis line {
@alexpreynolds
alexpreynolds / consolidate.py
Last active August 29, 2015 13:56
Consolidating genomic elements by ID relationship
#!/usr/bin/env python
import sys, copy
def sampleInput():
return '''gain_765 chr15 9681969 9685418 chr15 9660912 9712719 loss_1136
gain_766 chr15 9706682 9852347 chr15 9660912 9712719 loss_1136
gain_766 chr15 9706682 9852347 chr15 9765125 9863990 loss_765
gain_780 chr20 9706682 9852347 chr20 9765125 9863990 loss_769
gain_760 chr15 9706682 9852347 chr15 9660912 9712719 loss_1137
@alexpreynolds
alexpreynolds / seqIdTest.mtx
Last active August 29, 2015 13:57
Example sequence identifier adjacency matrix
410488935 410488927 410488931 410488939 410488937 410488923 410488933
410488935 0.0000
410488927 0.0065 0.0000
410488931 0.0098 0.0098 0.0000
410488939 0.0850 0.0850 0.0784 0.0000
410488937 0.0817 0.0817 0.0752 0.0033 0.0000
410488923 0.0817 0.0817 0.0752 0.0033 0.0065 0.0000
410488933 0.1340 0.1340 0.1275 0.1340 0.1307 0.1307 0.0000
@alexpreynolds
alexpreynolds / minSeqIdLister.py
Last active August 29, 2015 13:57
Output the minimum value in an adjacency matrix, along with a list of row and column IDs for that minimum value
#!/usr/bin/env python
import sys
fn = sys.stdin
ids = list()
vd = dict()
rowIdx = -1