Exemple #1
0
def runCactusBlastIngroupsAndOutgroups(ingroups, outgroups, alignmentsFile, toilDir, outgroupFragmentPaths=None, ingroupCoveragePaths=None, chunkSize=None, overlapSize=None, 
                   logLevel=None,
                   compressFiles=None,
                   lastzMemory=None):
    options = Job.Runner.getDefaultOptions(toilDir)
    options.disableCaching = True
    options.logLevel = "CRITICAL"
    blastOptions = BlastOptions(chunkSize=chunkSize, overlapSize=overlapSize,
                                compressFiles=compressFiles,
                                memory=lastzMemory)
    with Toil(options) as toil:
        ingroupIDs = [toil.importFile(makeURL(ingroup)) for ingroup in ingroups]
        outgroupIDs = [toil.importFile(makeURL(outgroup)) for outgroup in outgroups]
        rootJob = BlastIngroupsAndOutgroups(blastOptions, ingroupIDs, outgroupIDs)
        blastResults = toil.start(rootJob)
        alignmentsID = blastResults[0]
        toil.exportFile(alignmentsID, makeURL(alignmentsFile))
        outgroupFragmentIDs = blastResults[1]
        ingroupCoverageIDs = blastResults[2]

        if outgroupFragmentPaths:
            assert len(outgroupFragmentIDs) == len(outgroupFragmentPaths)
            for outgroupFragmentID, outgroupFragmentPath in zip(outgroupFragmentIDs, outgroupFragmentPaths):
                toil.exportFile(outgroupFragmentID, makeURL(outgroupFragmentPath))
        if ingroupCoveragePaths:
            assert len(ingroupCoverageIDs) == len(ingroupCoveragePaths)
            for ingroupCoverageID, ingroupCoveragePath in zip(ingroupCoverageIDs, ingroupCoveragePaths):
                toil.exportFile(ingroupCoverageID, makeURL(ingroupCoveragePath))
Exemple #2
0
def runCactusBlast(sequenceFiles,
                   alignmentsFile,
                   toilDir,
                   chunkSize=None,
                   overlapSize=None,
                   logLevel=None,
                   compressFiles=None,
                   lastzMemory=None,
                   targetSequenceFiles=None):

    options = Job.Runner.getDefaultOptions(toilDir)
    options.logLevel = "CRITICAL"
    blastOptions = BlastOptions(chunkSize=chunkSize,
                                overlapSize=overlapSize,
                                compressFiles=compressFiles,
                                memory=lastzMemory)
    with Toil(options) as toil:
        seqIDs = [
            toil.importFile(makeURL(seqFile)) for seqFile in sequenceFiles
        ]

        if targetSequenceFiles:
            targetSeqIDs = [
                toil.importFile(makeURL(seqFile))
                for seqFile in targetSequenceFiles
            ]
            rootJob = BlastSequencesAgainstEachOther(
                sequenceFileIDs1=seqIDs,
                sequenceFileIDs2=targetSeqIDs,
                blastOptions=blastOptions)
        else:
            rootJob = BlastSequencesAllAgainstAll(seqIDs, blastOptions)
        alignmentsID = toil.start(rootJob)
        toil.exportFile(alignmentsID, makeURL(alignmentsFile))