Mercurial > repos > devteam > basecoverage
comparison gops_basecoverage.py @ 3:0a3e3133b09d draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author | devteam |
---|---|
date | Wed, 11 Nov 2015 12:47:11 -0500 |
parents | 1e6a9e97fa41 |
children | 2cedec3759e4 |
comparison
equal
deleted
inserted
replaced
2:b8a9e718caa3 | 3:0a3e3133b09d |
---|---|
4 | 4 |
5 usage: %prog in_file out_file | 5 usage: %prog in_file out_file |
6 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file | 6 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file |
7 """ | 7 """ |
8 | 8 |
9 import sys, traceback, fileinput | 9 import fileinput |
10 from warnings import warn | 10 import sys |
11 from bx.intervals import * | 11 from bx.intervals.io import NiceReaderWrapper |
12 from bx.intervals.io import * | 12 from bx.intervals.operations.base_coverage import base_coverage |
13 from bx.intervals.operations.base_coverage import * | |
14 from bx.cookbook import doc_optparse | 13 from bx.cookbook import doc_optparse |
15 from galaxy.tools.util.galaxyops import * | 14 from bx.tabular.io import ParseError |
15 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped | |
16 | 16 |
17 assert sys.version_info[:2] >= ( 2, 4 ) | 17 assert sys.version_info[:2] >= ( 2, 4 ) |
18 | 18 |
19 | |
19 def main(): | 20 def main(): |
20 upstream_pad = 0 | |
21 downstream_pad = 0 | |
22 | |
23 options, args = doc_optparse.parse( __doc__ ) | 21 options, args = doc_optparse.parse( __doc__ ) |
24 try: | 22 try: |
25 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 ) | 23 chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols1 ) |
26 in_fname, out_fname = args | 24 in_fname, out_fname = args |
27 except: | 25 except: |
28 doc_optparse.exception() | 26 doc_optparse.exception() |
29 | 27 |
30 g1 = NiceReaderWrapper( fileinput.FileInput( in_fname ), | 28 g1 = NiceReaderWrapper( fileinput.FileInput( in_fname ), |
31 chrom_col=chr_col_1, | 29 chrom_col=chr_col_1, |
32 start_col=start_col_1, | 30 start_col=start_col_1, |
33 end_col=end_col_1, | 31 end_col=end_col_1, |
34 strand_col = strand_col_1, | 32 strand_col=strand_col_1, |
35 fix_strand=True ) | 33 fix_strand=True ) |
36 | 34 |
37 try: | 35 try: |
38 bases = base_coverage(g1) | 36 bases = base_coverage(g1) |
39 except ParseError, exc: | 37 except ParseError, exc: |
40 fail( "Invalid file format: %s" % str( exc ) ) | 38 fail( "Invalid file format: %s" % str( exc ) ) |
41 out_file = open( out_fname, "w" ) | 39 out_file = open( out_fname, "w" ) |