Exemplo n.º 1
0
    def run(targets):
        # try to run without converting to json, if that fails,
        # convert first, then run on the json-converted biom file
        if os.stat(file).st_size < 1:
            for target in targets:
                open(target, "w").close()
            return True

        return strategies.backup(
            (strategies.Group(CmdAction(cmd1%(file), verbose=verbose),
                              CmdAction(cmd2%(norm_out), verbose=verbose)),
             strategies.Group(format_cmd,
                              CmdAction(cmd1%(converted), verbose=verbose),
                              CmdAction(cmd2%(norm_out), verbose=verbose)))
        )
Exemplo n.º 2
0
 def run():
     return strategies.backup(
         (CmdAction(cmd+opts, verbose=verbose),
          strategies.Group(
              PythonAction(_revcomp),
              CmdAction(cmd+revcomp_opts,verbose=verbose))),
         extra_conditions=[output_exists]
     )
Exemplo n.º 3
0
 def run(targets):
     strategies.backup(
         (CmdAction(cmd.format(input_fname),verbose=verbose),
          strategies.Group(
              CmdAction(revcomp_cmd),
              CmdAction(cmd.format(revcomp_fname),verbose=verbose))),
         extra_conditions = [ 
             lambda ret, output_fname: os.stat(output_fname).st_size == 0
         ],
         output_fname=output_fname
     )
Exemplo n.º 4
0
    def run():
        r1, r2 = input_fastq_pair
        paired = lambda s: s.replace('.fastq', '_paired.fastq')
        ret = strategies.backup(
            (CmdAction(stitch_cmd.format(
                r1=r1, r2=r2, opts_str=opts_str, output_fastq=output_fastq),
                       verbose=verbose),
             strategies.Group(
                 CmdAction(pair_cmd.format(
                     r1=r1, r2=r2, r1out=paired(r1), r2out=paired(r2)),
                           verbose=verbose),
                 CmdAction(stitch_cmd.format(r1=paired(r1),
                                             r2=paired(r2),
                                             opts_str=opts_str,
                                             output_fastq=output_fastq),
                           verbose=verbose)),
             CmdAction('cp {r1} {out}'.format(r1=r1, out=output_fastq),
                       verbose=verbose)), )

        if remove_tempfiles:
            for f in (paired(r1), paired(r2)):
                if os.path.exists(f):
                    os.remove(f)
        return ret