Skip to content

Instantly share code, notes, and snippets.

@daler
Created April 14, 2010 15:33
Show Gist options
  • Save daler/365946 to your computer and use it in GitHub Desktop.
Save daler/365946 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
usage = """
Ensures start/stop coords in a BED file are integers
and not in exponential notation (like 9.3e+07)
Usage:
python fix_coords.py input.bed > fixed.bed
"""
import sys
if len(sys.argv)<2:
print usage
sys.exit()
for line in open(sys.argv[1]):
L = line.strip().split('\t')
start = float(L[1])
stop = float(L[2])
L[1] = '%d' % start
L[2] = '%d' % stop
sys.stdout.write('\t'.join(L)+'\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment