Skip to content

Instantly share code, notes, and snippets.

View rob-p's full-sized avatar
🎯
Focusing

Rob Patro rob-p

🎯
Focusing
View GitHub Profile
from math import *
# function [alpha, xmin, L]=plfit(x, varargin)
# PLFIT fits a power-law distributional model to data.
# Source: http://www.santafe.edu/~aaronc/powerlaws/
#
# PLFIT(x) estimates x_min and alpha according to the goodness-of-fit
# based method described in Clauset, Shalizi, Newman (2007). x is a
# vector of observations of some quantity to which we wish to fit the
# power-law distribution p(x) ~ x^-alpha for x >= xmin.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rob-p
rob-p / upload_to_zenodo.py
Created September 24, 2017 23:06
Upload a local file to a zenodo deposition
import requests
import argparse
import pprint
import os
def do_upload(args):
ACCESS_TOKEN = args.token
depid = args.deposition_id
url = 'https://zenodo.org/api/deposit/depositions/{}'.format(depid)
r = requests.get(url, params={'access_token': ACCESS_TOKEN})
@rob-p
rob-p / glef.py
Created July 22, 2016 17:41
Compute gene level effective lengths
import argparse
import pandas as pd
import numpy as np
import sys
def main(args):
gtable = pd.read_table(args.ginput).set_index('Name')
ttable = pd.read_table(args.tinput).set_index('Name')
tgmap = pd.read_table(args.tgmap, names=['t', 'g']).set_index('t')
gene_lengths = {}
@rob-p
rob-p / compile_sailfish.sh
Created January 20, 2016 19:10
Holy Build Box script to compile Sailfish
#!/bin/bash
set -e
# Activate Holy Build Box environment.
source /hbb_exe/activate
set -x
# Install things we need
yum install -y --quiet wget
@rob-p
rob-p / EffLengths.py
Created January 19, 2016 21:10
Compute effective lengths for Flux Simulator simulation
def effLen(L, pmf, meanLen):
if L < meanLen:
return L
minVal = 0
maxVal = len(pmf)-1
mval = maxVal
clen = minVal
maxLen = min(L, mval)
effectiveLength = 0
while (clen <= maxLen):
@rob-p
rob-p / runner.sh
Last active January 4, 2016 21:49
Interleaved Salmon Runner
#!/bin/bash
cmd="$@"
interleaved_file=`echo $cmd | sed -n 's/.*--interleaved\s\+\(\S\+\)\s\+.*/\1/p'`
if [ -z "$interleaved_file" ]
then
#Run normally in this branch
${@}
else

Keybase proof

I hereby claim:

  • I am rob-p on github.
  • I am rob_p (https://keybase.io/rob_p) on keybase.
  • I have a public key whose fingerprint is C7B0 CCB0 FCB8 E9C3 DFB8 A9BF 2EAB 9D25 7707 B487

To claim this, I am signing this object:

@rob-p
rob-p / ZhaoFig9
Last active November 17, 2015 03:19
Zhao et al. Figure 9 analysis
{
"cells": [
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
seqtk mergepe ${leftIn} ${rightIn} | pv -r -b | paste - - - - - - - - | shuf | tr "\t" "\n" | tee >(seqtk seq -1 - > ${outBase}_1.fastq) | seqtk seq -2 - > ${outBase}_2.fastq