Skip to content

Instantly share code, notes, and snippets.

@terrycojones
Created December 4, 2013 13:19
Show Gist options
  • Save terrycojones/7787320 to your computer and use it in GitHub Desktop.
Save terrycojones/7787320 to your computer and use it in GitHub Desktop.
def _getRange(inputRange):
if inputRange is None:
return None
rangeRegex = compile(r'^(\d+)(?:-(\d+))?$')
ranges = []
match = rangeRegex.match(inputRange)
if match:
start, end = match.groups()
start = int(start)
if end is None:
end = start
else:
end = int(end)
if start > end:
start, end = end, start
ranges.append((start, end))
else:
print >>sys.stderr, (
'Illegal argument %r. Ranges must single numbers or '
'number-number.' % arg)
sys.exit(2)
return ranges
main(args.json, args.fasta, args.hitId, _getRange(args.xRange), _getRange(args.eRange))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment