Ejemplo n.º 1
0
    def __getInput(self, pdag, fspec):
        """Get an input file. If fspec can be None, File or FileIn, or any
        object that can be converted to a string.  Return the appropriate PIn
        object, None, or a string. Adds decompression process if needed."""
        if fspec == None:
            return None
        if isinstance(fspec, File):
            fspec = FileIn(fspec)
        if not isinstance(fspec, FileIn):
            return str(fspec)

        # handle File object, include arg prefix
        path = fspec.file.getInPath()
        if fileOps.isCompressed(path) and fspec.autoDecompress:
            pdev = Pipeline.Pipe()
            pdag.create((fileOps.decompressCmd(path), path), stdout=pdev)
            return Pipeline.PIn(pdev, fspec.prefix)
        else:
            return Pipeline.PIn(Pipeline.File(path), fspec.prefix)