Hi, I'm currently using The Biostar Handbook 2nd Edition. I need some lines of code from the page 273, that correspond to the goatools package, but the line is so long it doesn´t fit in the page, so there is some part of the code missing. It says:
:# Linearize the file with one ID and multiple GO terms on each line.
cat pairs.txt | awk '{if(a[$1])a[$1]=a[$1]";"$2; else a[$1]=$2;} END {for (i in a) print....
After the word "print" there is nothing else. I really need to know how to find this missing part. Does this appear somewhere else, or there is a new version of the book? Please, help...
1 answer
The PDF in general is not to be used for the code, it is not wrapping the code correctly and some characters may be present as Unicode, tabs may be turned into spaces etc.
Use the website to read the code you can easily scroll the code examples in the browser. This particular example reads (you need to scroll the code below :-) ):
# Linearize the file with one ID and multiple GO terms on each line.
cat pairs.txt | awk '{if (a[$1]) a[$1] = a[$1]";"$2; else a[$1]=$2;} END {for (i in a) print i, a[i];}' > association
Log in to answer this question.
Istvan Albert
I Imagine it's something like: