Mercurial > repos > devteam > basecoverage
comparison gops_basecoverage.py @ 3:c929b6540d07 draft
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
author | devteam |
---|---|
date | Tue, 13 Oct 2015 12:49:07 -0400 |
parents | 3755ee8a74d7 |
children | 37652c34b3bf |
comparison
equal
deleted
inserted
replaced
2:057d57cf718d | 3:c929b6540d07 |
---|---|
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" ) |