
import optparse
import re

import sys


parser = optparse.OptionParser()
parser.add_option("-i", "--interesting_in", action = "store", type = "string", dest = "interesting_in", help = 'interesting fusions')
parser.add_option("-o", "--out", action = "store", type = "string", dest = "out", help = 'out')
(options, args) = parser.parse_args()



PATH_TO_IN = options.interesting_in
#PATH_TO_CHIMERA = options.chimerascan_output_original
#PATH_TO_DEFUSE = options.defuse_output_original
PATH_TO_OUT = options.out

try:
    f_input = open(PATH_TO_IN, 'r')
except IOError, (errno, strerror):
    print "I/O error(%d): %s" % (errno, strerror)
    sys.exit(0)
try:
    f_out = open(PATH_TO_OUT, 'w')
except IOError, (errno, strerror):
    print "I/O error(%d): %s" % (errno, strerror)
    sys.exit(0)

for i in f_input:
    list2 = i.split(" ")
    if (list2[0][0:4] == '@ERR'):
        f_out.write("@" + list2[1] + "/1" + "\n")
    elif (list2[0][0:4] == '+ERR'):           
        list2 = i.split(" ")
        f_out.write("+" + list2[1] + "/1" + "\n")
    else:
        f_out.write(i)
