/usr/lib/python2.7/dist-packages/metastudentPkg/lib/groupA/parser/group2_goStatistics.py is in metastudent 1.0.11-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/python
import sys
import math
def main():
progname = sys.argv[0]
try:
infileName = sys.argv[1]
except ValueError:
sts.exit("usage: %s INFILE" % progname)
# open infile
infile = open(infileName, 'r')
seqCount = 0
goCount = 0
seqWithOneGo = 0
# deriving the needed numbers
for line in infile:
if line.startswith('>'):
seqCount += 1
gos = line.split(',')
if len(gos) == 1:
seqWithOneGo += 1
goCount += len(gos)
# close infile
infile.close()
# calculating the statistics
goPerSeqDiam = float(goCount) / float(seqCount)
goPerSeqDiam = round(goPerSeqDiam , 3)
goPerSeqDiamFloored = int(math.floor(goPerSeqDiam))
# output of the statistics
print("%s protein sequences with GO term found" % seqCount)
print("%s protein sequences with just one GO found" % seqWithOneGo)
print("%(goPSDF)s GOs per sequence averagely found (%(goPSD)s)" % {
'goPSDF': goPerSeqDiamFloored,
'goPSD': goPerSeqDiam})
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass
|