Created
January 27, 2017 11:36
-
-
Save tleonardi/2b9a89f52070e838f2d52aa316f5ce73 to your computer and use it in GitHub Desktop.
Converts DAVID functional annotations to html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converts a tab-separated file containing | |
# DAVID's functional annotation results to | |
# Markdown format | |
# It reports: KEGG and GO terms along with | |
# the gene symbol and name | |
FILE= | |
cut -f 1,2,5,6,7,9 $FILE | awk ' | |
BEGIN{OFS=FS="\t"}NR>1{ | |
print "#"$1 | |
print "##Gene name\n"$2 | |
print "\n" | |
print "###Biological process" | |
print "\n" | |
gsub(/,[ ]{0,1}GO:/, ";GO:", $3); | |
gsub(/,$/, ";", $3); | |
for(i=1; i<split($3,a,";");i++){ | |
print "* "a[i] | |
} | |
print "\n" | |
print "\n" | |
print "###Cellular component" | |
print "\n" | |
gsub(/,[ ]{0,1}GO:/, ";GO:", $4); | |
gsub(/,$/, ";", $4); | |
for(i=1; i<split($4,a,";");i++){ | |
print "* "a[i] | |
} | |
print "\n" | |
print "\n" | |
print "###Molecular Function" | |
print "\n" | |
gsub(/,[ ]{0,1}GO:/, ";GO:", $5); | |
gsub(/,$/, ";", $5); | |
for(i=1; i<split($5,a,";");i++){ | |
print "* "a[i] | |
} | |
print "\n" | |
print "\n" | |
print "###KEGG pathway" | |
print "\n" | |
for(i=1; i<split($6,a,",");i++){ | |
print "* "a[i] | |
} | |
print "\n* * *\n" | |
}' > ${FILE}.md | |
pandoc ${FILE}.md -o ${FILE}.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment