I’ve made a few updates to the post about storing column locations, based on some input from a colleague.
Anyone who works in data analysis knows that any assumptions that you make about the formatting of the data that you receive are bound to be wrong. (Read: Assume the data came from a caveman, just to be safe.)
At a minimum, even if everything else is perfect (unlikely), the column names are probably not in the same order in every data set. So, rather than looking up the column number every time, I use the following line to store the number of the column of interest — in this case the “Chr” (chromosome) column — for later use throughout the script. It’s pretty basic, but super useful:
Here’s what’s happening:
sed "s/r//g" $DATAFILE– strip out any weird Windows carriage returns
head -n1– look only at the first (header) line
sed 's/t/n/g'– replace all tab characters with…
View original post 155 more words