comparison gops_intersect.py @ 5:33b3f3688db4 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author devteam
date Thu, 22 Jun 2017 18:52:23 -0400
parents 5f72be09cfd3
children
comparison
equal deleted inserted replaced
4:8ddabc73af92 5:33b3f3688db4
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.intersect import intersect 21 from bx.intervals.operations.intersect import intersect
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():
78 out_file.write( "%s\n" % "\t".join( interval.fields ) ) 82 out_file.write( "%s\n" % "\t".join( interval.fields ) )
79 elif isinstance( feature, GenomicInterval ): 83 elif isinstance( feature, GenomicInterval ):
80 out_file.write( "%s\n" % "\t".join( feature.fields ) ) 84 out_file.write( "%s\n" % "\t".join( feature.fields ) )
81 else: 85 else:
82 out_file.write( "%s\n" % feature ) 86 out_file.write( "%s\n" % feature )
83 except ParseError, e: 87 except ParseError as e:
84 out_file.close() 88 out_file.close()
85 fail( "Invalid file format: %s" % str( e ) ) 89 fail( "Invalid file format: %s" % str( e ) )
86 90
87 out_file.close() 91 out_file.close()
88 92
89 if g1.skipped > 0: 93 if g1.skipped > 0:
90 print skipped( g1, filedesc=" of 1st dataset" ) 94 print(skipped( g1, filedesc=" of 1st dataset" ))
91 if g2.skipped > 0: 95 if g2.skipped > 0:
92 print skipped( g2, filedesc=" of 2nd dataset" ) 96 print(skipped( g2, filedesc=" of 2nd dataset" ))
97
93 98
94 if __name__ == "__main__": 99 if __name__ == "__main__":
95 main() 100 main()