Skip to content

Instantly share code, notes, and snippets.

View lgautier's full-sized avatar

Laurent Gautier lgautier

View GitHub Profile
@lgautier
lgautier / gist:955e14077322480803e2
Created September 30, 2014 02:36
rpy2 and HTML display in ipython
{
"metadata": {
"name": "",
"signature": "sha256:e814b7d85c1dc274b3c62ca6849951326dee84fa31b999f9735064f46fb45a7a"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:cd75955d68d7ca272ff32886ce865002acb49b25f2e1cfba237539e70925eeda"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
# This is a setup snippet for an ipython notebook.
# It requires the presence of variable 'setup_digest',
# defined in the cell controlling the setup.
if 'setup_digest' not in locals():
import rpy2
%load_ext rpy2.ipython
# pigheaded / slow rpy2 developpers,
# customize away:
from rpy2.robjects.conversion import ri2py
power <- function(x, n) {
# a not-so-useful reimplementation
x ^ n
}
square <- function(x) {
x^2
}
cube <- function(x) {
@lgautier
lgautier / hctree.jl
Created December 27, 2012 14:56
Hierarchical clustering with the Julia-R bridge
require("Rif")
using Rif
initr()
m = R("matrix(rnorm(100), nrow=20)")
# A Julia matrix mj of type (Array{Float64, 2}) could
# be used with
# m = RArray{Float64,2}(mj)
d = call(R("dist"), [m])
@lgautier
lgautier / rpy2_ggplot2
Last active December 15, 2015 01:29
rpy2: ggplot2 figures from pandas dataframes
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@lgautier
lgautier / gist:5426275
Created April 20, 2013 15:05
ipython notebook (Python 3.3.1, R-3.0.0, rpy2-2.4.0-dev
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lgautier
lgautier / demo_benchmark_mashingp.sh
Last active January 30, 2017 04:37
Demo/benchmark mashing-pumpkins to build minhash sketches
#!/bin/sh
echo
echo '---------------'
echo ' test w/ FASTA '
echo '---------------'
testchrom=chr1.fa.gz
if [ ! -f "${testchrom}" ]; then
@lgautier
lgautier / rpy2-ld-library-path.sh
Created December 31, 2019 17:55
Set LD_LIBRARY_PATH for rpy2 when R is in a non-system location
export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}