diff options
Diffstat (limited to 'scripts/pa-tex-table.rb')
-rwxr-xr-x | scripts/pa-tex-table.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/pa-tex-table.rb b/scripts/pa-tex-table.rb new file mode 100755 index 0000000..06f7b26 --- /dev/null +++ b/scripts/pa-tex-table.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby + +puts ' +\definecolor{red}{rgb}{1,0,0} +\definecolor{lightred}{rgb}{0.5,0,0} +\definecolor{green}{rgb}{0,1,0} +\definecolor{lightgreen}{rgb}{0,0.5,0} +\definecolor{grey}{rgb}{0.5,0.5,0.5} +\tiny +\begin{longtable}{rcccccccccc} +\caption{Summary of pyrrolizidine alkaloid predictions: red: mutagen, green: non-mutagen, grey: no prediction, dark red/green: low confidence} \\\\ +\label{tab:pa} + & & \multicolumn{2}{c}{lazar} & \multicolumn{3}{c}{R} & \multicolumn{4}{c}{Tensorflow}\\\\ +ID & Measured & MP2D & PaDEL & DL & RF & SVM & LR-sgd & LR-scikit & NN & RF \\\\ +\hline +\renewcommand{\arraystretch}{0.075} +' +File.read(ARGV[0]).each_line do |l| + unless l.match("SMILES") + id,cid,name,smi,cansmi,exp,lazar_MP2D,lazar_MP2D_high_confidence,lazar_PaDEL,lazar_PaDEL_high_confidence,r_DL,r_RF,r_SVM,tf_lr_sgd,tf_lr_scikit,tf_NN,tf_RF = l.chomp.split(",") + row = id + if exp == "1" + row += ' & \cellcolor{red}' + elsif exp == "0" + row += ' & \cellcolor{green}' + else + row += ' & \cellcolor{grey}' + end + if lazar_MP2D == "1" + lazar_MP2D_high_confidence == "F" ? row += ' & \cellcolor{lightred}' : row += ' & \cellcolor{red}' + elsif lazar_MP2D == "0" + lazar_MP2D_high_confidence == "F" ? row += ' & \cellcolor{lightgreen}' : row += ' & \cellcolor{green}' + else + row += '& \cellcolor{grey} ' + end + if lazar_PaDEL == "1" + lazar_PaDEL_high_confidence == "F" ? row += ' & \cellcolor{lightred}' : row += ' & \cellcolor{red}' + elsif lazar_PaDEL == "0" + lazar_PaDEL_high_confidence == "F" ? row += ' & \cellcolor{lightgreen}' : row += ' & \cellcolor{green}' + else + row += ' & \cellcolor{grey}' + end + [r_DL,r_RF,r_SVM,tf_lr_sgd,tf_lr_scikit,tf_NN,tf_RF].each do |mut| + mut == "1" ? row += ' & \cellcolor{red}' : row += ' & \cellcolor{green}' + end + puts row + ' \\\\' + end +end +puts ' +\end{longtable} +\normalsize +' |