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
@rob-p
rob-p / WeightedConfigSampler.py
Created December 18, 2012 02:44 — forked from anonymous/WeightedConfigSampler.py
Tabs => spaces (where did tabs come from?)
import networkx as nx
import random
import copy
def isValidPair(G, Gp):
'''
This function checks if the weighted, undirected graphs G and Gp
constitute a valid pair.
G and Gp constitute a valid pair if, for every vertex u in G and Gp,
the multiset of weights for u is the same in both graphs.
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <thread>
#include <atomic>
#include <iostream>
#include "unistd.h"
#include "fcntl.h"
extern "C" {
#include "kseq.h"
@rob-p
rob-p / gist:4e1285ac94456a46e3ce
Last active August 29, 2015 14:21
Updated Quant. Analysis IPython Notebook
{
"metadata": {
"name": "",
"signature": "sha256:a6e570cf0bd55a345c51e9845a0be441853a5108bc5ac8bec032e8c0b89b057d"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
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
@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": [

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 / 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
@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 / 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 / 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 = {}