/usr/bin/bed_to_juncs is in tophat 2.1.1+dfsg1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/usr/bin/env python
# encoding: utf-8
"""
bed_to_juncs.py
Created by Cole Trapnell on 2008-09-19.
Copyright (c) 2008 Cole Trapnell. All rights reserved.
"""
import sys
import getopt
help_message = '''
This script converts junctions in BED format produced by TopHat to the
internal .juncs format for re-use with future runs.
Usage:
bed_to_juncs.py < junctions.bed
'''
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def main(argv=None):
if argv is None:
argv = sys.argv
try:
try:
opts, args = getopt.getopt(argv[1:], "h", ["help"])
except getopt.error, msg:
raise Usage(msg)
for option, value in opts:
if option in ("-h", "--help"):
raise Usage(help_message)
line_num = 0
for line in sys.stdin.readlines():
line = line.strip()
cols = line.split()
line_num += 1
if len(cols) < 12:
print >> sys.stderr, "Warning: malformed line %d, missing columns" % line_num
print >> sys.stderr, "\t", line
continue
chromosome = cols[0]
orientation = cols[5]
block_starts = [int(x) for x in cols[11].split(",")]
block_sizes = [int(x) for x in cols[10].split(",")]
left_pos = int(cols[1]) + block_starts[0] + block_sizes[0] - 1
right_pos = int(cols[1]) + block_starts[1]
#print "%s\t%d\t%d\t%s" % (chromosome, left_pos, right_pos, orientation)
counts = cols[4]
print "%s\t%d\t%d\t%s\t%s" % (chromosome, left_pos, right_pos, orientation, counts)
except Usage, err:
print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg)
print >> sys.stderr, "\t for help use --help"
return 2
if __name__ == "__main__":
sys.exit(main())
|