Exemple #1
0
def getLiftUpBedFile(halPath, genomeName, genomeBedPath, outBedPath):
    parentName = getParentGenomeName(halPath, genomeName)

    runShellCommand(
        "halLiftover %s %s %s %s %s_lotmp" %
        (halPath, genomeName, genomeBedPath, parentName, outBedPath))

    runShellCommand("cat %s_lotmp |sortBed |mergeBed > %s && rm -f %s_lotmp" %
                    (outBedPath, outBedPath, outBedPath))
Exemple #2
0
def getLiftUpBedFile(halPath, genomeName, genomeBedPath, outBedPath):
    parentName = getParentGenomeName(halPath, genomeName)
    
    runShellCommand("halLiftover %s %s %s %s %s_lotmp" % (halPath,
                                                          genomeName,
                                                          genomeBedPath,
                                                          parentName,
                                                          outBedPath))

    runShellCommand("cat %s_lotmp |sortBed |mergeBed > %s && rm -f %s_lotmp" %
                    (outBedPath, outBedPath, outBedPath))
def getHalTreeBackground(halPath, args, rootName=None):
    root = rootName
    if root is None:
        root = getHalRootName(halPath)
    for child in getHalChildrenNames(halPath, root):
        bgFile = os.path.join(args.workDir, args.backgroundBedName % child)
        if args.ar is True:
            command = "halMaskExtract %s %s --maskFile %s --extend %d --extendPct %f" % (halPath, child, bgFile, args.arExtend, args.arExtendPct)
        else:
            command = "halStats %s --bedSequences %s > %s" % (halPath, child,
                                                              bgFile)
        print command
        runShellCommand(command)
        getHalTreeBackground(halPath, args, child)
Exemple #4
0
def getHalTreeBackground(halPath, args, rootName=None):
    root = rootName
    if root is None:
        root = getHalRootName(halPath)
    for child in getHalChildrenNames(halPath, root):
        bgFile = os.path.join(args.workDir, args.backgroundBedName % child)
        if args.ar is True:
            command = "halMaskExtract %s %s --maskFile %s --extend %d --extendPct %f" % (halPath, child, bgFile, args.arExtend, args.arExtendPct)
        else:
            command = "halStats %s --bedSequences %s > %s" % (halPath, child,
                                                              bgFile)
        print(command)
        runShellCommand(command)
        getHalTreeBackground(halPath, args, child)
def genomeLength(halPath, genome):
    command = "halStats %s --bedSequences %s" % (halPath, genome)
    genomeBed = runShellCommand(command)
    length = 0
    for line in genomeBed.split("\n"):
        tokens = line.split()
        if len(tokens) > 2:
            length += int(tokens[2])
    return length
def genomeLength(halPath, genome):
    command = "halStats %s --bedSequences %s" % (halPath, genome)
    genomeBed = runShellCommand(command)
    length = 0
    for line in genomeBed.split("\n"):
        tokens = line.split()
        if len(tokens) > 2:
            length += int(tokens[2])
    return length
Exemple #7
0
def getSortBed(inBed, outBed=None):
    if outBed is None:
        runShellCommand("sortBed -i %s > %s_temp && mv %s_temp %s" %
                        (inBed, inBed, inBed, inBed))
    else:
        runShellCommand("sortBed -i %s > %s" % (inBed, outBed))
Exemple #8
0
def getUnionBed(inBed1, inBed2, outBed):
    runShellCommand("cat %s %s | sortBed | mergeBed > %s" % (inBed1, inBed2,
                                                             outBed))
Exemple #9
0
def getSortBed(inBed, outBed = None):
    if outBed is None:
        runShellCommand("sortBed -i %s > %s_temp && mv %s_temp %s" % (
            inBed, inBed, inBed, inBed))
    else:
        runShellCommand("sortBed -i %s > %s" % (inBed, outBed))
Exemple #10
0
def getIntersectBed(inBed1, inBed2, outBed):
    runShellCommand("intersectBed -a %s -b %s > %s" % (inBed1, inBed2, outBed))
Exemple #11
0
def getSubtractBed(inBed1, inBed2, outBed):
    runShellCommand("subtractBed -a %s -b %s > %s" % (inBed1, inBed2, outBed))
Exemple #12
0
def getBranchLength(halPath, genomeName):
    return float(
        runShellCommand("halStats %s --branchLength %s" %
                        (halPath, genomeName)).strip("\n"))
Exemple #13
0
def getAlignedBed(halPath, genomeName, outBedPath):
    runShellCommand("halAlignedExtract %s %s | sortBed | mergeBed> %s" %
                    (halPath, genomeName, outBedPath))
Exemple #14
0
def getBranchLength(halPath, genomeName):
    return float(runShellCommand("halStats %s --branchLength %s" % (
        halPath, genomeName)).strip("\n"))
Exemple #15
0
def getParentGenomeName(halPath, genomeName):
    return runShellCommand("halStats %s --parent %s" % (
        halPath, genomeName)).strip("\n")
Exemple #16
0
def getParentGenomeName(halPath, genomeName):
    return runShellCommand("halStats %s --parent %s" %
                           (halPath, genomeName)).strip("\n")
Exemple #17
0
def getUnionBed(inBed1, inBed2, outBed):
    runShellCommand("cat %s %s | sortBed | mergeBed > %s" %
                    (inBed1, inBed2, outBed))
Exemple #18
0
def getSubtractBed(inBed1, inBed2, outBed):
    runShellCommand("subtractBed -a %s -b %s > %s" % (inBed1, inBed2, outBed))
Exemple #19
0
def getIntersectBed(inBed1, inBed2, outBed):
    runShellCommand("intersectBed -a %s -b %s > %s" % (inBed1, inBed2, outBed))
Exemple #20
0
def getAlignedBed(halPath, genomeName, outBedPath):
    runShellCommand("halAlignedExtract %s %s | sortBed | mergeBed> %s" %
                    (halPath, genomeName, outBedPath))