0
|
1 from argparse import ArgumentParser
|
|
2 import os
|
|
3 from vhom import RegionRunner
|
|
4
|
|
5
|
|
6 def printDir(directory):
|
|
7 rval=["<ul>"]
|
|
8 flist = os.listdir(directory)
|
|
9
|
|
10 for entry in flist:
|
|
11 if(os.path.isdir(os.path.join(directory,entry))):
|
|
12 rval.append('<li>%s</li>'%entry)
|
|
13 rval.extend(printDir(os.path.join(directory,entry)))
|
|
14 else:
|
|
15 rval.append( '<li><a href="%s">%s</a></li>' % ( os.path.join(directory,entry), entry) )
|
|
16 rval.append("</ul>")
|
|
17 return rval
|
|
18
|
|
19
|
|
20
|
|
21 if __name__ == "__main__":
|
|
22
|
|
23
|
|
24 parser = ArgumentParser()
|
|
25
|
|
26 a = parser.add_argument
|
|
27 a("-o","--html_file",dest="html_file")
|
|
28 a("-d","--directory",dest="directory")
|
|
29
|
|
30 (options,args)= parser.parse_known_args()
|
|
31
|
|
32 args.insert(0,"dummy")
|
|
33 try:
|
|
34 RegionRunner.run(argv=args)
|
|
35 except SystemExit:
|
|
36 f = open(options.html_file,'w')
|
|
37 rval = ["<html><head><title>Homologous groups and regions derived from hit files </title></head><body><p/>\n"]
|
|
38 rval.append('<div>This composite dataset is composed of the following files:<p/>')
|
|
39 directory= options.directory
|
|
40 rval.extend(printDir(directory))
|
|
41
|
|
42 rval.append( '</body></html>' )
|
|
43
|
|
44 f.write("\n".join( rval ))
|
|
45 f.close()
|