Thursday 31 August 2017

Java Jargon Explained

Cited from the Book Java How to Program

Java SE Development Kit==JDK

A file name ending with the .java extension indicates that the file contains Java source code.

Compiler creates bytecodes and stores them on disk in a file whose name ends with .class.

The Java compiler translates Java source code into bytecodes that represent the tasks to execute in the execution phase. Bytecodes are executed by the Java Virtual Machine (JVM)—a part of the JDK and the foundation of the Java platform. A virtual machine (VM) is a software application that simulates a computer but hides the underlying operating system and hardware from the programs that interact with it.

Unlike machine language, which is dependent on specific computer hardware, bytecodes are platform independent—they do not depend on a particular hardware platform. So, Java’s bytecodes are portable—without recompiling the source code, the same bytecodes can execute on any platform containing a JVM that understands the version of Java in which the bytecodes were compiled. The JVM is invoked by the java command.

The JVM’s class loader takes the .class files containing the program’s bytecodes and transfers them to primary memory. The class loader also loads any of the .class files provided by Java that your program uses.

Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions.

Today’s JVMs typically execute bytecodes using a combination of interpretation and so-called just-in-time (JIT) compilation. In this process, the JVM analyzes the bytecodes as they’re interpreted, searching for hot spots -- parts of the bytecodes that execute frequently. For these parts, a just-in-tim(JIT) compiler—known as the Java HotSpot compiler—translates the bytecodes into the underlying computer’s machine language. When the JVM encounters these compiled parts again, the faster machine-language code executes.

A Java application is a computer program that executes when you use the java command to launch the Java Virtual Machine (JVM).

Computing: Kernal

Cited from the Book Java How to Program

The software that contains the core components of the operating system is called the kernel.

Computing Interpreter

Cited from the Book "Java How to Program"

Compiling a large high-level language program into machine language can take a considerable amount of computer time. Interpreter programs were developed to execute high level language programs directly (without the delay of compilation), although slower than compiled programs run.

Delete a Block of Text in Vi

vim - How to delete a large block of text without counting the lines?

Comment or Uncomment a Block of Code

What's a quick way to comment/uncomment lines in Vim?

Groovy Web Console

Groovy Web Console

Wednesday 30 August 2017

Groovy Start Guide

Cited from Install Groovy

Install Binary Executables of Groovy
  1. Download a binary distribution of Groovy and unpack it into some file on your local file system.
  2. Set your GROOVY_HOME environment variable to the directory you unpacked the distribution.
  3. Add GROOVY_HOME/bin to your PATH environment variable.
  4. Set your JAVA_HOME environment variable to point to your JDK.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A introduction to Groovy Groovy A Rapid-Development JVM Language

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A book on Groovy Groovy in Action

Installing JRE/JDK and Set JAVA_HOME in Ubuntu

How To Install Java with Apt-Get on Ubuntu 16.04


Configuration of Java and Javac in Ubuntu

Cited from apt-get install openjdk-7-jdk doesn't install javac. Why?

The proper Debian/Ubuntu way to configure which javac is pointed to by /usr/bin/javac is to use the update-alternatives command. You can do it interactively, and select from a list of available options:

sudo update-alternatives --config javac

Or you can specify which option you want on the command-line:
sudo update-alternatives --set javac /usr/lib/jvm/java-7-openjdk/bin/javac

Because of the way it stores the information, using update-alternatives is not exactly equivalent (but instead is considered preferable) to manually making /usr/bin/java a symbolic link to your javac of choice. See man update-alternatives for more information about this.

Tuesday 29 August 2017

R Color Demo

Cited from Colors in R

colors <- RColorBrewer::brewer.pal(NumOfColor, ColorPaletteName)

"colorRampPalette" can be called to interpolate these colors, and it actually returns a function.

pal <- colorRampPalette(colors)

pal is a function that takes a positive integer argument and returns that number of colors from the palette.

pal(NumOfColor)

for example, pal(10)

Vimium

Vimium

Monday 28 August 2017

Fastq Quality Control Visualization

fastqp

Quality control, trimming, error correction and pre-processing of data

Hera for RNA-seq

hera

Complexity of R Garbage Collector in .Call()

Cited from R’s C interface

An additional complication is the garbage collector: if you don’t protect every R object you create, the garbage collector will think they are unused and delete them.

PROTECT() calls do. They tell R that the object is in use and shouldn’t be deleted if the garbage collector is activated. (We don’t need to protect objects that R already knows we’re using, like function arguments.)

You also need to make sure that every protected object is unprotected. UNPROTECT() takes a single integer argument, n, and unprotects the last n objects that were protected. The number of protects and unprotects must match. If not, R will warn about a “stack imbalance in .Call”.

R’s complete C API -- Header File

Cited from R’s C interface

rinternals <- file.path(R.home("include"), "Rinternals.h")
file.show(rinternals)

Tmux

A tmux Crash Course

TMUX – The Terminal Multiplexer

How To Install And Use tmux On Ubuntu 12.10

Friday 25 August 2017

Rchaeology, R Idioms

Cited from Rchaeology, R Idioms




R Condition Handling

Cited from Beyond Exception Handling: Conditions and Restarts

In a well-written program, each function is a black box hiding its inner workings. Programs are then built out of layers of functions: high-level functions are built on top of the lower-level functions, and so on. This hierarchy of functionality manifests itself at runtime in the form of the call stack: if high calls medium, which calls low, when the flow of control is in low, it’s also still in medium and high, that is, they’re still on the call stack.

Each function–low, for example–has a job to do. Its direct caller–medium in this case–is counting on it to do its job. However, an error that prevents it from doing its job puts all its callers at risk: medium called low because it needs the work done that low does; if that work doesn’t get done, medium is in trouble. But this means that medium’s caller, high, is also in trouble–and so on up the call stack to the very top of the program. On the other hand, because each function is a black box, if any of the functions in the call stack can somehow do their job despite underlying errors, then none of the functions above it needs to know there was a problem–all those functions care about is that the function they called somehow did the work expected of it.

A condition is an S3 object whose class indicates the general nature of the condition and whose instance data carries information about the details of the particular circumstances that lead to the condition being signaled.

Conditional classes are regular S3 classes, built up from a list with components message and call. There is no built in function to generate a new object of class condition.

stop() is normally just called with a string, the error message, but you can also call it with a condition object.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R on.exit()

on.exit

Friday 18 August 2017

Bash Declare Builtin

The Bash declare Statement


Bash /dev/fd/1 (Standard Output)

Cited from the Book "Pro Bash Programming"

/dev/fd/1 is standard output.

Bash Compound Commands

Cited from the Book "Pro Bash Programming"

A compound command is a list of commands enclosed in ( … ) or { … }, expressions enclosed in (( … )) or [[ … ]], or one of the block-level shell keywords (that is, case, for, select, while, and until).

Bash Set Bultin

Cited from Bash Positional Parameters Explained with 2 Example Shell Scripts

Set command sets the positional parameter explicitly. Set with the '-' refers end of options, all following arguments are positional parameter even they can begin with '-'. Set with '-' with out any other arguments unset all the positional parameters.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cited from The set builtin command

'-' "End of options" - all following arguments are assigned to the positional parameters, even when they begin with a dash. -x and -v options are turned off. Positional parameters are unchanged (unlike using --!) when no further arguments are given.
'--' If no arguments follow, the positional parameters are unset. With arguments, the positional parameters are set, even if the strings begin with a - (dash) like an option.

## after word splitting each element becomes a parameter
set -- $1

Bash Let Builtin

Cited from Bash Positional Parameters Explained with 2 Example Shell Scripts

Shell builtin ‘let’ allows arithmetic operation to be performed on shell variables.

let add=$1+$2 
let sub=$1-$2 
let mul=$1*$2 
let div=$1/$2 



Bash Function

Cited from the Book "Pro Bash Programming"

A function is executed in the same process as the script that calls it. This makes it fast, because no new process has to be created. All the variables of the script are available to it without having to be exported, and when a function changes those variables, the changes will be seen by the calling script. That said, you can make variables local to the function so that they do not affect the calling script; the choice is yours.

name() <compound command>

function name() <compound command>

Inside a function, an argument sets the function’s return code; if there is no argument, the exit code of the function defaults to that of the last command executed.

The next command, local, is a shell builtin that restricts a variable’s scope to the function (and its children), but the variable will not change in the parent process.

Beginning with bash-4.0, local and declare have an option, -A, to declare an associative array.

After a script containing only a function is run/sourced, the function is now available at the shell prompt.

If a function’s body is wrapped in parentheses, then it is executed in a subshell, and changes made during its execution do not remain in effect after it exits:

$ funky() ( name=nobody; echo "name = $name" )
$ name=Rumpelstiltskin
$ funky
name = nobody
$ echo "name = $name"
name = Rumpelstiltskin

max3() { #@ Sort 3 integers and store in $_MAX3, $_MID3 and $_MIN3
  [ $# -ne 3 ] && return 5
  [ $1 -gt $2 ] && { set -- $2 $1 $3; }
  [ $2 -gt $3 ] && { set -- $1 $3 $2; }
  [ $1 -gt $2 ] && { set -- $2 $1 $3; }
  _MAX3=$3
  _MID3=$2
  _MIN3=$1
}

Use the convention of beginning function names with an underscore when they set a variable rather than print the result. The variable is the name of the function converted to uppercase.

Most of the time, it is recommended to source the library to include all its functions in the current script:

. date-funcs ## get date-funcs from:
## http://cfaj.freeshell.org/shell/ssr/08-The-Dating-Game.shtml

Occasionally, only one function is needed from a library, so it is recommended to cut and paste it into a new script.


Bash shopt Sets Shell Options

Cited from change shell properties with linux shopt command

Example1: To enable an option with shopt you have to use -s (Set) option

shopt -s optiontype

Example2: To disable already set option use -u along with shopt

shopt -u optiontype

Example3: To see what are the options set or unset execute below command.

shopt

or

shopt -p

Bash Associative Arrays

Cited from the Book "Pro Bash Programming"

Associative arrays, introduced in bash in version 4.0, use strings as subscripts and must be declared before being used.

$ declare -A array
$ for subscript in a b c d e
> do
> array[$subscript]="$subscript $RANDOM"
> done

Bash [@] vs [*]

Cited from the Book "Pro Bash Programming"

The subscripts @ and * are analogous to their use with the positional parameters: * expands to a single parameter if quoted; if unquoted, word splitting and file name expansion is performed on the result. Using @ as the subscript and quoting the expansion, each element expands to a separate argument, and no further expansion is performed on them.

$ printf "%s\n" "${BASH_VERSINFO[*]}"
4 0 10 1 release i686-pc-linux-gnuoldld
$ printf "%s\n" "${BASH_VERSINFO[@]}"
4
0
10
1
release
i686-pc-linux-gnuoldld

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When Bash (or any similar shell) parses a command line, it splits it into a series of "words" (which I will call "shell-words" to avoid confusion later). Generally, words are separated by spaces (or other whitespace), but spaces can be included in a word by escaping or quoting them. The difference between [@] and [*]-expanded arrays in double-quotes is that "${myarray[@]}" leads to each element of the array being treated as a separate shell-word, while "${myarray[*]}" results in a single shell-word with all of the elements of the array separated by spaces (or whatever the first character of IFS is).

Thursday 17 August 2017

POSIX (Portabl Operating System Interface for Unix) Globbing

Cited from the Book "BASH Shell: Essential Programs for Your Survival at Work"

[[:alnum:]] 0-9a-zA-Z
[[:alpha:]] a-zA-Z
[[:blank:]] tab and space
[[:space:]] tab, space and newline
[[:cntrl:]] all control characters
[[:digit:]] 0-9
[[:lower:]] a-z
[[:upper:]] A-Z
[[:print:]] includes the SPACE character, digit, UPPER-case, LOWER-case.
[[:punct:]] all punctuation characters
[[:xdigit:]] 0-9a-fA-F All valid hexadecimal digits

Bash Print Directory Portion of a Path

Cited from the Book "Pro Bash Programming"

case $1 in
  */*) printf "%s\n" "${1%/*}" ;;
  *) [ -e "$1" ] && printf "%s\n" "$PWD" || echo '.' ;;
esac

Bash Null ":" (Colon) Operator

Cited from Using a Colon As A Bash Null Operator

":" is a do-nothing placeholder.

if [ "$A" = "1" ];
then
  :
else
  : > /temp/seldon
fi

Bash Prompt String

Cited from How to: Change / Setup bash custom prompt

So when executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command.


Check Bash Version

Cited from the Book "Pro Bash Programming"

BASH_VERSION (or BASH_VERSINFO) is used to determine whether the running shell is capable of running a script.
case $BASH_VERSION in
  [12].*) echo "You need at least bash3.0 to run this script" >&2; exit 2;;
esac


Bash Exporting A Variable

Cited from the Book "Pro Bash Programming"

There is no need to export a variable unless you want to make it available to scripts (or other programs) called from the current script (and their children and their children’s children and...). Exporting a variable doesn’t make it visible anywhere except child processes.

Once a variable is exported, it remains in the environment until it is unset.

In bash, reassignment doesn't remove a variable from the environment.

Variables set in a subshell are not visible to the script that called it. Subshells include command substitution, as in $(command); all elements of a pipeline; and code enclosed in parentheses, as in '(' command ')'.





Chromatin States Inference -- Multiple Condition ChIP-seq

An Integrated Model of Multiple-Condition ChIP-Seq Data Reveals Predeterminants of Cdx2 Binding

jMOSAiCS: joint analysis of multiple ChIP-seq datasets

R jmosaics Bioconductor

R mosaics Bioconductor

Segway 2.0

Segway Tutorial

Segtools

Monday 14 August 2017

Bash 'pr' Command

Derived from Making Text in Columns with pr

pr <(ls ./) > out.txt

The -t option takes away the heading and margins at the top and bottom of each page. That's useful when "pasting" data into columns with no interruptions.

pr -t <(ls ./) > out.txt

The -m option reads all files on the command line simultaneously and prints each in its own column.

pr -m -t <(ls ./) > out.txt

pr may use TAB characters between columns. If that would be bad, you can pipe pr's output through expand. Many versions of pr have a -sX option that sets the column separator to the single character X.

pr -s' ' -m -t <(ls ./) > out.txt

By default, pr -m doesn't put filenames in the heading. If you want that, use the -h option to make your own heading.

pr -s' ' -h 'my heading' -m -t <(ls ./) > out.txt

One File, Several Columns: -number

An option that's a number will print a file in that number of columns. For instance, the -3 option prints a file in three columns. The file is read, line by line, until the first column is full (by default, that takes 56 lines). Next, the second column is filled. Then, the third column is filled. If there's more of the file, the first column of page 2 is filled -- and the cycle repeats

pr -s' ' -h 'my heading' -3 -t <(ls ./) > out.txt

Order Lines Across Columns: -l

Do you want to arrange your data across the columns, so that the first three lines print across the top of each column, the next three lines are the second in each column, and so on?

Use the -l1 (page length 1 line) and -t (no title) options. Each "page" will be filled by three lines (or however many columns you set). You have to use -t; otherwise, pr will silently ignore any page lengths that don't leave room for the header and footer.

pr -l1 -t -3 <(ls ./) > out.txt

Bash: The Difference Between := and :-

Cited from ${var:=default} vs ${var:-default} - what is difference? [duplicate]

They are similar only that ${var:=defaultvalue} assigns value to var as well and not just expand as like it.

Example:
$A='' "
$echo "${A:=2}"
2
$echo "$A"
$A='' "
$echo "${A:-2}"
2
$echo "$A"
(empty)


Bash Process Substitution

Cited from the Book "Pro Bash Programming"

Process substitution creates a temporary filename for a command or list of commands. You can use it anywhere a file name is expected. The form <(command) makes the output of command available as a file name; >(command) is a file name that can be written to.

sa <(ls -l) >(pr -Tn)

Bash Pathname Expansion

Cited from the Book "Pro Bash Programming"

Unquoted words on the command line containing the characters *, ?, and [ are treated as file globbing patterns and are replaced by an alphabetical list of files that match the pattern. If no files match the pattern, the word is left unchanged.

Square brackets match any one of the enclosed characters, which may be a list, a range, or a class of
characters: [aceg] matches any one of a, c, e, or g; [h-o] matches any character from h to o inclusive; and [[:lower:]] matches all lowercase letters.

You can disable file name expansion with the set -f command.

Bash Internal Field Separator

Cited from the Book "Pro Bash Programming"

The results of parameter and arithmetic expansions, as well as command substitution, are subjected to word splitting if they were not quoted.
Word splitting is based on the value of the internal field separator variable, IFS. The default value of IFS contains the whitespace characters of space, tab, and newline (IFS=$' \t\n'). When IFS has its default value or is unset, any sequence of default IFS characters is read as a single delimiter.

If IFS contains another character (or characters) as well as whitespace, then any sequence of
whitespace characters plus that character will delimit a field, but every instance of a nonwhitespace
character delimits a field.

If IFS contains only nonwhitespace characters, then every occurrence of every character in IFS
delimits a field, and whitespace is preserved.

Bash Date Command

Cited from the Book "Pro Bash Programming"

HowTo Format Date For Display or Use In a Shell Script

Bash Conditional Operator

Cited from the Book "Pro Bash Programming"

expr ? expr1 : expr2

Bash Variable pre/post-increment and pre/post-decrement

Cited from the Book "Pro Bash Programming"

id++ id--     Variable post-increment and post-decrement

++id –-id     Variable pre-increment and pre-decrement

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In languages that support both versions of the operators, the pre-increment and pre-decrement operators increment (or decrement) their operand by 1, and the value of the expression is the resulting incremented (or decremented) value. In contrast, the post-increment and post-decrement operators increase (or decrease) the value of their operand by 1, but the value of the expression is the operand's original value prior to the increment (or decrement) operation.

$ x=5; echo $(( ++x / 2 ))
3
$ x=5; echo $(( x++ / 2 ))
2

Bash Parameter Expansion

Cited from the Book "Pro Bash Programming"

Parameter expansion replaces a variable with its contents.

Parameter expansions that are not enclosed in double quotes are subject to word splitting and pathname expansion.

Bash Tilde Expansion

Tilde expansion

Bash: Brace Expansion In Command Arguments

Cited from the Book "Pro Bash Programming"

The first expansion performed, brace expansion, is nonstandard (that is, it is not included in the POSIX specification). It operates on unquoted braces containing either a comma-separated list or a sequence. Each element becomes a separate argument.

A string before or after the brace expression will be included in each expanded argument.

pre{d,l}ate

Braces may be nested.

printf "%s\n" {{1..3},{a..d}}

Multiple braces within the same word are expanded recursively. The first brace expression is expanded, and then each of the resulting words is processed for the next brace expression. With the word {1..3}{a..c}, the first term is expanded, giving the following: 
1{a..c} 2{a..c} 3{a..c}

In version 4 of bash, further capabilities have been added to brace expansion. Numerical sequences
can be padded with zeros, and the increment in a sequence can be specified.

printf  "%s\n" {01..13..2}

Increments can also be used with alphabetic sequences.

printf  "%s\n" {a..f..2}



Bash Single and Double Quoting

Cited from the Book "Pro Bash Programming"

All characters inside a single-quoted word are taken literally. A single-quoted word cannot contain a single quote even if it is escaped; the quotation mark will be regarded as closing the preceding one, and another single quote opens a new quoted section. Consecutive quoted words without any intervening whitespace are considered as a single argument.

In bash, single quotes can be included in words of the form $'string' if they are escaped. $ echo $'\'line1\'\n\'line2\''
'line1'
'line2'

Ubuntu: the Difference Between apt-get update And upgrade?

Cited from What is the difference between apt-get update and upgrade?

You should first run update, then upgrade. Neither of them automatically runs the other.
  • apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.
  • apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed. This is why you first want to update.

Sunday 13 August 2017

Bash Testing an Expression

Cited from the Book "Pro Bash Programming"

Expressions are deemed to be true or false by the test command or one of two nonstandard shell reserved words, [[ and ((. The test command compares strings, integers, and various file attributes; (( tests arithmetic expressions, and [[ ... ]] does the same as test with the additional feature of comparing regular expressions.

The -z and -n operators return successfully if their arguments are empty or nonempty.

$ [ -z "" ]
$ echo $?
0
$ test -n ""
$ echo $?
1
The greater-than and less-than symbols are used in bash to compare the lexical positions of strings and must be escaped to prevent them from being interpreted as redirection operators:

$ str1=abc
$ str2=def
$ test "$str1" \< "$str2"
$ echo $?
0
$ test "$str1" \> "$str2"
$ echo $?
1

For "test" command, "-a" (logical AND) and -o (logical OR) operators can be used to combine expression conditions.

Like test, [[ ... ]] evaluates an expression. Unlike test, it is not a built-in command. It is part of the shell grammar and not subject to the same parsing as a built-in command. Parameters are expanded, but word splitting and file name expansion are not performed on words between [[ and ]].

A list is a sequence of one or more commands separated by semicolons, ampersands, control operators, or newlines. A list may be used as the condition in a while or until loop or as the body of any loop. The exit code of a list is the exit code of the last command in the list.

Bash Exit Status With the Special Variable $?

Cited from the Book "Pro Bash Programming"

You can test the success of a command directly using the shell keywords while, until, and if or with the control operators && and ||. The exit code is stored in the special parameter $?.

If the command executed successfully (or true), the value of $? is zero. If the command failed for some reason, $? will contain a positive integer between 1 and 255 inclusive.

Bash read command

Bash One-Liners Explained, Part I: Working with files

Bash tee Command

Cited rom the Book "Pro Bash Programming"

The tee command reads from the standard input and passes it to one or more files as well as to the standard output.


Bash Random Number Generator/Variable $RANDOM

Cited from the Book "Pro Bash Programming"

$RANDOM is a bash variable that returns a different integer between 0 and 32,767 each time it is referenced.

 

Bash %s vs %b

Cited from the Book "Pro Bash Programming"

%b is like %s except that escape sequences in the arguments are translated

Bash Exec in the Context of I/O Redirection

Cited from understanding bash “exec 1>&2” command

exec is a built-in Bash function, so it can have special behavior that an external program couldn't have. In particular, it has the special behavior that:

If COMMAND is not specified, any redirections take effect in the current shell.

This applies to any sort of redirection; you can also write, for example, any of these:

exec >tmp.txt
exec >>stdout.log 2>>stderr.log
exec 2>&1

Friday 11 August 2017

Bash Parameters

Cited from the book "Pro Bash Programming"

Chapter 2
To access positional parameters greater than 9, the number must be enclosed in braces: ${15}.

The function shift N moves the positional parameters by N positions, if you ran shift (the default value of N is 1), then $0 would be discarded, $1 would become $0, $2 would become $1, and so on: they would all be shifted by 1 position.

The two special parameters, $* and $@, expand to the value of all the positional parameters combined. $# expands to the number of positional parameters. $0 contains the path to the currently running script or to the shell itself if no script is being executed.

$$ contains the process identification number (PID) of the current process, $? is set to the exit code of the last-executed command, and $_ is set to the last argument to that command. $! contains the PID of the last command executed in the background, and $- is set to the option flags currently in effect.

%b is like %s except that escape sequences in the arguments are translated.

printf "%s\n" "Hello\nworld" "12\tword", vs.
printf "%b\n" "Hello\nworld" "12\tword"

Integers are printed with %d. The integer may be specified as a decimal, octal (using a leading 0), or
hexadecimal (preceding the hex number with 0x) number.

bash added a -v option to store the output in a variable instead of printing it to the standard output. 
printf -v num4 "%04d" 4

Input/Output streams are referred to by numbers, called file descriptors (FDs). These are 0, 1, and 2, respectively. The stream names are also often contracted to stdin, stdout, and stderr.

Redirection is performed before any command on the line is executed. If you redirect to the same file you are reading from, that file will be truncated, and the command will have nothing to read.

Redirecting standard output does not redirect standard error. Error messages will still be displayed on your monitor.

Instead of sending output to a file, it can be redirected to another I/O stream by using >&N where N is the number of the file descriptor.

For the 'read' command only the -r option is recognized by the POSIX standard. It tells the shell to interpret escape sequences literally.

R Order Data Frame by Multiple Columns

Cited from Order a matrix by multiple column in r

set.seed(2013) # preparing my example
mat <- matrix(sample.int(10,size = 30, replace = T), ncol = 3)
mat[do.call(order, as.data.frame(mat)),]

DNA Methylation

Cited from the paper Integration of CpG-free DNA induces de novo methylation of CpG islands in pluripotent stem cells

Genome-wide single-base–resolution mammalian methylome studies have revealed that most of the cytosine in CpG dinucleotides is methylated, presumably during blastocyst to early postimplantation stages by DNA methyltransferase 3A (DNMT3A)– and/or DNMT3B-mediated de novo methylation.

Tuesday 1 August 2017

Manage Custom-installed Texlive

tlmgr install collection-fontsrecommended collection-fontsextra

Polycomb Group Proteins

Cited from the paper "Targeting Polycomb systems to regulate gene expression: modifications to a complex story"

Polycomb group proteins usually belong to one of two multi-subunit protein complexes: Polycomb repressive complex 1 (PRC1), which adds a ubiquityl moiety to histone H2A at Lys119 (H2AK119ub1); and PRC2, which catalyses the addition of one to three methyl groups to histone H3 at Lys27, leading to H3K27me1, H3K27me2 and H3K27me3.

PRC1 and PRC2 usually co-occupy target sites in the genome, at which their combined activities create Polycomb chromatin domains consisting of the Polycomb group proteins themselves, H2AK119ub1, and H3K27me3.

Update a CRAN Package

Installing & Updating Packages in R