page

Oct 25, 2019

R : EOF within quoted string - read.delim() vs read.table()

https://kbroman.org/blog/2017/08/08/eof-within-quoted-string/

read.table() uses quote="'\"" (that is, looking for either single- or double-quotes) read.delim() uses quote="\"" (just looking for double-quotes).


To solve quote problem,
In read.table(), use quote="", and for that matter also fill=FALSE 

Oct 14, 2019

SAM Format - SAM flags description

https://www.samformat.info/sam-format-flag-single


 SAM Format - SAM flags description

 - if you type in flag number, it shows descriptions of the flag number

transpose a file with awk

https://stackoverflow.com/questions/1729824/an-efficient-way-to-transpose-a-file-in-bash

Q. transpose a file

X column1 column2 column3
row1 0 1 2
row2 3 4 5
row3 6 7 8
row4 9 10 11

to

X row1 row2 row3 row4
column1 0 3 6 9
column2 1 4 7 10
column3 2 5 8 11
 
A.
 
awk '
{ 
    for (i=1; i<=NF; i++)  {
        a[NR,i] = $i
    }
}
NF>p { p = NF }
END {    
    for(j=1; j<=p; j++) {
        str=a[1,j]
        for(i=2; i<=NR; i++){
            str=str" "a[i,j]; # check FS (ex: space, tab, etc)
        }
        print str
    }
}' file

 

Oct 8, 2019

MATLAB - Data label on each point in xy scatter

https://stackoverflow.com/questions/7100398/data-label-on-each-entry-in-xy-scatter



p = rand(10,2);
scatter(p(:,1), p(:,2), 'filled')
axis([0 1 0 1])

labels = num2str((1:size(p,1))','%d');    %'
text(p(:,1), p(:,2), labels, 'horizontal','left', 'vertical','bottom','Fontsize', 7)