Skip to content

Instantly share code, notes, and snippets.

View rsuchecki's full-sized avatar

Rad Suchecki rsuchecki

View GitHub Profile
@rsuchecki
rsuchecki / main.nf
Last active August 21, 2023 12:07
comparing 3 different syntax styles of workflow composition
params.pipes = false //Alternative sytax for DSL2 workflows
params.nested = false //if not pipes, use the nested workflow syntax
workflow {
/*
For demonstration purposes we are comparing 3 different
syntax styles of workflow composition
These can also be mixed.
The 'pipes' work best when each process has only one input (which may be a tuple of multiple elements)
*/
@rsuchecki
rsuchecki / gource.sh
Created February 22, 2021 00:11 — forked from peterjmag/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
feedback_ch = Channel.create()
input_ch = Channel.from([1,2,3,4,5,6,7]).merge( feedback_ch ) //.until{count++ > 10 }
feedback_ch << 1
process build {
input: tuple val(v), val(u) from input_ch
output: val(y) into feedback_ch
exec:
y = v+u
# Ensure each new screen ends up with it's own history file bind c screen bash -ic 'HISTFILE=~/.bash_history.${WINDOW} bash'
bind c screen bash -ic 'HISTFILE=~/.bash_history.${WINDOW} bash -l'
bind ^C screen bash -ic 'HISTFILE=~/.bash_history.${WINDOW} bash -l'
# some default tabs
screen -t "bash" bash -l
#termcapinfo xterm ti@:te@
# Bind F8 and F9 to previous and next screen window
bindkey -k k8 prev
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsuchecki
rsuchecki / nextflow_channel_forking.nf
Last active August 26, 2019 06:13
Channel forking in nextflow
channelsQ = (Channel.from('World', 'Mundo').into(2) as Queue)
process foo {
input: val x from ( channelsQ.poll() )
exec: println "Foo says: Hello ${x}"
}
process bar {
input: val x from ( channelsQ.poll() )
exec: println "Bar says: Hello ${x}"
@rsuchecki
rsuchecki / Flat_map_collection_or_value.nf
Last active July 31, 2019 00:47
Nextflow Gitter question by @madkinsz: If I have a channel with the tuple (flag, file) and sometimes it's (flag, [file_a, file_b]) but I still want the process to operate on (flag, file_a) (flag, file_b) independently, how do I transform the channel into that?
flatMap { flag, files ->
files instanceof Collection ? {def ret = []; files.each {ret << [flag, it] }; ret}() : [[flag, files]]
}
@rsuchecki
rsuchecki / trace.txt
Last active May 23, 2019 07:43
Nextflow trace.txt example
task_id hash native_id name status exit submit duration realtime %cpu peak_rss peak_vmem rchar wchar
3 93/5be529 25680649 fetchRemoteDataFromEnsemblPlants ([species:Arabidopsis_thaliana, version:TAIR10, source:https://plants.ensembl.org/Arabidopsis_thaliana, release:39, shortName:TAIR]) CACHED 0 2019-05-13 22:16:05.866 34.5s 26.2s 1.1% 9.2 MB 199.7 MB 9.5 MB 41.5 MB
4 b6/e465bf 25680659 fetchRemoteDataFromEnsemblPlants ([species:Hordeum_vulgare, version:IBSC_v2, source:https://plants.ensembl.org/Hordeum_vulgare, release:43, shortName:Barley]) CACHED 0 2019-05-13 22:19:06.207 34.7s 31.3s 2.4% 9.3 MB 199.7 MB 18 MB 145.4 MB
6 16/ad4f35 25680648 fetchRemoteDataFromEnsemblPlants ([species:Oryza_sativa, version:IRGSP-1.0, source:https://plants.ensembl.org/Oryza_sativa, release:39, shortName:IRGSP]) CACHED 0 2019-05-13 22:16:05.777 34.5s 26.9s 1.1% 9.3 MB 199.7 MB 9.7 MB 34.6 MB
3 be/dde3f8 25680802 fetchRemoteDataFromEnsemblPlants ([species:Brachypodium_distachyon, version:Brachypodium_distachyon_v3.0, source:http
@rsuchecki
rsuchecki / comb.nf
Created January 9, 2019 06:14
groovy/nextflow param combinations
def args = ['-arg 1', '-arg 2', '-arg 3', '-arg 4']
comb = []
1.upto(args.size()) {
[args].multiply(it).eachCombination { list ->
if(list.size() == 1 || (1..<list.size()).every { list[it - 1] < list[it] }) {
comb << list
}
}
}
@rsuchecki
rsuchecki / labelbug.nf
Created October 10, 2018 10:06
Code for triggering suspected Nextflow bug when assigning a variable value to a process label
bars = ['bar1', 'bar2']
process foo {
tag "${bar}"
label "${bar}"
input:
each bar from bars
exec:
println ("Current: "+bar)