-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
60 lines (43 loc) · 2.16 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import argparse
import os
from shutil import copyfile
#immuneml --inputs file1 file2 file3 --output_dir /some/path --yaml_path abc.yml --metadata abc.csv --tool galaxy_yaml_tool
def get_args():
parser = argparse.ArgumentParser(description='Tool for detecting known and novel MicroRNAs')
parser.add_argument('-o', '--output_dir', help='Output directory', default='.', required=True)
parser.add_argument('-i', '--inputs', help='Input directory', default='.', required=True, nargs='+')
parser.add_argument('-y', '--yaml', help='Yaml input', default='.', required=True)
parser.add_argument('-m', '--metadata', help='Metadata input', default='.', required=False)
parser.add_argument('-t', '--tool', help='Tool', default='.', required=False)
return parser.parse_args()
def main():
print('main')
args = get_args()
print(args.output_dir)
print(args.inputs)
#os.mkdir(args.output_dir)
i = 0
html_files_links = ''
for f in args.inputs:
filename = str(i) + '.txt'
copyfile(f, os.path.join(args.output_dir, str(i) + '.txt'))
i += 1
html_files_links += '<li><a href="' + filename + '" title="' + filename + '">Input file ' + str(i) + '</a></li>'
copyfile(args.yaml, os.path.join(args.output_dir, 'yaml_file.txt'))
copyfile(args.metadata, os.path.join(args.output_dir, 'metadata_file.txt'))
copyfile('pipout.txt', os.path.join(args.output_dir, 'pipout.txt'))
copyfile('immuneout.txt', os.path.join(args.output_dir, 'immuneout.txt'))
html_files_links += '<li><a href="yaml_file.txt" title="YAML file">YAML file</a></li>'
html_files_links += '<li><a href="metadata_file.txt" title="Metadata file">Metadata file</a></li>'
html_files_links += '<li><a href="pipout.txt" title="Pip output">Pip output</a></li>'
html_files_links += '<li><a href="immuneout.txt" title="ImmuneML output">ImmuneML output</a></li>'
html_output = open(os.path.join(args.output_dir, 'output.html'), 'w')
html_test = '''<nav>
<ul>'''
html_test += html_files_links
html_test += '''</ul>
</nav>'''
html_output.write(html_test)
html_output.close()
if __name__ == '__main__':
main()