comparison annotation_collector.py @ 0:800bbe50ad70 draft default tip

planemo upload for repository https://bitbucket.org/drosofff/gedtools/
author drosofff
date Mon, 29 Jun 2015 03:39:57 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:800bbe50ad70
1 #!/usr/bin/env python
2 #By, drosofff@gmail.com
3 # command: annotation_collector.py $output input1, label1, input2, label2, etc...
4
5 import sys, os
6
7 def countlineinfile(file):
8 F = open (file, "r")
9 count = 0
10 for line in F:
11 count += 1
12 F.close()
13 return count/2
14 results = []
15
16 for file, label in zip (sys.argv[2:-1:2], sys.argv[3:-1:2]):
17 results.append ( (countlineinfile(file), label) )
18
19 Fout = open (sys.argv[1], "w")
20
21 print >> Fout, "# %s" % (sys.argv[-1])
22 for filecount, label in results:
23 print >> Fout, "%s\t%s\t%.2f %%" % (label, filecount, filecount/float(results[0][0])*100 )
24 print >> Fout
25 Fout.close()