Friday 29 June 2018

Family Friend Visiting Recipe June 29, 2018

口水鸡腿

西红柿厚蛋烧




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.

Strings in Groovy

Groovy: Ways to represent String

How to convert String to GString and replace placeholder in Groovy?

Tuesday 12 June 2018

Installing Docker From Ubuntu 18.04 Repository

Cited from How to Install Docker On Ubuntu 18.04 Bionic Beaver

sudo apt install docker.io$ 
sudo systemctl start docker
sudo systemctl enable docker
docker --version

Nextflow Tutorial

Nextflow Workshop 2017

Nextflow Tutorial ACGT14

Nextflow Resources


Mutational Signature Analyses

What does the plot of mutational signature analysis mean?

Interpreting the signature results

Why are there only 96 triplets?

"""
This classification has 96 possible mutations since there are six classes of base substitution C>A, C>G, C>T, T>A, T>C, T>G (all substitutions are referred to by the pyrimidine of the mutated Watson-Crick base pair) and the bases immediately 5’ and 3’ to each mutated base are incorporated.

Wednesday 6 June 2018

Java – Static Class, Block, Methods and Variables

Cited from Java – Static Class, Block, Methods and Variables

"""
Static keyword can be used with class, variable, method and block. Static members belong to the class instead of a specific instance, this means if you make a member static, you can access it without object. Let’s take an example to understand this:

Here we have a static method myMethod(), we can call this method without any object because when we make a member static it becomes class level. If we remove the static keyword and make it non-static then we must need to create an object of the class in order to call it.

Static block is used for initializing the static variables.This block gets executed when the class is loaded in the memory. A class can have multiple Static blocks, which will execute in the same sequence in which they have been written into the program.
  • Static variables are also known as Class Variables.
  • Unlike non-static variables, such variables can be accessed directly in static and non-static methods.
Static Methods can access class variables(static variables) without using object(instance) of the class, however non-static methods and non-static variables can only be accessed using objects.
Static methods can be accessed directly in static and non-static methods.

A class can be made static only if it is a nested class.
  1. Nested static class doesn’t need reference of Outer class
  2. A static class cannot access non-static members of the Outer class
class JavaExample{
   private static String str = "BeginnersBook";

   //Static class
   static class MyNestedClass{
 //non-static method
 public void disp() {

    /* If you make the str variable of outer class
     * non-static then you will get compilation error
     * because: a nested static class cannot access non-
     * static members of the outer class.
     */
    System.out.println(str); 
 }

   }
   public static void main(String args[])
   {
       /* To create instance of nested class we didn't need the outer
 * class instance but for a regular nested class you would need 
 * to create an instance of outer class first
        */
 JavaExample.MyNestedClass obj = new JavaExample.MyNestedClass();
 obj.disp();
   }
}
"""

Static Variable

Cited from Java – static variable with example

"""
A static variable is common to all the instances (or objects) of the class because it is a class level variable. In other words you can say that only a single copy of static variable is created and shared among all the instances of the class. Memory allocation for such variables only happens once when the class is loaded in the memory.

Static variable can be accessed directly in a static method.

Static variable initialization
  1. Static variables are initialized when class is loaded.
  2. Static variables are initialized before any object of that class is created.
  3. Static variables are initialized before any static method of the class executes.
If a variable is 'final', the value of this variable can never be changed in the current or in any class.

Final variable always needs initialization, if you don’t initialize it would throw a compilation error.
"""

Sunday 3 June 2018