annotate tools/genetrack/genetrack_indexer.py @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 #!/usr/bin/env python
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 """
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 Wraps genetrack.scripts.tabs2genetrack so the tool can be executed from Galaxy.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 usage: %prog input output shift
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 """
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 import sys, shutil, os
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 from galaxy import eggs
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 import pkg_resources
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 pkg_resources.require( "GeneTrack" )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 from genetrack.scripts import tabs2genetrack
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 from genetrack import logger
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 if __name__ == "__main__":
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 import os
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 os.environ[ 'LC_ALL' ] = 'C'
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 #os.system( 'export' )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 parser = tabs2genetrack.option_parser()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 options, args = parser.parse_args()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26 # uppercase the format
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
27 options.format = options.format.upper()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
28
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
29 if options.format not in ('BED', 'GFF'):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
30 sys.stdout = sys.stderr
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
31 parser.print_help()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
32 sys.exit(-1)
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
33
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
34 logger.disable(options.verbosity)
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
35
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
36 # missing file names
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
37 if not (options.inpname and options.outname and options.format):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
38 parser.print_help()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
39 sys.exit(-1)
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
40 else:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
41 tabs2genetrack.transform(inpname=options.inpname, outname=options.outname,\
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
42 format=options.format, shift=options.shift, index=options.index, options=options)