Skip to content

Instantly share code, notes, and snippets.

View tucano's full-sized avatar

Davide tucano

View GitHub Profile
def get_average(array)
sum = 0.0
result = 0.0
if array.length > 0 then
array.each do |item|
sum += item
end
result = sum / array.length
end
return result
stage_one = {
// define output with produce
produce("OUTPUT.vcf") {
println "INPUT IS $input"
exec "touch $output"
}
}
run {
// DEFINE INPUT
bgzip_and_index =
{
// first we define manually the outputs, please NOTE the def
// without def the variable is GLOBAL and will propagate in other branches!!!
// we can use ${input.prefix} to get the BASENAME
// We will produce a file with extension: .ann.gvcf.gz (bgzip)
// and a file with extension .ann.gvcf.gz.tbi (produced by tabix)
// There is no need for the move (mv) stage
def outputs = [
@tucano
tucano / Letter
Created September 21, 2013 13:57
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 17-6: Text breaking up
// A class to describe a single Letter
class Letter {
char letter;
// SILLABA
class Sillaba {
// An array of Letter objects
Letter[] letters;
float x;
float y;
Sillaba(String message, float _x , float _y)
library(GillespieSSA)
gillespie_buggy_model <- function()
{
x0 <- c(h=1000,z=10)
nu <- matrix(c(+1, -1, -1, 0, 0, 0, 1, -1),nrow=2,byrow=T)
rownames(nu) <- c("h","z")
colnames(nu) <- c("c1","c2","c3","c4")
a <- c("c1*h*h", "c2*h", "c3*h*z", "c4*h*z")
@tucano
tucano / fibo.py
Created July 10, 2012 10:27
fibonacci test for generators in python
#!/usr/bin/env python
# encoding: utf-8
"""
fibonacci.py
RECURSIVE or GENERATOR?
Created by drambald on 2012-07-10.
Copyright (c) 2012 tucanosoftware.com. All rights reserved.
"""