Mercurial > repos > devteam > coverage
comparison gops_coverage.py @ 4:ad25eb2c422d draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/coverage commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author | devteam |
---|---|
date | Thu, 22 Jun 2017 18:39:05 -0400 |
parents | 7b226a8a6722 |
children |
comparison
equal
deleted
inserted
replaced
3:1cefc6012ffd | 4:ad25eb2c422d |
---|---|
5 | 5 |
6 usage: %prog bed_file_1 bed_file_2 out_file | 6 usage: %prog bed_file_1 bed_file_2 out_file |
7 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file | 7 -1, --cols1=N,N,N,N: Columns for start, end, strand in first file |
8 -2, --cols2=N,N,N,N: Columns for start, end, strand in second file | 8 -2, --cols2=N,N,N,N: Columns for start, end, strand in second file |
9 """ | 9 """ |
10 from __future__ import print_function | |
11 | |
10 import fileinput | 12 import fileinput |
11 import sys | 13 import sys |
14 | |
15 from bx.cookbook import doc_optparse | |
12 from bx.intervals.io import GenomicInterval, NiceReaderWrapper | 16 from bx.intervals.io import GenomicInterval, NiceReaderWrapper |
13 from bx.intervals.operations.coverage import coverage | 17 from bx.intervals.operations.coverage import coverage |
14 from bx.cookbook import doc_optparse | |
15 from bx.tabular.io import ParseError | 18 from bx.tabular.io import ParseError |
16 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped | 19 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped |
17 | 20 |
18 assert sys.version_info[:2] >= ( 2, 4 ) | 21 assert sys.version_info[:2] >= ( 2, 4 ) |
19 | 22 |
46 for line in coverage( [g1, g2] ): | 49 for line in coverage( [g1, g2] ): |
47 if type( line ) is GenomicInterval: | 50 if type( line ) is GenomicInterval: |
48 out_file.write( "%s\n" % "\t".join( line.fields ) ) | 51 out_file.write( "%s\n" % "\t".join( line.fields ) ) |
49 else: | 52 else: |
50 out_file.write( "%s\n" % line ) | 53 out_file.write( "%s\n" % line ) |
51 except ParseError, exc: | 54 except ParseError as exc: |
52 out_file.close() | 55 out_file.close() |
53 fail( "Invalid file format: %s" % str( exc ) ) | 56 fail( "Invalid file format: %s" % str( exc ) ) |
54 | 57 |
55 out_file.close() | 58 out_file.close() |
56 | 59 |
57 if g1.skipped > 0: | 60 if g1.skipped > 0: |
58 print skipped( g1, filedesc=" of 1st dataset" ) | 61 print(skipped( g1, filedesc=" of 1st dataset" )) |
59 if g2.skipped > 0: | 62 if g2.skipped > 0: |
60 print skipped( g2, filedesc=" of 2nd dataset" ) | 63 print(skipped( g2, filedesc=" of 2nd dataset" )) |
64 | |
61 | 65 |
62 if __name__ == "__main__": | 66 if __name__ == "__main__": |
63 main() | 67 main() |