Skip to content

Instantly share code, notes, and snippets.

View samuell's full-sized avatar
💻
Hacking away

Samuel Lampa samuell

💻
Hacking away
View GitHub Profile
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
// -------------------------
// Option A
// -------------------------
merge := wf.NewProc("merge_"+ind, "bwa sampe {i:ref} {i:sai1} {i:sai2} {i:fq1} {i:fq2} > {o:merged} # {i:refdone} {p:ind}",
merge.InParam("ind").FromStr(ind)
merge.In("ref").From(ungzipRef.Out("out"))
merge.In("refdone").From(indexRef.Out("done"))
merge.In("sai1").From(outs[ind]["1"]["sai"])
merge.In("sai2").From(outs[ind]["2"]["sai"])
merge.In("fq1").From(outs[ind]["1"]["fastq"])
package main
import (
"flag"
"strconv"
sp "github.com/scipipe/scipipe"
spcomp "github.com/scipipe/scipipe/components"
)
@samuell
samuell / caw_scipipe_yamlexperiment.yml
Last active June 14, 2018 15:11
This yaml-code would be fed into a tool that generates something like this Go code: https://gist.github.com/samuell/e89ccc2544c8d4def5eeef9d2f7e46bc
# --------------------------------------------------------------------------------------------
# Quick syntax intro
# --------------------------------------------------------------------------------------------
# Process definitions:
# Processes can be defined as "file:" or "shell:" type.
# - The "shell:" type takes a command pattern with the following special syntax:
# - {i:portname} defines an in-port (for feeding inputs from upstream processes)
# - {o:portname} defines an out-port (where outputs will be sent to connected downstream processes)
# - {p:portname} defines a parameter port, where parameters can be fed as a stream of strings
# Connections:
parent(mark, jim).
parent(sam, mark).
grandparent(Grandparent, Child) :-
parent(Grandparent, Parent),
parent(Parent, Child).
package main
import (
"flag"
"fmt"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/clientcmd"
)
SELECT ?s ?p ?o WHERE { ?s ?p ?o }
@samuell
samuell / Drugbank parse to DB
Created March 2, 2018 20:49 — forked from sgsfak/Drugbank parse to DB
Parse DrugBank XML file with xmlstarlet
We couldn’t find that file to show.
cat {i:targetdata} > {o:filledup} && \
let "fillup_lines_cnt = "$(wc -l {i:targetdata} | awk '{ printf $1 }')" * 2" && \
tail -n +2 {i:rawdata} \
| awk -F"\t" '$9 != "{p:gene}" { $12 "\tN" }' \
| sort \
| uniq \
| shuf --random-source={i:randsrc} \
| head -n $fillup_lines_cnt \
>> {o:filledup}
package main
import "fmt"
func main() {
bufSize := 1 // Try changing this to 0, and see what happens!
ch1, ch2, ch3 := make(chan int, bufSize), make(chan int, bufSize), make(chan int, bufSize)
go func() {