Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Roman Valls Guimera brainstorm

🏠
Working from home
View GitHub Profile
View JeOS
# https://help.ubuntu.com/10.04/serverguide/C/jeos-and-vmbuilder.html
sudo vmbuilder kvm ubuntu --hostname cloudbiolinux.local --suite lucid \
--flavour virtual --arch amd64 -o --libvirt qemu:///system \
--user ubuntu --pass password \
--addpkg unattended-upgrades --addpkg acpid --addpkg openssh-server
@brainstorm
brainstorm / tasks.py
Created Mar 4, 2011
Celery tasks test
View tasks.py
#!/usr/bin/env python
import subprocess
from celery.task import task
# Task overlapping:
# lvm_create --> archive --> transfer(delayed?) --> (verify) --> lvm_destroy
# basecalling --> fastq transfer (8h ?)
# Without LVM:
# archive --> transfer --> verify
@brainstorm
brainstorm / logbook_mailhandler.py
Created Apr 13, 2011
python logbook mailhandler
View logbook_mailhandler.py
#!/usr/bin/env python
# Small logbook snippet addressing some confusion on record injection
import logbook
handler = logbook.MailHandler("test@example.com", ['recipient@example.com'],
format_string=u'''Subject: [BCBB] {record.extra[run]} \n\n {record.message}''', level='INFO', bubble = True)
log = logbook.Logger("mailtest.log")
@brainstorm
brainstorm / add_final_a_index.py
Created Sep 19, 2011
Illumina hiseq 2000 sequencers add an extra base "A" at the end of each QSEQ read
View add_final_a_index.py
#!/usr/bin/env python
import csv
import sys
import os
ss_reader = csv.DictReader(open(sys.argv[1], 'rU'))
ss_writer = csv.DictWriter(open(os.path.splitext(sys.argv[1])[0]+"_a.csv", 'w'), ss_reader.fieldnames)
ss_writer.writerow(dict((fn,fn) for fn in ss_reader.fieldnames))
@brainstorm
brainstorm / tarit_hiseq2000.sh
Created Sep 19, 2011
md5 + tar for illumina hiseq 2000 datasets, with extra metadata tar
View tarit_hiseq2000.sh
#!/bin/sh
# Generates a TAR archive while computing MD5 checksum for each file.
# From VeriTAR: http://www.g-loaded.eu/2007/12/01/veritar-verify-checksums-of-files-within-a-tar-archive/
DATASET_PATH=`readlink -f $1`
DATASET=`basename $DATASET_PATH`
EXCLUDE_FILES="--exclude .DS_Store --exclude .AppleDouble"
echo "Creating TAR + MD5 for dataset: $DATASET"
tar -cvpf $DATASET.tar $DATASET_PATH $EXCLUDE_FILES \
@brainstorm
brainstorm / dotfilter_symlinker.py
Created Feb 15, 2012
Try to recover illumina dataset with missing .filter files
View dotfilter_symlinker.py
#!/bin/env python
import os
import logging
import glob
import random
from collections import *
fters = defaultdict(set)
all = set(["%04d.filter" % x for x in range(1, 70)])
@brainstorm
brainstorm / quick_delivery.sh
Created Feb 28, 2012
Cronify simple data transfer for simple data delivery
View quick_delivery.sh
#!/bin/sh
DATASET="
SRC=""
DST=""
if [ -d ${SRC}${DATASET} ]; then
echo "Copying ${SRC}${DATASET} into $DST..."
chown -R $USER:uppmax ${SRC}${DATASET}
rsync -a ${SRC}${DATASET} ${DST}
@brainstorm
brainstorm / timelapse.py
Created Oct 15, 2012
Timelapse experiment with cheap hardware (efikamx and benq old (web)camera)
View timelapse.py
#!/usr/bin/env python
import flickrapi
import datetime
import os
import shutil
import subprocess
api_key = 'SETME!!!'
api_secret = 'SETME!!!'
@brainstorm
brainstorm / pref_attach.py
Last active Dec 14, 2015
NetworkX rich gets richer algorithm
View pref_attach.py
#!/usr/bin/env python
# http://rt.com/news/oxfam-report-global-inequality-357/
# http://networkx.github.com/documentation/latest/reference/generated/networkx.generators.random_graphs.barabasi_albert_graph.html
import networkx as nx
import matplotlib.pyplot as plt
g = nx.Graph()
ba = nx.barabasi_albert_graph(15, 5)
er = nx.erdos_renyi_graph(15, 0.15)
@brainstorm
brainstorm / simngs_casava.patch
Last active Dec 16, 2015
Patch for SimNGS to support CASAVA 1.8 FASTQ format
View simngs_casava.patch
diff -ru simNGS.orig/src/intensities.c simNGS/src/intensities.c
--- simNGS.orig/src/intensities.c 2011-11-14 13:04:17.000000000 +0200
+++ simNGS/src/intensities.c 2013-04-24 15:29:40.100739000 +0300
@@ -356,7 +356,7 @@
ints->x[NBASE*i+seq.elt[i]] += lambda;
} else {
uint32_t j = i-seq.nelt;
- if(j>=0 && j<adapter.nelt && NUC_AMBIG != adapter.elt[j]){
+ if(j<adapter.nelt && NUC_AMBIG != adapter.elt[j]){
ints->x[NBASE*i+adapter.elt[j]] += lambda;