annotate data_path.py @ 0:3afbada8e45a draft

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