Skip to content

Instantly share code, notes, and snippets.

@LukeGoodsell
LukeGoodsell / reset.R
Created November 1, 2018 11:12
Reset R session
# Commands to completely reset the R session
# Close any connections
closeAllConnections()
# A function to unload a namespace without throwing an exception
catch_unload <- function(pkg) {
rmvd <- 0
tryCatch(
{
@LukeGoodsell
LukeGoodsell / unload_strict.R
Last active September 20, 2018 15:50
Unload strict library in R
> T
[1] TRUE
> library("strict")
> T
Error: [strict]
Please use TRUE, not T
5: (function ()
{
@LukeGoodsell
LukeGoodsell / input_file_passing.nf
Created August 17, 2018 14:36
Passing input files to output channels without storing duplicates
#!/usr/bin/env nextflow
in_ch = Channel.from(file("test.txt"))
process test {
storeDir 'out/1'
stageInMode 'rellink'
stageOutMode 'move'
input:
@LukeGoodsell
LukeGoodsell / listOfListsOfItems.nf
Last active June 20, 2017 13:26
Processing each item in a list of lists of items and re-nesting in Nextflow
#!/usr/bin/env nextflow
itemLists = [ [1, 2, 3, 4], [5, 6, 7], [8] ]
def groupIdx = 0
itemListChannel =
Channel
.from(itemLists)
.flatMap { it -> L:{ groupIdx++; it.collect { [ groupIdx, it ] } } }
@LukeGoodsell
LukeGoodsell / execFile.nf
Created June 20, 2017 10:36
Demo of taking input file with exec block
#!/usr/bin/env nextflow
process foo {
output:
file "out.txt" into fooFiles
shell:
'''
echo "hi" > "out.txt";
'''
@LukeGoodsell
LukeGoodsell / .nextflow.log
Last active June 19, 2017 15:17
Nextflow output value & Snakeyaml failure
Jun-19 16:03:13.939 [Actor Thread 4] WARN nextflow.processor.TaskContext - Cannot serialize context map. Cause: java.lang.IllegalArgumentException: type cannot be null. -- Resume will not work on this process
Jun-19 16:03:13.942 [Actor Thread 4] DEBUG nextflow.processor.TaskContext - Failed to serialize delegate map items: [
'x':[null] = [firstName:Jane, lastName:Doe]
'$':[java.lang.Boolean] = true
'task':[nextflow.processor.TaskConfig] = [process:foo, index:2, echo:false, validExitStatus:[0], maxRetries:1, maxErrors:3, shell:[/bin/bash, -ue], executor:local, name:foo (2), cacheable:true, errorStrategy:TERMINATE, workDir:/Volumes/LG_01_WD3TB/tmp/preqctest/work/85/8e1bdbe341d5644034fd3e24426884, hash:858e1bdbe341d5644034fd3e24426884]
'paramsFilePath':[java.io.File] = /Volumes/LG_01_WD3TB/tmp/preqctest/work/85/8e1bdbe341d5644034fd3e24426884/params.yaml
'yaml':[org.yaml.snakeyaml.Yaml] = Yaml:94182769
]
com.esotericsoftware.kryo.KryoException: java.lang.IllegalArgumentException: type cannot be null.