|
Last change
on this file was
10371,
checked in by aboeckma, 12 years ago
|
|
updated mafft version. Added extensions (no svn ignore, yet)
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | ///////////////////////////////////////////////////////////////// |
|---|
| 2 | // MakeGnuPlot.cc |
|---|
| 3 | ///////////////////////////////////////////////////////////////// |
|---|
| 4 | |
|---|
| 5 | #include <iostream> |
|---|
| 6 | #include <fstream> |
|---|
| 7 | |
|---|
| 8 | using namespace std; |
|---|
| 9 | |
|---|
| 10 | int main (int argc, char **argv){ |
|---|
| 11 | |
|---|
| 12 | if (argc == 1 || argc > 3){ |
|---|
| 13 | cerr << "Usage: makegnuplot annotscores [refscores]" << endl; |
|---|
| 14 | exit (1); |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | ifstream data (argv[1]); |
|---|
| 18 | |
|---|
| 19 | if (data.fail()){ |
|---|
| 20 | cerr << "ERROR: Could not open file " << argv[1] << endl; |
|---|
| 21 | exit (1); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | int x, ct = 0; |
|---|
| 25 | while (data >> x) ct++; |
|---|
| 26 | data.close(); |
|---|
| 27 | |
|---|
| 28 | ofstream out ("temporary_gnuplot_script"); |
|---|
| 29 | |
|---|
| 30 | if (out.fail()){ |
|---|
| 31 | cerr << "ERROR: Could not create temporary file." << endl; |
|---|
| 32 | exit (1); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | out << "set title \"Column Reliability Scores\"" << endl |
|---|
| 36 | << "set xlabel \"Alignment Position\"" << endl |
|---|
| 37 | << "set ylabel \"Column Reliability\"" << endl |
|---|
| 38 | << "set xr [1:" << ct << "]" << endl |
|---|
| 39 | << "set term postscript enhanced color" << endl |
|---|
| 40 | << "set output \"reliability.ps\"" << endl; |
|---|
| 41 | |
|---|
| 42 | if (argc == 3){ |
|---|
| 43 | out << "set style fill solid 0.5 noborder" << endl |
|---|
| 44 | << "plot \"" << argv[2] << "\" title \"actual\" with boxes lt 2, \\" << endl |
|---|
| 45 | << " \"" << argv[1] << "\" title \"predicted\" with histeps lt 1 lw 3" << endl; |
|---|
| 46 | } |
|---|
| 47 | else |
|---|
| 48 | out << "plot \"" << argv[1] << "\" title \"predicted\" with histeps lt 1 lw 3" << endl; |
|---|
| 49 | |
|---|
| 50 | out.close(); |
|---|
| 51 | |
|---|
| 52 | if (system ("gnuplot temporary_gnuplot_script") == -1){ |
|---|
| 53 | cerr << "ERROR: Could not run Gnuplot correctly." << endl; |
|---|
| 54 | exit (1); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | //system ("rm temporary_gnuplot_script"); |
|---|
| 58 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.