Tuesday, November 8, 2016

Windows command line: pipe command output to second command

for /F "tokens=*" %i in ('temperature') do prismcom.exe usb %i
If running in a batch file, use %%i instead of just %i (in both places).

Reference
http://stackoverflow.com/questions/14574170/how-do-i-use-a-pipe-to-redirect-the-output-of-one-command-to-the-input-of-anothe

Thursday, September 1, 2016

Cut a particular column and concatenate using shell commands

Eg, to extract the first column (tab delimited) starting from the 2nd line, and concatenate output using comma:
tail -n +2 file | cut -f1 | paste -sd,

Friday, July 1, 2016

Mapping NGS data: which genome version to use?

See this nice blog for how to choose which genome version for NGS data analysis:
http://genomespot.blogspot.com/2015/06/mapping-ngs-data-which-genome-version.html

It is recommended to use Ensembl rather than UCSC or NCBI annotation. For Ensembl genome files, primary assembly is preferred than toplevel as the latter contained haplotype sequences which are not properly handled by the current sequencing mappers.

Tuesday, June 21, 2016

Empirical Bayes in Large Scale Inference

Large-Scale Inference: Empirical Bayes Methods for Estimation, Testing, and Prediction

Author: Bradley Efron, Stanford University, California
http://statweb.stanford.edu/~ckirby/brad/LSI/monograph_CUP.pdf

Friday, June 17, 2016

Recursive update of hypergeometric distribution

Recursively update dhyper(x,a,N-a,b):
dhyper(x,a+1,N-a-1,b)=dhyper(x,a,N-a,b) * ((a+1)/(a+1-x)) * ((N-a-b+x) /(N-a))
dhyper(x,a,N-a,b)=dhyper(x,a-1,N-a+1,b) * (a/(a-x)) * ((N-a+1-b+x) /(N-a+1))
dhyper(x+1,a,N-a,b)=dhyper(x,a,N-a,b) * ((a-x)/(x+1)) * ((b-x) /(N-a-b+x+1))
dhyper(x,a,N-a,b)=dhyper(x-1,a,N-a,b) * ((a-x+1)/x) * ((b-x+1) /(N-a-b+x))
dhyper(x+1,a+1,N-a-1,b)=dhyper(x,a,N-a,b) *  ((a+1)/(x+1)) * ((b-x)/(N-a))

Reference: see dhyper in R package.

Friday, May 27, 2016

Set environment variables during configure

See AkiRoss's post in
http://stackoverflow.com/questions/2537271/compile-openssl-with-the-shared-option
 
Example, set CFLAGS
CFLAGS=-fPIC ./config shared --prefix=/your/path

Thursday, May 5, 2016

Set compiler library path

Make GNU programs use a configure file to test whether requirements are met/available by looking in the system default locations. In many cases, the desired libraries or tools are not installed in the system default paths. As a consequence, configure test would fail. To tell the configure script where to look for, in addition to default locations, we can set several important environment variables. Eg,

export CPPFLAGS='-I/path/to/include'
export LDFLAGS='-L/path/to/lib'
./configure
make


To check a list of environment variables, try

./configure --help
which will detail environment variables that are configurable.

Wednesday, March 16, 2016

Specify gcc path for cmake

To specify gcc path for cmake, export environment variables CC and CXX before calling cmake:

export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++
cmake path_to_project
make