Skip to content

Instantly share code, notes, and snippets.

@jfear
jfear / run_rail_parallel.py
Created April 21, 2016 19:50
starting point for wrapping rail-rna
#!/usr/bin/env python
import os
import sys
import subprocess
import time
import logging
import ipyparallel
TEMPLATE="""#!/bin/sh
@jfear
jfear / emr_simulator.patch
Created April 21, 2016 19:57
patch of rail-rna to avoid race condition
1064,1068d1063
< retries = 0
< while not os.path.isfile(file_or_archive):
< time.sleep(5)
< if retries > 5: break
< retries += 1
1426,1430d1420
< retries = 0
< while not os.path.isfile(file_or_archive):
< time.sleep(5)
c = get_config()
### If you want to auto-save .html and .py versions of your notebook:
# modified from: https://github.com/ipython/ipython/issues/8009
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py scripts"""
if model['type'] != 'notebook':
return # only do this for notebooks
@jfear
jfear / download_sra_xsd.sh
Created June 23, 2016 21:32
Download SRA XSDs for use with biopython
#!/bin/bash
# Trying to get biopython to parse SRA xml output. I think I need these XSDs produced by SRA to do this.
if [ ! -e ~/.biopython/Bio/Entrez/XSDs ]; then mkdir -p ~/.biopython/Bio/Entrez/XSDs; fi
cd ~/.biopython/Bio/Entrez/XSDs
wget -O SRA.common.xsd "http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-5/SRA.common.xsd?view=co"
wget -O SRA.submission.xsd "http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-5/SRA.submission.xsd?view=co"
wget -O SRA.study.xsd "http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-5/SRA.study.xsd?view=co"
wget -O SRA.sample.xsd "http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-5/SRA.sample.xsd?view=co"
@jfear
jfear / reference-markdown-metadata-from-jinja-template.py
Created July 27, 2016 21:02 — forked from glombard/reference-markdown-metadata-from-jinja-template.py
How to use Markdown as a filter in a Jinja2 template, and then extract the Markdown Meta property directly from the template. Assuming you want to use the Meta-data value before rendering the converted Markdown content (e.g. in the html head), the trick is to render the markdown first, save it to a variable (html_content in this example) using a…
from pprint import pprint
import jinja2
import markdown
HTML_TEMPLATE = """{% macro get_html() %}
{{ content | markdown }}
{% endmacro %}
{% set html_content = get_html() %}
Title from Markdown meta-data: {{ get_title() }}
@jfear
jfear / workflowy.css
Created January 26, 2017 22:36
workflowy dark simple
@namespace url(http://www.w3.org/1999/xhtml);
/* minimal page background */
#pageContainer {
margin-top: 24px;
}
.page {
max-width: 100% !important;
border: none !important;
margin-bottom: 0 !important;
/* fix for dynamic positioning of the .page div */
channels:
- jfear
dependencies:
- sratoolkit==2.8.1
@jfear
jfear / test_minimal.snake
Last active February 21, 2017 22:44
Minimal test file for conda error
#/usr/bin/env python
import os
from lcdblib.snakemake import helpers
from lcdblib.utils import utils
URI = '../lcdb-wrapper-tests'
TMPDIR='/mnt/threeTB/centos_scratch'
references = {
'dmel': {
@jfear
jfear / Vagrantfile
Last active May 16, 2017 21:54
A vagrant file for building a VM for running isoseq v4.0 workflow.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# for issue at https://github.com/PacificBiosciences/Bioinformatics-Training/issues/15
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest:8080, host:8080
config.vm.synced_folder "/Volumes/Promise_Pegasus/fearjm/pacbio_prelim", "/home/ubuntu/pacbio_prelim", :mount_options => ["dmode=755", "fmode=644"] config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "20048"]
@jfear
jfear / gist:746b9e9201230f8e50eb27abffee60f8
Created May 25, 2017 14:21 — forked from craigminihan/gist:b23c06afd9073ec32e0c
Build GCC 4.9.2 for C/C++ on CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
cd ~/Downloads
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install