Exemple #1
0
    def run(self):
        """Execute *bowtie-build*.

        :raises: :class:WedringError

        """
        if not self.quiet:
            wedr_report("[%s] Building Bowtie BW index '%s'." % (self._out_pref,
                                                                  self.index))
        self.parse_bb_cmd_line()
        if not self.quiet:
            wedr_report("[%s] Command line:\n    %s" % (self._out_pref,
                                                         self._bb_cmd))
        wedr_prepare_directory(self.out_dir)
        wedr_prepare_directory(self.log_dir)
        outfile = path.join(self.log_dir, self._out_pref + "_build.log")
        bb = BioSoft(command=self._bb_cmd, outfile=outfile)
        bb.run()
        if 0 != bb.return_code != -1:
            raise WedringError(141, "[%s] %s exitted with status %d. See log file '%s' for more details." %
                               (self._out_pref, bb.program_name,
                                bb.return_code, bb.outfile))
        wedr_clean(outfile)
        if not self.quiet:
            wedr_report("[%s] BW index build - Done!." % self._out_pref)
Exemple #2
0
 def run(self):
     """Execute all steps of the **Wedring** pipeline."""
     # This method will execute according to the self._wb value:
     # The value are set after the command line options --just-indexbuild,
     # --just-map, --just-counttable, --just-de, and the possible values are
     # defined in the globals TTL_PIPELINE, JUST_INDEX, JUST_MAP, JUST_TABLE
     # and JUST_DE, which mean:
     # TTL_PIPELINE -- execute all steps of the pipeline
     # JUST_INDEX -- just execute the indexing stage
     # JUST_MAP -- execute the indexing stage (if needed) and the mapping
     #             stage
     # JUST_TABLE -- just build the count table
     # JUST_DE -- just execute the differential expression stage
     if self._wb in (TTL_PIPELINE, JUST_INDEX, JUST_MAP):
         self.wedring_indexbuilder_parse_params()
         if self._indexbldr is not None:
             self._indexbldr.run()
             self._i = self._indexbldr.index
         if self._wb != JUST_INDEX:
             wedr_prepare_directory(self._o)
             wedr_prepare_directory(self._ld)
             self.wedring_mapping_parse_params()
             p = Pool(self._num_threads)
             self._wedr_list = p.map(WedringMast.exec_mapping_stage,
                                     self._wedr_list)
             if self._wb != JUST_MAP:
                 feats_file = path.join(self._o, "genomic_features.txt")
                 tbl_file = path.join(self._o, "count_table.txt")
                 if not self._qt:
                     wedr_report("Writing genomic features to disk.")
                 write_genomic_features_to_file(self._a, feats_file)
                 if wedr_check_path(feats_file):
                     if not self._qt:
                         wedr_report("Writing genomic features - Done!")
                 cov_f = [wedrmast.cov_file for wedrmast in self._wedr_list]
                 if not self._qt:
                     wedr_report("Writing count table to disk.")
                 write_count_table_to_file(self._a, cov_f, self._cnd,
                                            tbl_file)
                 if wedr_check_path(tbl_file):
                     self._cnt_table = tbl_file
                     if not self._qt:
                         wedr_report("Writing count table - Done!")
                 self.exec_deseq()
     elif self._wb == JUST_TABLE:
         self.wedring_mapping_parse_params()
         wedr_prepare_directory(self._o)
         feats_file = path.join(self._o, "genomic_features.txt")
         tbl_file = path.join(self._o, "count_table.txt")
         if not self._qt:
             wedr_report("Writing genomic features to disk.")
         write_genomic_features_to_file(self._a, feats_file)
         if wedr_check_path(feats_file):
             if not self._qt:
                 wedr_report("Writing genomic features - Done!")
         cov_f = [wedrmast.cov_file for wedrmast in self._wedr_list]
         if not self._qt:
             wedr_report("Writing count table to disk.")
         write_count_table_to_file(self._a, cov_f, self._cnd, tbl_file)
         if wedr_check_path(tbl_file):
             self._cnt_table = tbl_file
             if not self._qt:
                 wedr_report("Writing count table - Done!")
     elif self._wb == JUST_DE:
         wedr_prepare_directory(self._o)
         wedr_prepare_directory(self._ld)
         self.exec_deseq()