comparison test.py @ 0:629e7e403e19 draft

"planemo upload commit 2fed2858d4044a3897a93a5604223d1d183ceac0-dirty"
author immuneml
date Thu, 01 Jul 2021 11:36:43 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:629e7e403e19
1 import argparse
2 import os
3 from shutil import copyfile
4
5 #immuneml --inputs file1 file2 file3 --output_dir /some/path --yaml_path abc.yml --metadata abc.csv --tool galaxy_yaml_tool
6
7 def get_args():
8 parser = argparse.ArgumentParser(description='Tool for detecting known and novel MicroRNAs')
9 parser.add_argument('-o', '--output_dir', help='Output directory', default='.', required=True)
10 parser.add_argument('-i', '--inputs', help='Input directory', default='.', required=True, nargs='+')
11 parser.add_argument('-y', '--yaml', help='Yaml input', default='.', required=True)
12 parser.add_argument('-m', '--metadata', help='Metadata input', default='.', required=False)
13 parser.add_argument('-t', '--tool', help='Tool', default='.', required=False)
14
15 return parser.parse_args()
16
17
18 def main():
19 print('main')
20 args = get_args()
21
22 print(args.output_dir)
23 print(args.inputs)
24
25 #os.mkdir(args.output_dir)
26 i = 0
27 html_files_links = ''
28 for f in args.inputs:
29 filename = str(i) + '.txt'
30 copyfile(f, os.path.join(args.output_dir, str(i) + '.txt'))
31 i += 1
32 html_files_links += '<li><a href="' + filename + '" title="' + filename + '">Input file ' + str(i) + '</a></li>'
33
34 copyfile(args.yaml, os.path.join(args.output_dir, 'yaml_file.txt'))
35 copyfile(args.metadata, os.path.join(args.output_dir, 'metadata_file.txt'))
36 copyfile('pipout.txt', os.path.join(args.output_dir, 'pipout.txt'))
37 copyfile('immuneout.txt', os.path.join(args.output_dir, 'immuneout.txt'))
38 html_files_links += '<li><a href="yaml_file.txt" title="YAML file">YAML file</a></li>'
39 html_files_links += '<li><a href="metadata_file.txt" title="Metadata file">Metadata file</a></li>'
40 html_files_links += '<li><a href="pipout.txt" title="Pip output">Pip output</a></li>'
41 html_files_links += '<li><a href="immuneout.txt" title="ImmuneML output">ImmuneML output</a></li>'
42
43 html_output = open(os.path.join(args.output_dir, 'output.html'), 'w')
44
45 html_test = '''<nav>
46 <ul>'''
47
48 html_test += html_files_links
49 html_test += '''</ul>
50 </nav>'''
51 html_output.write(html_test)
52 html_output.close()
53
54
55 if __name__ == '__main__':
56 main()
57
58
59
60