示例#1
0
def doPslCat(target, outDir, pslOptions=None, singleOutFname=None):
    """
    concats psl files, creates one per query
    Optionally sort by query and run pslCdnaFilter on it.
    """
    pslDir = abspath(join(outDir, "psl", target))
    pslCatFnames = []

    if singleOutFname:
        if isfile(singleOutFname):
            open(singleOutFname, "w")  # truncate to 0 bytes
    else:
        pslCatDir = abspath(join(outDir, "pslCat", target))
        if not isdir(pslCatDir):
            os.makedirs(pslCatDir)

    for queryName in os.listdir(pslDir):
        if singleOutFname:
            pslCatName = singleOutFname
            pipeOp = ">>"
        else:
            pslCatName = join(pslCatDir, queryName)
            pipeOp = ">"
        if not pslCatName.endswith(".psl"):
            pslCatName += ".psl"

        logging.info("Concatting psls for query %s to %s" %
                     (queryName, pslCatName))
        queryPath = join(pslDir, queryName)
        pslCatFnames.append(pslCatName)
        sortCmd = ""
        if pslOptions:
            filtOpt = bigBlatJob.splitAddDashes(pslOptions)
            sortCmd = " | sort -k10,10 | pslCDnaFilter %s stdin stdout " % (
                filtOpt)

        # yield job line:
        # queryPath filtOpt pslCatName
        cmd = "cat %(queryPath)s/* %(sortCmd)s %(pipeOp)s %(pslCatName)s" % locals(
        )
        runCommand(cmd)
示例#2
0
def doPslCat(target, outDir, pslOptions=None, singleOutFname=None):
    """
    concats psl files, creates one per query
    Optionally sort by query and run pslCdnaFilter on it.
    """
    pslDir = abspath(join(outDir, "psl", target))
    pslCatFnames = []

    if singleOutFname:
        if isfile(singleOutFname):
            open(singleOutFname, "w") # truncate to 0 bytes
    else:
        pslCatDir = abspath(join(outDir, "pslCat", target))
        if not isdir(pslCatDir):
            os.makedirs(pslCatDir)

    for queryName in os.listdir(pslDir):
        if singleOutFname:
            pslCatName = singleOutFname
            pipeOp = ">>"
        else:
            pslCatName = join(pslCatDir, queryName)
            pipeOp = ">"
        if not pslCatName.endswith(".psl"):
            pslCatName += ".psl"

        logging.info("Concatting psls for query %s to %s" % (queryName, pslCatName))
        queryPath = join(pslDir, queryName)
        pslCatFnames.append(pslCatName)
        sortCmd = ""
        if pslOptions:
            filtOpt = bigBlatJob.splitAddDashes(pslOptions)
            sortCmd = " | sort -k10,10 | pslCDnaFilter %s stdin stdout " % (filtOpt)

        # yield job line:
        # queryPath filtOpt pslCatName
        cmd = "cat %(queryPath)s/* %(sortCmd)s %(pipeOp)s %(pslCatName)s" % locals()
        runCommand(cmd)
示例#3
0
#!/usr/bin/env python
# job script for bigBlat.py cat step
# concats and optionally sorts/filters all psl files of a query
# args: queryPslDirectory outputPslPath pslOptions (or string "None")
from sys import argv
from os import system
from bigBlatJob import splitAddDashes
args = argv[1:]
queryPath, pslCatName, pslOptions = args

sortCmd = ""
if pslOptions!="None":
    filtOpt = splitAddDashes(pslOptions)
    sortCmd = " | sort -k10,10 | pslCDnaFilter %s stdin stdout " % (filtOpt)

filtOptStr = splitAddDashes(pslOptions)
cmd = "cat %(queryPath)s/* %(sortCmd)s > %(pslCatName)s" % locals()
ret = system(cmd)
assert(ret==0)
示例#4
0
#!/usr/bin/env python
# job script for bigBlat.py cat step
# concats and optionally sorts/filters all psl files of a query
# args: queryPslDirectory outputPslPath pslOptions (or string "None")
from sys import argv
from os import system
from bigBlatJob import splitAddDashes

args = argv[1:]
queryPath, pslCatName, pslOptions = args

sortCmd = ""
if pslOptions != "None":
    filtOpt = splitAddDashes(pslOptions)
    sortCmd = " | sort -k10,10 | pslCDnaFilter %s stdin stdout " % (filtOpt)

filtOptStr = splitAddDashes(pslOptions)
cmd = "cat %(queryPath)s/* %(sortCmd)s > %(pslCatName)s" % locals()
ret = system(cmd)
assert (ret == 0)