コード例 #1
0
ファイル: MergeFiles.py プロジェクト: cacampbell/pythonmisc
    def format_commands(self):
        samples = []

        if self.by_sample:
            samples = list(set([basename(x).split("_")[0] for x in self.files]))

        else:
            samples = list(set(
                [basename(x).split(".split")[0] for x in self.files]
            ))

        for sample in samples:
            merge = []
            for filename in self.files:
                if "{}_".format(sample) in filename:
                    merge += [filename]

            pwd = getcwd()
            output = self.rebase_file(join(pwd, sample + self.extension))
            regex = "\.split\.[a-z]{1,10}?"

            try:
                match = search(regex, output).group(0)
                output = sub(match, "", output)
            except AttributeError as err:  # no attribute 'group'
                raise (err)

            combine_files(merge, output)
コード例 #2
0
    def format_commands(self):
        input_f = join(self.input_root, self.all_reads_name)
        output = join(self.output_root, self.assembly_name)

        if self.verbose:
            print("Combining input files...", file=stderr)

        if not self.dry_run:
            combine_files(self.files, input_f)
        else:
            print("Would have combined files if not dry_run...", file=stderr)

        job_name = "{}{}".format(self.cluster_options["job_name"],
                                 basename(self.all_reads_name))
        command = ("tadpole.sh in={} out={} prealloc=t prefilter=2 "
                   "mincontig={} mincov={} k={}").format(input_f,
                                                         output,
                                                         self.mincontig,
                                                         self.mincov,
                                                         self.kmer_len)
        self.commands[job_name] = command

        if self.verbose:
            print(command, file=stderr)