def __getOutput(self, pdag, fspec): """Get an output file. If fspec can be None, File or FileOut, or any object that can be converted to a string. Return the appropriate Pout object, None, or a string. Adds compression process if needed.""" if fspec == None: return None if isinstance(fspec, File): fspec = FileOut(fspec) if not isinstance(fspec, FileOut): return str(fspec) # handle File object, include arg prefix path = fspec.file.getOutPath() if fileOps.isCompressed(path) and fspec.autoCompress: pdev = Pipeline.Pipe() pdag.create((fileOps.compressCmd(path),), stdin=pdev, stdout=path) return Pipeline.POut(pdev, fspec.prefix) else: return Pipeline.POut(Pipeline.File(path), fspec.prefix)
def __getOutput(self, pdag, fspec): """Get an output file. If fspec can be None, File or FileOut, or any object that can be converted to a string. Return the appropriate Pout object, None, or a string. Adds compression process if needed.""" if fspec == None: return None if isinstance(fspec, File): fspec = FileOut(fspec) if not isinstance(fspec, FileOut): return str(fspec) # handle File object, include arg prefix path = fspec.file.getOutPath() if fileOps.isCompressed(path) and fspec.autoCompress: pdev = Pipeline.Pipe() pdag.create((fileOps.compressCmd(path), ), stdin=pdev, stdout=path) return Pipeline.POut(pdev, fspec.prefix) else: return Pipeline.POut(Pipeline.File(path), fspec.prefix)
def getCompressCmd(path): compressCmd = fileOps.compressCmd(path) if compressCmd == None: return "cat" else: return compressCmd