annotate data_path.py @ 4:82569b47df8d draft

planemo upload
author jowong
date Mon, 29 Oct 2018 07:52:12 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
82569b47df8d planemo upload
jowong
parents:
diff changeset
1 #!/usr/bin/env python
82569b47df8d planemo upload
jowong
parents:
diff changeset
2
82569b47df8d planemo upload
jowong
parents:
diff changeset
3 import sys
82569b47df8d planemo upload
jowong
parents:
diff changeset
4 import argparse as ap
82569b47df8d planemo upload
jowong
parents:
diff changeset
5
82569b47df8d planemo upload
jowong
parents:
diff changeset
6 parser = ap.ArgumentParser(prog='data_path', conflict_handler='resolve',
82569b47df8d planemo upload
jowong
parents:
diff changeset
7 description="Output the galaxy file path of datasets in a text file")
82569b47df8d planemo upload
jowong
parents:
diff changeset
8
82569b47df8d planemo upload
jowong
parents:
diff changeset
9 input = parser.add_argument_group('Input', '')
82569b47df8d planemo upload
jowong
parents:
diff changeset
10 input.add_argument('-i', '--input', nargs='+', required=True, help="Paths to data1")
82569b47df8d planemo upload
jowong
parents:
diff changeset
11 input.add_argument('-j', '--input2', nargs='*', required=True, help="Paths to data2")
82569b47df8d planemo upload
jowong
parents:
diff changeset
12
82569b47df8d planemo upload
jowong
parents:
diff changeset
13 if len(sys.argv) == 0:
82569b47df8d planemo upload
jowong
parents:
diff changeset
14 parser.print_usage()
82569b47df8d planemo upload
jowong
parents:
diff changeset
15 sys.exit(1)
82569b47df8d planemo upload
jowong
parents:
diff changeset
16
82569b47df8d planemo upload
jowong
parents:
diff changeset
17 args = parser.parse_args()
82569b47df8d planemo upload
jowong
parents:
diff changeset
18 output = open('paths.txt', 'w')
82569b47df8d planemo upload
jowong
parents:
diff changeset
19 if len(args.input2) == 0:
82569b47df8d planemo upload
jowong
parents:
diff changeset
20 for index,path in enumerate(args.input):
82569b47df8d planemo upload
jowong
parents:
diff changeset
21 output.write("%s\n" % (path))
82569b47df8d planemo upload
jowong
parents:
diff changeset
22 else:
82569b47df8d planemo upload
jowong
parents:
diff changeset
23 for index,path in enumerate(args.input):
82569b47df8d planemo upload
jowong
parents:
diff changeset
24 output.write("%s\t%s\n" % (path, args.input2[index]))