# HG changeset patch # User Henry S. Thompson # Date 1700855534 0 # Node ID d88c8d40259a9a5a8172261d1f3de6eaa774ecbd # Parent 10c87f5c704d66c2f3eb1177c64a73dfb769d449 put results in numbered subdirs diff -r 10c87f5c704d -r d88c8d40259a lib/python/cc/per_segment.py --- a/lib/python/cc/per_segment.py Fri Nov 24 19:50:12 2023 +0000 +++ b/lib/python/cc/per_segment.py Fri Nov 24 19:52:14 2023 +0000 @@ -6,7 +6,7 @@ Segment column is 0-origin ''' -import sys +import sys,os c=int(sys.argv[1]) @@ -29,7 +29,11 @@ # note this won't work if c is last column! for s in range(100): - with open('s%s.tsv'%s,'w') as f: + try: + os.mkdir(str(s)) + except FileExistsError: + pass + with open('%s/ks.tsv'%s,'w') as f: for (l,c) in sorted(ss[s].items(),key=lambda p:p[1],reverse=True): f.write(str(c)) f.write('\t')