Biostars Handbook missing line of code
1
0
Entering edit mode
2.6 years ago

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...

goatools enrichment-analysis • 1.1k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

I Imagine it's something like:

(....) END {for (i in a) print i,a[i] }'
ADD REPLY
1
Entering edit mode
2.6 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 2004 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6