comparison gops_subtract.py @ 5:0145969324c4 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/subtract commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author devteam
date Thu, 22 Jun 2017 18:53:03 -0400
parents ecb36112b056
children
comparison
equal deleted inserted replaced
4:7a2a604ae9c8 5:0145969324c4
9 -m, --mincols=N: Require this much overlap (default 1bp) 9 -m, --mincols=N: Require this much overlap (default 1bp)
10 -p, --pieces: just print pieces of second set (after padding) 10 -p, --pieces: just print pieces of second set (after padding)
11 -G, --gff1: input 1 is GFF format, meaning start and end coordinates are 1-based, closed interval 11 -G, --gff1: input 1 is GFF format, meaning start and end coordinates are 1-based, closed interval
12 -H, --gff2: input 2 is GFF format, meaning start and end coordinates are 1-based, closed interval 12 -H, --gff2: input 2 is GFF format, meaning start and end coordinates are 1-based, closed interval
13 """ 13 """
14 from __future__ import print_function
15
14 import fileinput 16 import fileinput
15 import sys 17 import sys
18
19 from bx.cookbook import doc_optparse
16 from bx.intervals.io import GenomicInterval, NiceReaderWrapper 20 from bx.intervals.io import GenomicInterval, NiceReaderWrapper
17 from bx.intervals.operations.subtract import subtract 21 from bx.intervals.operations.subtract import subtract
18 from bx.cookbook import doc_optparse
19 from bx.tabular.io import ParseError 22 from bx.tabular.io import ParseError
20 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped 23 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped
21 from utils.gff_util import GFFFeature, GFFReaderWrapper, convert_bed_coords_to_gff 24
25 from utils.gff_util import convert_bed_coords_to_gff, GFFFeature, GFFReaderWrapper
22 26
23 assert sys.version_info[:2] >= ( 2, 4 ) 27 assert sys.version_info[:2] >= ( 2, 4 )
24 28
25 29
26 def main(): 30 def main():
79 out_file.write( "%s\n" % "\t".join( interval.fields ) ) 83 out_file.write( "%s\n" % "\t".join( interval.fields ) )
80 elif isinstance( feature, GenomicInterval ): 84 elif isinstance( feature, GenomicInterval ):
81 out_file.write( "%s\n" % "\t".join( feature.fields ) ) 85 out_file.write( "%s\n" % "\t".join( feature.fields ) )
82 else: 86 else:
83 out_file.write( "%s\n" % feature ) 87 out_file.write( "%s\n" % feature )
84 except ParseError, exc: 88 except ParseError as exc:
85 out_file.close() 89 out_file.close()
86 fail( "Invalid file format: %s" % str( exc ) ) 90 fail( "Invalid file format: %s" % str( exc ) )
87 91
88 out_file.close() 92 out_file.close()
89 93
90 if g1.skipped > 0: 94 if g1.skipped > 0:
91 print skipped( g1, filedesc=" of 2nd dataset" ) 95 print(skipped( g1, filedesc=" of 2nd dataset" ))
92 if g2.skipped > 0: 96 if g2.skipped > 0:
93 print skipped( g2, filedesc=" of 1st dataset" ) 97 print(skipped( g2, filedesc=" of 1st dataset" ))
98
94 99
95 if __name__ == "__main__": 100 if __name__ == "__main__":
96 main() 101 main()