Skip to content

Instantly share code, notes, and snippets.

View danielecook's full-sized avatar
😀
Things are going good

Daniel E Cook danielecook

😀
Things are going good
View GitHub Profile
@danielecook
danielecook / terminal_genes.sh
Created May 24, 2015 02:27
Fetch terminal genes C. elegans
end_dist=30000
chrom_I=15072434
chrom_II=15279421
chrom_III=13783801
chrom_IV=17493829
chrom_V=20924180
chrom_X=17718942
@avrilcoghlan
avrilcoghlan / find_closest_worm_paralogs4.pl
Created March 1, 2013 13:52
Perl script that, given a file of Caenorhabditis elegans paralog pairs, finds the bootstrap value for the clade defined by the last common ancestor of the two paralogs.
#!/usr/local/bin/perl
#
#
# Perl script find_closest_worm_paralogs4.pl
# Written by Avril Coghlan (alc@sanger.ac.uk)
# 16-Feb-09.
#
# This perl script finds the bootstrap value for the
# clade containing a pair of C. elegans paralogs in a family (where
# there is no other gene in that clade, ie. they are each other's
@danielecook
danielecook / plot_runkeeper.R
Last active January 16, 2017 17:47
This R Script will plot all of your runkeeper data. It uses cluster analysis to group activities by location as needed, and outputs a graph for each location. For example - I have run in Iowa City, Boston, and Chicago - and this script is able to identify those locations and output separately.
# Special thanks for insights from flowingdata.com regarding this.
library(plotKML)
library(plyr)
library(dplyr)
library(fpc)
num_locations <- 5
# Usage: Place this script in the directory containing your runkeeper data. You can run from terminal using 'Rscript map_runkeeper.R', or
@danielecook
danielecook / setup.sh
Last active April 12, 2019 08:31
Setup mac to be more like linux
# https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
brew install coreutils
brew install binutils
brew install diffutils
brew install ed --with-default-names
brew install findutils --with-default-names
brew install gawk
brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
@brentp
brentp / fastq-unique.py
Created October 22, 2010 16:01
filter a fastq to unique reads
"""
Reads a FastQ file from stdin and writes a file with unique records to sdout
usage:
%s < in.fastq > out.unique.fastq
see: http://hackmap.blogspot.com/2010/10/bloom-filter-ing-repeated-reads.html
"""
from bloomfaster import Elf
import collections
import sys
@christophergandrud
christophergandrud / source_GitHubData.R
Last active March 31, 2020 04:58
A function for downloading data stored on GitHub in a plain-text format (e.g. CSV, TSV) into R. The function loads the data as a data frame. For more details see: http://christophergandrud.blogspot.com/2013/01/sourcegithubdata-simple-function-for.html.
#####################
# R function for downloading plain-text data from GitHub
# Christopher Gandrud
# 7 January 2013
#####################
# source_GitHubData is directly based on source_url from the Hadley Wickham's devtools package
source_GitHubData <-function(url, sep = ",", header = TRUE)
{
@danielecook
danielecook / row_iterator.R
Last active April 19, 2020 15:02
R row iterator
rows <- function(tab, idx=TRUE) {
# Set idx to attach an index column
if (is.na(tab) || is.null(tab) || nrow(tab) == 0) {
return(list())
}
lapply(seq_len(nrow(tab)),
function(i) {
row <- unclass(tab[i,,drop=F])
if (idx) {
row$idx <- i
@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@itdaniher
itdaniher / rle.py
Last active October 23, 2021 11:26
Run Length Encoding, Two Ways
import numpy as np
import itertools
def rle(x):
where = np.flatnonzero
x = np.asarray(x)
n = len(x)
if n == 0:
return np.array([], dtype=int)
starts = np.r_[0, where(~np.isclose(x[1:], x[:-1], equal_nan=True)) + 1]
@danielecook
danielecook / bash-cheatsheet.sh
Created November 22, 2019 09:50 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04