Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
#!/usr/bin/python |
| 2 |
|
| 3 |
import sys |
| 4 |
import math |
| 5 |
|
| 6 |
def main(): |
| 7 |
|
| 8 |
progname = sys.argv[0] |
| 9 |
try: |
| 10 |
infileName = sys.argv[1] |
| 11 |
except ValueError: |
| 12 |
sts.exit("usage: %s INFILE" % progname) |
| 13 |
|
| 14 |
# open infile |
| 15 |
infile = open(infileName, 'r') |
| 16 |
|
| 17 |
seqCount = 0 |
| 18 |
goCount = 0 |
| 19 |
seqWithOneGo = 0 |
| 20 |
|
| 21 |
# deriving the needed numbers |
| 22 |
for line in infile: |
| 23 |
if line.startswith('>'): |
| 24 |
seqCount += 1 |
| 25 |
gos = line.split(',') |
| 26 |
if len(gos) == 1: |
| 27 |
seqWithOneGo += 1 |
| 28 |
goCount += len(gos) |
| 29 |
|
| 30 |
# close infile |
| 31 |
infile.close() |
| 32 |
|
| 33 |
# calculating the statistics |
| 34 |
goPerSeqDiam = float(goCount) / float(seqCount) |
| 35 |
goPerSeqDiam = round(goPerSeqDiam , 3) |
| 36 |
goPerSeqDiamFloored = int(math.floor(goPerSeqDiam)) |
| 37 |
|
| 38 |
# output of the statistics |
| 39 |
print("%s protein sequences with GO term found" % seqCount) |
| 40 |
print("%s protein sequences with just one GO found" % seqWithOneGo) |
| 41 |
print("%(goPSDF)s GOs per sequence averagely found (%(goPSD)s)" % { |
| 42 |
'goPSDF': goPerSeqDiamFloored, |
| 43 |
'goPSD': goPerSeqDiam}) |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
if __name__ == "__main__": |
| 48 |
try: |
| 49 |
main() |
| 50 |
except KeyboardInterrupt: |
| 51 |
pass |