summaryrefslogtreecommitdiff
path: root/scripts/pa-tex-table.rb
blob: 840df1379535a7cf26b7331403979abcbf5da943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env ruby

puts '
\definecolor{red}{rgb}{1,0,0}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{green}{rgb}{0,1,0}
\definecolor{darkgreen}{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}
PubChem   & & \multicolumn{2}{c}{lazar} & \multicolumn{3}{c}{R} & \multicolumn{4}{c}{Tensorflow}\\\\
CID & 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,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 = cid
    if exp == "1"
      row += ' & \cellcolor{red}'
    elsif exp == "0"
      row += ' & \cellcolor{green}'
    else
      row += ' & \cellcolor{grey}'
    end
    if lazar_MP2D == "1" and lazar_MP2D_high_confidence == "F" 
      row += ' & \cellcolor{darkred}' 
    elsif lazar_MP2D == "1" and lazar_MP2D_high_confidence == "T" 
      row += ' & \cellcolor{red}'
    elsif lazar_MP2D == "0" and lazar_MP2D_high_confidence == "F" 
      row += ' & \cellcolor{darkgreen}' 
    elsif lazar_MP2D == "0" and lazar_MP2D_high_confidence == "T" 
      row += ' & \cellcolor{green}'
    else 
      row += ' & \cellcolor{grey}'
    end
    if lazar_PaDEL == "1"
      lazar_PaDEL_high_confidence == "F" ? row += ' & \cellcolor{darkred}' : row += ' & \cellcolor{red}'
    elsif lazar_PaDEL == "0"
      lazar_PaDEL_high_confidence == "F" ? row += ' & \cellcolor{darkgreen}' : 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
'