Saturday 29 August 2015

Histone Modification Code

Cited from the paper "Conserved epigenomic signals in mice and humans reveal immune basis of Alzheimer’s disease"

H3K4me3 (associated primarily with active promoters); H3K4me1 (enhancers); H3K27ac (enhancer/promoter activation); H3K27me3 (Polycomb repression); H3K36me3 and H4K20me1 (transcription); and H3K9me3 (heterochromatin).

Ren Lab: Mouse Encode Data

Mouse Encode Project at Ren Lab

Thursday 27 August 2015

Monday 24 August 2015

FeatureCounts: Strandedness

From the source code of featureCounts

   """
    0: unstranded 1: stranded 2: reverse stranded
    """
    strand_flag = {"unstranded": "0",
                   "firststrand": "2",
                   "secondstrand": "1"}
    stranded =  get_in(config, ("algorithm", "strandedness"),
                       "unstranded").lower()

Tuesday 18 August 2015

XSLT: Output "&"

"&& \" produces " && \".

XSLT: Mode in and

Modal XSLT

XSLT: Rule Execution Order

Cited from XSLT Tutorial - Basics

"""
You have to understand that XSLT works down "depth-first" the XML tree, i.e.
  • it first deals with the rule for the root element,
  • then with the first instruction within this rule.
  • If the first instruction says "find other rules" it will then apply the first rule found for the first child element and so forth...
  • The rule of the root element is also the last one be finished (since it must deal step-by-step with everything that is found inside) !!!
"""

"By default the first one is applied. Since the XSLT processor only will apply one rule per element and also the most complex one."

Monday 17 August 2015

RNA-seq, ChIP-seq, ATAC-seq Paper

Chromatin state dynamics during blood formation

Tissue-Resident Macrophage Enhancer Landscapes Are Shaped
by the Local Microenvironment

Sunday 16 August 2015

Make: Empty Command

Cited from Commands

"Empty commands are most often used to prevent a pattern rule from matching the target and executing commands you don’t want."

Make: Multiline Macro

Cited from Commands

"When a multiline macro is expanded, each line is inserted into the command script with a leading tab and make treats each line independently. The lines of the macro are not executed in a single subshell. So you willneed to pay attention to command-line continuation in macros as well."

Saturday 15 August 2015

Differences Between Fork and Exec

Cited from Differences between exec and fork

"A process is an execution environment that consists of instruction, user-data, and system-data segments, as well as lots of other resources acquired at runtime, whereas a program is a file containing instructions and data that are used to initialize the instruction and user-data segments of a process."

"""
  • fork() creates a duplicate of the current process
  • exec() replaces the program in the current process with another program
"""

Archive File

Cited from Managing Modularity: Makefiles and Libraries 

"When we have a collection of functions which often use, it is convenient to collect their compiled versions into a library archive file."

Friday 14 August 2015

Make: Eval Function

Cited from Functions

"Using eval resolves the parsing issue because eval handles the multiline macro expansion and itself expands to zero lines."

"The argument to eval is expanded twice: once when when make pre-pares the argument list for eval, and once again by eval."

Make: Export Multiple Target-specific Variables

all: export A=TEST
all: export B=OK

all:
    @echo A is $$A
    @echo B is $$B

Bash: Remove Non-printable ASCII Characters From a File

Remove non-printable ASCII characters from a file with this simple Unix command

Thursday 13 August 2015

Make: Environment Variables

Cited from Variables from the Environment

"Variables in make can come from the environment in which make is run. Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value. However, an explicit assignment in the makefile, or with a command argument, overrides the environment. (If the ‘-e’ flag is specified, then values from the environment override assignments in the makefile. See Summary of Options. But this is not recommended practice.)"

=======================================
Cited from The Basics: Getting environment variables into GNU Make

"The override directive beats the command line which beats environment overrides (-e option) which beats macros defined in a Makefile file which beats the original environment."

 

Bash: Shell Globbing

Globs

Linux: Date Command

7 Linux Date Command Examples to Display and Set System Date Time

Bash: Multiple Commands in One Line

Cited from Which one is better: using ; or && to execute multiple commands in one line?

"
A; B = Run A and then B, regardless of success of A
A && B = Run B if A succeeded
A || B = Run B if A failed
A & = Run A in background.
"


Wednesday 12 August 2015

make -f-

Cited from make

"-f makefile
Use the description file makefile. If the pathname is the dash character (-), the standard input is used. If there are multiple instances of this option, they are processed in the order specified."

For example,
make -f- FOO=bar <<< 'goal:;@echo $(MAKECMDGOALS)'

====================================
Cited from Variables and Macros

'The stdin is redirected from a command-line string using bash's
here string, “<<<”, syntax.'

Make: MAKEFILE_LIST

Cited from Variables and Macros

"A makefile can always determine its own name by examining the lastword of the list stored in the variable of MAKEFILE_LIST."

Make: Set Default Goal Using .DEFAULT_GOAL

Cited from Other Special Variables

".DEFAULT_GOAL: Sets the default goal to be used if no targets were specified on the command line. Note that assigning more than one target name to .DEFAULT_GOAL is invalid and will result in an error."

Make: Goal

Cited from Arguments to Specify the Goals

"The goals are the targets that make should strive ultimately to update. Other targets are updated as well if they appear as prerequisites of goals, or prerequisites of prerequisites of goals, etc."

"By default, the goal is the first target in the makefile (not counting targets that start with a period). Therefore, makefiles are usually written so that the first target is for compiling the entire program or programs they describe. If the first rule in the makefile has several targets, only the first target in the rule becomes the default goal, not the whole list. You can manage the selection of the default goal from within your makefile using the .DEFAULT_GOAL variable"

"You can also specify a different goal or goals with command line arguments to make. Use the name of the goal as an argument. If you specify several goals, make processes each of them in turn, in the order you name them."

"Make will set the special variable MAKECMDGOALS to the list of goals you specified on the command line."


Make: Phony Targets

Cited from Phony Targets

"A phony target should not be a prerequisite of a real target file; if it is, its recipe will be run every time make goes to update that file. As long as a phony target is never a prerequisite of a real target, the phony target recipe will be executed only when the phony target is a specified goal."

For example, the phony target of "clean" is a not specified goal, and therefore not executed.

din:=/home/cornell/

.PHONY : listfile clean

listfile: $(din)
    ls -lt $^

clean :
    -rm ./test/test.txt

Phony targets can have prerequisites. For example, when the prerequisites are individual programs, the call to an overall phony target will cause the execution of individual programs.

For example, both rules of action1 and action2 will be executed.

d1:=/home/cornell/
d2:=/home/cornell/test

all: action1 action2
.PHONY : all

action1: $(d1)
    ls -lt $^

action2: $(d2)
    rm -rf $^

Tuesday 11 August 2015

Make: Patterm Matching Stem

Cited from How Patterns Match

"When the target pattern does not contain a slash (and it usually does not), directory names in the file names are removed from the file name before it is compared with the target prefix and suffix. After the comparison of the file name to the target pattern, the directory names, along with the slash that ends them, are added on to the prerequisite file names generated from the pattern rule’s prerequisite patterns and the file name. The directories are ignored only for the purpose of finding an implicit rule to use, not in the application of that rule. Thus, ‘e%t’ matches the file name src/eat, with ‘src/a’ as the stem. When prerequisites are turned into file names, the directories from the stem are added at the front, while the rest of the stem is substituted for the ‘%’. The stem ‘src/a’ with a prerequisite pattern ‘c%r’ gives the file name src/car."