Beispiel #1
0
    def __init__(self, args):
        """Run all checks needed to create a FastQMCFTrimPairs object

        Check that fastq-mcf exists in the system
        Specify the fasta adapter file and any arguments
        Create the output folder

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """
        argfiller = ArgFiller(args)
        argfiller.fill(['root', 'adapters', 'fastq', 'fastq_args', 'quiet'])

        self.root = args.root
        self.adapters = args.adapters
        self.fastq_args = args.fastq_args
        self.executable = args.fastq
        self.quiet = args.quiet

        self.outdir = os.path.join(self.root, 'trimmed')
        try:
            os.makedirs(self.outdir)
        except OSError:
            if not os.path.isdir(self.outdir):
                raise

        try:
            with open(os.devnull, "w") as fnull:
                subprocess.call([self.executable], stdout=fnull, stderr=fnull)
        except OSError:
            self.logger.error(
                'fastq-mcf not found, cannot use FastQMCFTrimPairs')
            raise
        else:
            self.logger.info('fastq-mcf found')
Beispiel #2
0
    def __init__(self, args):
        """Run all checks needed to create a FastQMCFTrimPairs object

        Check that fastq-mcf exists in the system
        Specify the fasta adapter file and any arguments
        Create the output folder

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """
        argfiller = ArgFiller(args)
        argfiller.fill(["root", "adapters", "fastq", "fastq_args", "quiet"])

        self.root = args.root
        self.adapters = args.adapters
        self.fastq_args = args.fastq_args
        self.executable = args.fastq
        self.quiet = args.quiet

        self.outdir = os.path.join(self.root, "trimmed")
        try:
            os.makedirs(self.outdir)
        except OSError:
            if not os.path.isdir(self.outdir):
                raise

        try:
            with open(os.devnull, "w") as fnull:
                subprocess.call([self.executable], stdout=fnull, stderr=fnull)
        except OSError:
            self.logger.error("fastq-mcf not found, cannot use FastQMCFTrimPairs")
            raise
        else:
            self.logger.info("fastq-mcf found")
Beispiel #3
0
    def __init__(self, args):
        """Prepare the recursive file finder

        Check that a root directory is provided, or ask for one
        Make sure the search extension is valid

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """

        argfiller = ArgFiller(args)
        argfiller.fill(['root', 'ext'])

        self.root = args.root
        self.ext = args.ext
Beispiel #4
0
    def __init__(self, args):
        """Prepare the recursive file finder

        Check that a root directory is provided, or ask for one
        Make sure the search extension is valid

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """

        argfiller = ArgFiller(args)
        argfiller.fill(["root", "ext"])

        self.root = args.root
        self.ext = args.ext
Beispiel #5
0
    def __init__(self, args):
        """Prepare for the merge file stage

        Check for a root directory and a blocksize

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """

        argfiller = ArgFiller(args)
        argfiller.fill(["root", "ext", "blocksize"])

        self.root = args.root
        self.blocksize = args.blocksize
        self.ext = args.ext

        self.outdir = os.path.join(self.root, "merged")
        try:
            os.makedirs(self.outdir)
        except OSError:
            if not os.path.isdir(self.outdir):
                self.logger.error("Cannot make directory {0}, " "permissions".format(self.outdir))
                raise
Beispiel #6
0
    def __init__(self, args):
        """Prepare for the merge file stage

        Check for a root directory and a blocksize

        :param args: an object with settable and gettable attributes
        :type args: Namespace, SimpleNamespace, etc.
        """

        argfiller = ArgFiller(args)
        argfiller.fill(['root', 'ext', 'blocksize'])

        self.root = args.root
        self.blocksize = args.blocksize
        self.ext = args.ext

        self.outdir = os.path.join(self.root, 'merged')
        try:
            os.makedirs(self.outdir)
        except OSError:
            if not os.path.isdir(self.outdir):
                self.logger.error('Cannot make directory {0}, '
                                  'permissions'.format(self.outdir))
                raise