Beispiel #1
0
 def get_region_details(airport: airports.Airport) -> regions.Region:
     """
     returns: (regions.Region)
         iso_country: "NL"
         name: "Netherlands"
         region: "Europe"
         sub_region: "Western Europe"
     """
     r = regions.Regions()
     return r.lookup(airport.iso_country)
Beispiel #2
0
# import the necessary packages
import numpy as np
import argparse
import cv2
import regions

# regions.Regions(xIntercept, width, length, yIntercept, rows, columns)
regions = regions.Regions(50, 400, 400, 50, 3, 3)
videoCapture = cv2.VideoCapture(0)

while True:

    ret, image = videoCapture.read()
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    gray = cv2.blur(gray, (5, 5))

    # detect circles in the image
    circles = cv2.HoughCircles(gray, cv2.cv.CV_HOUGH_GRADIENT, 1.4, 30)

    # ensure at least some circles were founds
    if circles is not None:
        # convert the (x, y) coordinates and radius of the circles to integers
        circles = np.round(circles[0, :]).astype("int")

        # loop over the (x, y) coordinates and radius of the circles
        for (x, y, r) in circles:
            # draw the circle in the output image, then draw a rectangle
            # corresponding to the center of the circle

            cv2.circle(image, (x, y), r, (0, 255, 0), 4)
            cv2.rectangle(image, (x - 5, y - 5), (x + 5, y + 5), (0, 128, 255),
Beispiel #3
0
    uniqueCoverdRegion_meta = list(set(coveredRegion_meta))
    if len(uniqueCoverdRegion_meta) < minReadPairNum: continue

    # filter by the ratio of valid read pairs
    pairPos = F[17].split(';')
    if float(pairPos.count("0")) / float(len(pairPos)) > 1 - minValidThres:
        continue

    # check for the covered region
    coveredRegion_primary = F[9].split(';')
    coveredRegion_pair = F[12].split(';')
    coveredRegion_SA = F[15].split(';')
    pairPos = F[17].split(';')
    primaryPos = F[18].split(';')

    region1 = regions.Regions()
    region2 = regions.Regions()

    for i in range(0, len(coveredRegion_primary)):
        if primaryPos[i] == "1" and pairPos != "0":
            for reg in coveredRegion_primary[i].split(','):
                region1.addMerge(reg)
        elif primaryPos[i] == "2" and pairPos != "0":
            for reg in coveredRegion_primary[i].split(','):
                region2.addMerge(reg)

    for i in range(0, len(coveredRegion_SA)):
        if primaryPos[i] == "1" and pairPos != "0":
            for reg in coveredRegion_SA[i].split(','):
                region2.addMerge(reg)
        elif primaryPos[i] == "2" and pairPos != "0":
# import the necessary packages
import numpy as np
import argparse
import cv2
import regions

#regions.Regions(xIntercept, width, length, yIntercept, rows, columns)
regions = regions.Regions(10,480,480,10,3,3)
videoCapture = cv2.VideoCapture(0)

while True:

	ret, image = videoCapture.read()
	gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
	gray = cv2.blur(gray,(5,5))

	# detect circles in the image
	circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1.2, 75)

	# ensure at least some circles were founds
	if circles is not None:
		# convert the (x, y) coordinates and radius of the circles to integers
		circles = np.round(circles[0, :]).astype("int")

		# loop over the (x, y) coordinates and radius of the circles
		for (x, y, r) in circles:
			# draw the circle in the output image, then draw a rectangle
			# corresponding to the center of the circle

			cv2.circle(image, (x, y), r, (0, 255, 0), 4)
			cv2.rectangle(image, (x - 5, y - 5), (x + 5, y + 5), (0, 128, 255), -1)
Beispiel #5
0
    def addImage(self, survey='poss1_red'):
        self.w.set("frame new")
        self.w.set('single')
        self.w.set("dssstsci survey {0}".format(survey))
        self.w.set("dssstsci size {0} {1} arcmin ".format(
            self.size * self.inflate, self.size * self.inflate))
        self.w.set("dssstsci coord {0} sexagesimal ".format(self.coordstring))

        # add circles centered on the target position
        r = regions.Regions("LDSS3C", units="fk5", path=finderdir)

        imageepoch = float(
            self.w.get('''fits header keyword "'DATE-OBS'" ''').split('-')[0])

        old = self.star.atEpoch(imageepoch)
        p = self.star.posstring
        print p(old, imageepoch)
        print p(self.star.current, self.star.epoch)
        current = self.star.current
        r.addLine(old.ra.degree,
                  old.dec.degree,
                  current.ra.degree,
                  current.dec.degree,
                  line='0 1',
                  color='red')
        print old.ra.degree, old.dec.degree, current.ra.degree, current.dec.degree
        r.addCircle(current.ra.degree,
                    current.dec.degree,
                    "{0}'".format(self.size / 2),
                    text="{0:.1f}' diameter".format(self.size),
                    font="bold {0:.0f}".format(np.round(14.0)))

        r.addCircle(current.ra.degree, current.dec.degree,
                    "{0}'".format(2.0 / 60.0))

        # add a compass
        radius = self.size / 60 / 2
        r.addCompass(current.ra.degree + 0.95 * radius,
                     current.dec.degree + 0.95 * radius,
                     "{0}'".format(self.size * self.inflate / 5))
        r.addText(current.ra.degree,
                  current.dec.degree - 1.1 * radius,
                  self.name + ', ' + self.star.posstring(),
                  font='bold {0:.0f}'.format(np.round(16.0)),
                  color='red')

        r.addText(current.ra.degree - 1.04 * radius,
                  current.dec.degree + 1.02 * radius,
                  'd(RA)={0:+3.0f}, d(Dec)={1:+3.0f} mas/yr'.format(
                      self.star.pmra, self.star.pmdec),
                  font='bold {0:.0f}'.format(np.round(12.0)),
                  color='red')

        r.addText(current.ra.degree - 1.04 * radius,
                  current.dec.degree + 0.95 * radius,
                  '(image from {0})'.format(imageepoch),
                  font='bold {0:.0f}'.format(np.round(10.0)),
                  color='red')
        # load regions into image
        print(r)
        r.write()
        self.w.set("cmap invert yes")
        self.w.set("colorbar no")

        #self.w.set("rotate to {0}".format(int(np.round(90 -63 - self.star['rot'][0]))))
        self.w.set("regions load {0}".format(r.filename))
def filterCoverRegion(inputFilePath, outputFilePath):

    # min_read_pair_num = config.param_conf.getint("filter_condition", "min_read_pair_num")
    # min_valid_read_pair_ratio = config.param_conf.getfloat("filter_condition", "min_valid_read_pair_ratio")
    # min_cover_size = config.param_conf.getint("filter_condition", "min_cover_size")
    # min_chimeric_size = config.param_conf.getint("filter_condition", "min_chimeric_size")
    # anchor_size_thres = config.param_conf.getint("filter_condition", "anchor_size_thres")
    min_read_pair_num = param_conf.min_read_pair_num
    min_valid_read_pair_ratio = param_conf.min_valid_read_pair_ratio
    min_cover_size = param_conf.min_cover_size
    min_chimeric_size = param_conf.min_chimeric_size
    anchor_size_thres = param_conf.anchor_size_thres

    hIN = open(inputFilePath, 'r')
    hOUT = open(outputFilePath, 'w')

    for line in hIN:
        F = line.rstrip('\n').split('\t')

        if F[0] == F[3] and abs(int(F[1]) - int(F[4])) < min_chimeric_size:
            continue

        coveredRegion_primary = F[9].split(';')
        coveredRegion_pair = F[12].split(';')
        coveredRegion_SA = F[15].split(';')

        # check the number of unique read pairs
        coveredRegion_meta = [
            coveredRegion_primary[i] + ';' + coveredRegion_pair[i] + ';' +
            coveredRegion_SA[i] for i in range(0, len(coveredRegion_primary))
        ]
        uniqueCoverdRegion_meta = list(set(coveredRegion_meta))
        if len(uniqueCoverdRegion_meta) < min_read_pair_num: continue

        # check the maximum anchor size
        coverRegionSize_primary = map(region_utils.getCoverSize,
                                      coveredRegion_primary)
        coverRegionSize_SA = map(region_utils.getCoverSize, coveredRegion_SA)
        anchor_size = [
            min(coverRegionSize_primary[i], coverRegionSize_SA[i])
            for i in range(len(coverRegionSize_primary))
        ]
        if max(anchor_size) < anchor_size_thres: continue

        # filter by the ratio of valid read pairs
        pairPos = F[17].split(';')
        if float(pairPos.count("0")) / float(
                len(pairPos)) > 1 - min_valid_read_pair_ratio:
            continue

        # check for the covered region
        pairPos = F[17].split(';')
        primaryPos = F[18].split(';')

        region1 = regions.Regions()
        region2 = regions.Regions()

        for i in range(0, len(coveredRegion_primary)):
            if primaryPos[i] == "1" and pairPos != "0":
                for reg in coveredRegion_primary[i].split(','):
                    region1.addMerge(reg)
            elif primaryPos[i] == "2" and pairPos != "0":
                for reg in coveredRegion_primary[i].split(','):
                    region2.addMerge(reg)

        for i in range(0, len(coveredRegion_SA)):
            if primaryPos[i] == "1" and pairPos != "0":
                for reg in coveredRegion_SA[i].split(','):
                    region2.addMerge(reg)
            elif primaryPos[i] == "2" and pairPos != "0":
                for reg in coveredRegion_SA[i].split(','):
                    region1.addMerge(reg)

        for i in range(0, len(coveredRegion_pair)):
            if (primaryPos[i] == "1"
                    and pairPos[i] == "1") or (primaryPos[i] == "2"
                                               and pairPos[i] == "2"):
                for reg in coveredRegion_pair[i].split(','):
                    region1.addMerge(reg)
            elif (primaryPos[i] == "1"
                  and pairPos[i] == "2") or (primaryPos[i] == "2"
                                             and pairPos[i] == "1"):
                for reg in coveredRegion_pair[i].split(','):
                    region2.addMerge(reg)

        region1.reduceMerge()
        region2.reduceMerge()

        if region1.regionSize() < min_cover_size or region2.regionSize(
        ) < min_cover_size:
            continue

        print >> hOUT, '\t'.join(F)

    hIN.close()
    hOUT.close()
def extractSplicingPattern(inputFilePath, outputFilePath):

    # reference_genome = config.param_conf.get("alignment", "reference_genome")
    reference_genome = param_conf.reference_genome

    hIN = open(inputFilePath, 'r')
    hOUT = open(outputFilePath, 'w')

    for line in hIN:
        F = line.rstrip('\n').split('\t')

        # check for the covered region
        coveredRegion_primary = F[9].split(';')
        coveredRegion_pair = F[12].split(';')
        coveredRegion_SA = F[15].split(';')
        pairPos = F[17].split(';')
        primaryPos = F[18].split(';')

        ####################
        splice2count1 = {}
        splice2count2 = {}

        # get the splicing position for the primary reads
        for i in range(0, len(coveredRegion_primary)):
            regs = coveredRegion_primary[i].split(',')
            if len(regs) == 1: continue

            chr_reg = ""
            start_reg = []
            end_reg = []
            for reg in regs:
                mReg = regRe.match(reg)
                chr_reg = mReg.group(1)
                start_reg.append(int(mReg.group(2)))
                end_reg.append(int(mReg.group(3)))

            start_reg.sort()
            end_reg.sort()

            for j in range(0, len(start_reg) - 1):
                regKey = (chr_reg, int(end_reg[j]), int(start_reg[j + 1]))
                if primaryPos[i] == "1" and pairPos != "0":
                    splice2count1[regKey] = (splice2count1[regKey] + 1
                                             if regKey in splice2count1 else 1)
                elif primaryPos[i] == "2" and pairPos != "0":
                    splice2count2[regKey] = (splice2count2[regKey] + 1
                                             if regKey in splice2count2 else 1)

        # get the splicing position for the supplementary reads
        for i in range(0, len(coveredRegion_SA)):
            regs = coveredRegion_SA[i].split(',')
            if len(regs) == 1: continue

            chr_reg = ""
            start_reg = []
            end_reg = []
            for reg in regs:
                mReg = regRe.match(reg)
                chr_reg = mReg.group(1)
                start_reg.append(int(mReg.group(2)))
                end_reg.append(int(mReg.group(3)))

            start_reg.sort()
            end_reg.sort()

            for j in range(0, len(start_reg) - 1):
                regKey = (chr_reg, int(end_reg[j]), int(start_reg[j + 1]))
                if primaryPos[i] == "1" and pairPos != "0":
                    splice2count2[regKey] = (splice2count2[regKey] + 1
                                             if regKey in splice2count2 else 1)
                elif primaryPos[i] == "2" and pairPos != "0":
                    splice2count1[regKey] = (splice2count1[regKey] + 1
                                             if regKey in splice2count1 else 1)

        # get the splicing position for the pair reads
        for i in range(0, len(coveredRegion_pair)):
            regs = coveredRegion_pair[i].split(',')
            if len(regs) == 1: continue

            chr_reg = ""
            start_reg = []
            end_reg = []
            for reg in regs:
                mReg = regRe.match(reg)
                chr_reg = mReg.group(1)
                start_reg.append(int(mReg.group(2)))
                end_reg.append(int(mReg.group(3)))

            start_reg.sort()
            end_reg.sort()

            for j in range(0, len(start_reg) - 1):
                regKey = (chr_reg, int(end_reg[j]), int(start_reg[j + 1]))
                if (primaryPos[i] == "1"
                        and pairPos[i] == "1") or (primaryPos[i] == "2"
                                                   and pairPos[i] == "2"):
                    splice2count1[regKey] = (splice2count1[regKey] + 1
                                             if regKey in splice2count1 else 1)
                elif (primaryPos[i] == "1"
                      and pairPos[i] == "2") or (primaryPos[i] == "2"
                                                 and pairPos[i] == "1"):
                    splice2count2[regKey] = (splice2count2[regKey] + 1
                                             if regKey in splice2count2 else 1)
        ####################

        ####################
        splice2count1_ref = {}
        splice2count2_ref = {}
        for key in splice2count1:
            splice2count1_ref[key] = 0

        for key in splice2count2:
            splice2count2_ref[key] = 0

        # check about each splicing position for the primary reads
        for i in range(0, len(coveredRegion_primary)):
            for reg in coveredRegion_primary[i].split(','):
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))

                if primaryPos[i] == "1" and pairPos != "0":
                    for key in splice2count1:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1

                if primaryPos[i] == "2" and pairPos != "0":
                    for key in splice2count2:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1

        # check about each splicing position for the supplementary reads
        for i in range(0, len(coveredRegion_SA)):
            for reg in coveredRegion_SA[i].split(','):
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))

                if primaryPos[i] == "1" and pairPos != "0":
                    for key in splice2count2:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1

                if primaryPos[i] == "2" and pairPos != "0":
                    for key in splice2count1:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1

        # check about each splicing position for the pair reads
        for i in range(0, len(coveredRegion_pair)):
            for reg in coveredRegion_pair[i].split(','):
                if reg == "*": continue
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))

                if (primaryPos[i] == "1"
                        and pairPos[i] == "1") or (primaryPos[i] == "2"
                                                   and pairPos[i] == "2"):
                    for key in splice2count1:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count1_ref[key] = splice2count1_ref[key] + 1

                if (primaryPos[i] == "1"
                        and pairPos[i] == "2") or (primaryPos[i] == "2"
                                                   and pairPos[i] == "1"):
                    for key in splice2count2:
                        chr_key, start_key, end_key = key[0], key[1], key[2]

                        # if the given region cover arround the spliced sites
                        if F[2] == "+" and start_reg <= end_key - 5 and end_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1
                        if F[2] == "-" and start_reg <= start_key - 5 and start_key + 5 <= end_reg:
                            splice2count2_ref[key] = splice2count2_ref[key] + 1
        ####################

        ####################
        # check whether we should adopt each splice junction
        spliceJunction1 = []
        spliceJunction2 = []
        for key in splice2count1:
            if splice2count1[key] > splice2count1_ref[key]:
                spliceJunction1.append(key)

        for key in splice2count2:
            if splice2count2[key] > splice2count2_ref[key]:
                spliceJunction2.append(key)
        ####################

        ####################
        region1 = regions.Regions()
        region2 = regions.Regions()

        for i in range(0, len(coveredRegion_primary)):
            if primaryPos[i] == "1" and pairPos != "0":
                for reg in coveredRegion_primary[i].split(','):
                    region1.addMerge(reg)
            elif primaryPos[i] == "2" and pairPos != "0":
                for reg in coveredRegion_primary[i].split(','):
                    region2.addMerge(reg)

        for i in range(0, len(coveredRegion_SA)):
            if primaryPos[i] == "1" and pairPos != "0":
                for reg in coveredRegion_SA[i].split(','):
                    region2.addMerge(reg)
            elif primaryPos[i] == "2" and pairPos != "0":
                for reg in coveredRegion_SA[i].split(','):
                    region1.addMerge(reg)

        for i in range(0, len(coveredRegion_pair)):
            if (primaryPos[i] == "1"
                    and pairPos[i] == "1") or (primaryPos[i] == "2"
                                               and pairPos[i] == "2"):
                for reg in coveredRegion_pair[i].split(','):
                    region1.addMerge(reg)
            elif (primaryPos[i] == "1"
                  and pairPos[i] == "2") or (primaryPos[i] == "2"
                                             and pairPos[i] == "1"):
                for reg in coveredRegion_pair[i].split(','):
                    region2.addMerge(reg)

        region1.reduceMerge()
        region2.reduceMerge()
        ####################

        ####################
        contig1 = []
        contig2 = []

        tempPos = int(F[1])
        if F[2] == "+":
            for key in sorted(spliceJunction1,
                              key=lambda x: x[2],
                              reverse=True):
                if tempPos < key[2]: continue

                minStart = float("inf")
                for reg in region1.regionVec:
                    mReg = regRe.match(reg)
                    chr_reg, start_reg, end_reg = mReg.group(1), int(
                        mReg.group(2)), int(mReg.group(3))
                    if tempPos <= end_reg and start_reg < minStart:
                        minStart = start_reg

                if minStart != float("inf"):
                    contig1.append((chr_reg, max(key[2], minStart), tempPos))
                    if minStart > key[2]: break
                    tempPos = key[1]

            minStart = float("inf")
            for reg in region1.regionVec:
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))
                if tempPos <= end_reg and start_reg < minStart:
                    minStart = start_reg

            if minStart != float("inf"):
                contig1.append((chr_reg, minStart, tempPos))

        if F[2] == "-":
            for key in sorted(spliceJunction1, key=lambda x: x[1]):
                if tempPos > key[1]: continue

                maxEnd = -float("inf")
                for reg in region1.regionVec:
                    mReg = regRe.match(reg)
                    chr_reg, start_reg, end_reg = mReg.group(1), int(
                        mReg.group(2)), int(mReg.group(3))
                    if start_reg <= tempPos and end_reg > maxEnd:
                        maxEnd = end_reg

                if maxEnd != -float("inf"):
                    contig1.append((chr_reg, tempPos, min(key[1], maxEnd)))
                    if maxEnd < key[1]: break
                    tempPos = key[2]

            maxEnd = -float("inf")
            for reg in region1.regionVec:
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))
                if start_reg <= tempPos and end_reg > maxEnd:
                    maxEnd = end_reg

            if maxEnd != -float("inf"):
                contig1.append((chr_reg, tempPos, maxEnd))

        tempPos = int(F[4])
        if F[5] == "+":
            for key in sorted(spliceJunction2,
                              key=lambda x: x[2],
                              reverse=True):
                if tempPos < key[2]: continue

                minStart = float("inf")
                for reg in region2.regionVec:
                    mReg = regRe.match(reg)
                    chr_reg, start_reg, end_reg = mReg.group(1), int(
                        mReg.group(2)), int(mReg.group(3))
                    if tempPos <= end_reg and start_reg < minStart:
                        minStart = start_reg

                if minStart != float("inf"):
                    contig2.append((chr_reg, max(key[2], minStart), tempPos))
                    if minStart > key[2]: break
                    tempPos = key[1]

            minStart = float("inf")
            for reg in region2.regionVec:
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))
                if tempPos <= end_reg and start_reg < minStart:
                    minStart = start_reg

            if minStart != float("inf"):
                contig2.append((chr_reg, minStart, tempPos))

        if F[5] == "-":
            for key in sorted(spliceJunction2, key=lambda x: x[1]):
                if tempPos > key[1]: continue

                maxEnd = -float("inf")
                for reg in region2.regionVec:
                    mReg = regRe.match(reg)
                    chr_reg, start_reg, end_reg = mReg.group(1), int(
                        mReg.group(2)), int(mReg.group(3))
                    if start_reg <= tempPos and end_reg > maxEnd:
                        maxEnd = end_reg

                if maxEnd != -float("inf"):
                    contig2.append((chr_reg, tempPos, min(key[1], maxEnd)))
                    if maxEnd < key[1]: break
                    tempPos = key[2]

            maxEnd = -float("inf")
            for reg in region2.regionVec:
                mReg = regRe.match(reg)
                chr_reg, start_reg, end_reg = mReg.group(1), int(
                    mReg.group(2)), int(mReg.group(3))
                if start_reg <= tempPos and end_reg > maxEnd:
                    maxEnd = end_reg

            if maxEnd != -float("inf"):
                contig2.append((chr_reg, tempPos, maxEnd))
        ####################

        contigSeq1 = ""
        contigSeq2 = ""

        inSeq = ';'.join(list(set(F[6].split(';'))))

        contigSeq1 = seq_utils.getSeq(reference_genome, contig1)
        contigSeq2 = seq_utils.getSeq(reference_genome, contig2)
        if F[2] == "+": contigSeq1 = seq_utils.reverseComplement(contigSeq1)
        if F[5] == "+": contigSeq2 = seq_utils.reverseComplement(contigSeq2)

        print >> hOUT, '\t'.join([
            '\t'.join(F[0:6]),
            str(inSeq),
            str(len(F[8].split(';'))),
            str(contig1),
            str(contig2), contigSeq1, contigSeq2
        ])

    hIN.close()
    hOUT.close()