Tuesday, October 27, 2015

Read nth line from a text file using sed

To read a particular line (eg 10-th line) from a text file and split by delimiter into an array
Array=(`sed -n "10{p;q;}" file.txt`)

Friday, October 9, 2015

Determine Whether Two Regions Overlap

Say we have two genomic regions (x1,x2) and (y1,y2) from the same chromosome. The simplest way to check whether the two regions overlap is perhaps testing:
x1 <= y2 && y1 <= x2
assuming x1 <= x2 and y1 <= y2.

Reference:
http://stackoverflow.com/questions/3269434/whats-the-most-efficient-way-to-test-two-integer-ranges-for-overlap

How to choose between AUC PR and AUC ROC?

An excellent discussion on the topic or PR vs ROC:
https://www.kaggle.com/forums/f/15/kaggle-forum/t/7517/precision-recall-auc-vs-roc-auc-for-class-imbalance-problems/41179

Tuesday, October 6, 2015

R: calling C from FORTRAN and vice versa

http://www.hep.by/gnu/r-patched/r-exts/R-exts_136.html

http://users.stat.umn.edu/~geyer/rc/