|
1 |
| -#!/usr/bin/python |
| 1 | +##!/usr/bin/python3 |
| 2 | + |
| 3 | +# Copyright 2016-2021, André Müller < [email protected]> |
| 4 | +# |
| 5 | +# This file is part of the MetaCache taxonomic sequence classification tool. |
| 6 | +# |
| 7 | +# MetaCache is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation, either version 3 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# MetaCache is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License |
| 18 | +# along with MetaCache. If not, see <http://www.gnu.org/licenses/>. |
2 | 19 |
|
3 | 20 | import glob
|
4 | 21 | import re
|
5 | 22 | import sys
|
6 | 23 |
|
7 | 24 | if len(sys.argv) < 3:
|
8 |
| - print "usage: " + sys.argv[0] + " <input file pattern> <rank>" |
| 25 | + print("summarize classification results with ground truth") |
| 26 | + print("usage: " + sys.argv[0] + " <input file pattern> <rank>") |
9 | 27 | exit()
|
10 | 28 |
|
11 | 29 | inpattern = sys.argv[1]
|
@@ -37,9 +55,9 @@ for fname in fnames:
|
37 | 55 | if pad > 6:
|
38 | 56 | pad = pad - 6
|
39 | 57 |
|
40 |
| -print "Results on rank " + rank + ":" |
41 |
| -print "filename" + (" " * pad) \ |
42 |
| - + sep + "uncl" + sep + "clas" + sep + "prec" + sep + "sens" |
| 58 | +print("Results on rank " + rank + ":") |
| 59 | +print("filename" + (" " * pad) \ |
| 60 | + + sep + "uncl" + sep + "clas" + sep + "prec" + sep + "sens") |
43 | 61 |
|
44 | 62 |
|
45 | 63 | for fname in fnames:
|
@@ -95,11 +113,11 @@ for fname in fnames:
|
95 | 113 | if not parse_rank(line, sens):
|
96 | 114 | section = 7
|
97 | 115 |
|
98 |
| - # print str(section) + " -> " + line |
| 116 | + # print(str(section) + " -> " + line) |
99 | 117 |
|
100 | 118 | if section > 5:
|
101 |
| - print fname + " " \ |
| 119 | + print(fname + " " \ |
102 | 120 | + sep + str(round(float(uncl),2)) \
|
103 | 121 | + sep + str(round(float(clas[rank]),2)) \
|
104 | 122 | + sep + str(round(float(prec[rank]),2)) \
|
105 |
| - + sep + str(round(float(sens[rank]),2)) |
| 123 | + + sep + str(round(float(sens[rank]),2))) |
0 commit comments