PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/genetrack/genetrack_indexer.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 42 lines | 23 code | 10 blank | 9 comment | 8 complexity | 69ba8cb3ca1b0b83d968098a825cafcf MD5 | raw file
 1#!/usr/bin/env python
 2
 3"""
 4Wraps genetrack.scripts.tabs2genetrack so the tool can be executed from Galaxy.
 5
 6usage: %prog input output shift
 7"""
 8
 9import sys, shutil, os
10from galaxy import eggs
11import pkg_resources
12pkg_resources.require( "GeneTrack" )
13
14from genetrack.scripts import tabs2genetrack
15from genetrack import logger
16
17if __name__ == "__main__":
18    import os
19    os.environ[ 'LC_ALL' ] = 'C' 
20    #os.system( 'export' )
21    
22    parser = tabs2genetrack.option_parser()
23
24    options, args = parser.parse_args()
25
26    # uppercase the format
27    options.format = options.format.upper()
28
29    if options.format not in ('BED', 'GFF'):
30        sys.stdout = sys.stderr
31        parser.print_help()
32        sys.exit(-1)
33
34    logger.disable(options.verbosity)
35
36    # missing file names
37    if not (options.inpname and options.outname and options.format):
38        parser.print_help()
39        sys.exit(-1)
40    else:
41        tabs2genetrack.transform(inpname=options.inpname, outname=options.outname,\
42            format=options.format, shift=options.shift, index=options.index, options=options)