Wednesday, 27 June 2018

Groovy instanceof

Groovy example source code file (InstanceofTest.groovy)

Tuesday, 26 June 2018

Join Variable Numbers of Paths in Groovy

Cited from Joining Paths in Java

Converts a path string, or a sequence of strings that when joined form a path string, to a Path.
...
Path representing an empty path is returned if first is the empty string and more does not contain any non-empty strings.

In Groovy, to print a variable number of arguments, the code is below.

import java.nio.file.*

String joinPath(String first, String... args){
Path path = Paths.get(first, args)
path.toString()
}

println joinPath('a')
println joinPath('a', 'b', 'c')
println joinPath('~/Data')

java.nio.file.Path Class in Groovy

Cited from Groovy Goodness: Extra Methods for NIO Path

Groovy adds a lot of extra methods to the File object to work with the contents or find and filter files in a directory. These methods are now also added to the java.nio.file.Path class since Groovy 2.3.

In a groovy script, the java.nio.file.Path class can be imported as the following. 

import java.nio.file.*

Wednesday, 20 June 2018

What is a Read Group?

Cited from Read Groups

There is no formal definition of what is a read group, but in practice, this term refers to a set of reads that were generated from a single run of a sequencing instrument.

In the simple case where a single library preparation derived from a single biological sample was run on a single lane of a flowcell, all the reads from that lane run belong to the same read group. When multiplexing is involved, then each subset of reads originating from a separate library run on that lane will constitute a separate read group.