comparison gops_cluster.py @ 5:2108e2dc3d32 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/cluster commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author devteam
date Thu, 22 Jun 2017 18:38:08 -0400
parents 1e895b74f29f
children
comparison
equal deleted inserted replaced
4:3231f921ba4f 5:2108e2dc3d32
7 -d, --distance=N: Maximum distance between clustered intervals 7 -d, --distance=N: Maximum distance between clustered intervals
8 -v, --overlap=N: Minimum overlap require (negative distance) 8 -v, --overlap=N: Minimum overlap require (negative distance)
9 -m, --minregions=N: Minimum regions per cluster 9 -m, --minregions=N: Minimum regions per cluster
10 -o, --output=N: 1)merged 2)filtered 3)clustered 4) minimum 5) maximum 10 -o, --output=N: 1)merged 2)filtered 3)clustered 4) minimum 5) maximum
11 """ 11 """
12 from __future__ import print_function
13
12 import fileinput 14 import fileinput
13 import sys 15 import sys
16
17 from bx.cookbook import doc_optparse
14 from bx.intervals.io import GenomicInterval, NiceReaderWrapper 18 from bx.intervals.io import GenomicInterval, NiceReaderWrapper
15 from bx.intervals.operations.find_clusters import find_clusters 19 from bx.intervals.operations.find_clusters import find_clusters
16 from bx.cookbook import doc_optparse
17 from bx.tabular.io import ParseError 20 from bx.tabular.io import ParseError
18 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped 21 from galaxy.tools.util.galaxyops import fail, parse_cols_arg, skipped
19 22
20 assert sys.version_info[:2] >= ( 2, 4 ) 23 assert sys.version_info[:2] >= ( 2, 4 )
21 24
48 fix_strand=True ) 51 fix_strand=True )
49 52
50 # Get the cluster tree 53 # Get the cluster tree
51 try: 54 try:
52 clusters, extra = find_clusters( g1, mincols=distance, minregions=minregions) 55 clusters, extra = find_clusters( g1, mincols=distance, minregions=minregions)
53 except ParseError, exc: 56 except ParseError as exc:
54 fail( "Invalid file format: %s" % str( exc ) ) 57 fail( "Invalid file format: %s" % str( exc ) )
55 58
56 f1 = open( in_fname, "r" ) 59 f1 = open( in_fname, "r" )
57 out_file = open( out_fname, "w" ) 60 out_file = open( out_fname, "w" )
58 61
107 g1.start_col, 110 g1.start_col,
108 g1.end_col, 111 g1.end_col,
109 g1.strand_col, 112 g1.strand_col,
110 g1.default_strand, 113 g1.default_strand,
111 g1.fix_strand ) 114 g1.fix_strand )
112 except Exception, exc: 115 except Exception as exc:
113 print >> sys.stderr, str( exc ) 116 print(str( exc ), file=sys.stderr)
114 f1.close() 117 f1.close()
115 sys.exit() 118 sys.exit()
116 interval_size = cluster_interval.end - cluster_interval.start 119 interval_size = cluster_interval.end - cluster_interval.start
117 if outsize == -1 or \ 120 if outsize == -1 or \
118 ( outsize > interval_size and output == 4 ) or \ 121 ( outsize > interval_size and output == 4 ) or \
123 126
124 f1.close() 127 f1.close()
125 out_file.close() 128 out_file.close()
126 129
127 if g1.skipped > 0: 130 if g1.skipped > 0:
128 print skipped( g1, filedesc="" ) 131 print(skipped( g1, filedesc="" ))
132
129 133
130 if __name__ == "__main__": 134 if __name__ == "__main__":
131 main() 135 main()