Mercurial > repos > mvdbeek > docker_scriptrunner
annotate test-data/tf2_test_runme.py @ 2:495946ffc2d6 draft default tip
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit dded837d19aeb3f06b84e5076282cedeeaf713fa
author | mvdbeek |
---|---|
date | Sun, 22 Jul 2018 13:38:01 -0400 |
parents | 21d312776891 |
children |
rev | line source |
---|---|
0
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
1 # bog standard argparse for 3 possible comma separated lists |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
2 # followed by some silly reverse each row code provided as an example |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
3 # you're supposed to replace it with your great code.. |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
4 import argparse |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
5 import copy |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
6 |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
7 argp = argparse.ArgumentParser() |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
8 argp.add_argument('--INNAMES', default=None) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
9 argp.add_argument('--INPATHS', default=None) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
10 argp.add_argument('--OUTPATH', default=None) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
11 argp.add_argument('--additional_parameters', default=[], action="append") |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
12 argp.add_argument('otherargs', nargs=argparse.REMAINDER) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
13 args = argp.parse_args() |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
14 fout = open(args.OUTPATH, 'w') |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
15 sins = open(args.INPATHS.split(',')[0]).readlines() |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
16 for i, sin in enumerate(sins): |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
17 row = sin.strip().split('\t') |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
18 rrow = copy.copy(row) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
19 lrow = len(row) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
20 if (lrow > 1): |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
21 for j in range(lrow): |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
22 rrow[j] = row[lrow - j - 1] |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
23 fout.write('\t'.join(rrow)) |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
24 fout.write('\n') |
21d312776891
planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff
changeset
|
25 fout.close() |