Example #1
0
 def _compare_term_tran(self, args_term, prefixs):
     '''searching the associated terminator to transcript'''
     self.multiparser.combine_gff(args_term.gffs, self.tran_path, None,
                                  "transcript")
     prefixs = []
     print("Comparing terminators with transcripts now")
     for file_ in os.listdir(self.tran_path):
         if file_.endswith("_transcript.gff"):
             prefixs.append(file_.replace("_transcript.gff", ""))
     for type_ in ("best_candidates", "expressed_candidates",
                   "all_candidates"):
         compare_term_tran(self.tran_path,
                           os.path.join(self.outfolder["term"], type_),
                           args_term.fuzzy_up_ta, args_term.fuzzy_down_ta,
                           args_term.out_folder, "terminator",
                           self.outfolder["term"], args_term.trans)
         for prefix in prefixs:
             shutil.move(
                 os.path.join(
                     args_term.out_folder, "statistics",
                     "stat_compare_transcript_terminator_" + prefix +
                     ".csv"),
                 os.path.join(
                     args_term.out_folder, "statistics", "_".join([
                         "stat_compare_terminator_transcript", prefix,
                         type_ + ".csv"
                     ])))
Example #2
0
 def _compare_term_tran(self, args_term, prefixs, log):
     '''searching the associated terminator to transcript'''
     self.multiparser.combine_gff(args_term.gffs, self.tran_path,
                                  None, "transcript")
     prefixs = []
     print("Comparing terminators with transcripts now")
     for file_ in os.listdir(self.tran_path):
         if file_.endswith("_transcript.gff"):
             prefixs.append(file_.replace("_transcript.gff", ""))
     log.write("Running compare_tran_term.py for comparing transcripts "
               "and terminators.\n")
     log.write("The following files are generated:\n")
     for type_ in ("best_candidates", "expressed_candidates",
                   "all_candidates"):
         compare_term_tran(self.tran_path,
                           os.path.join(self.outfolder["term"], type_),
                           args_term.fuzzy_up_ta, args_term.fuzzy_down_ta,
                           args_term.out_folder, "terminator",
                           self.outfolder["term"], args_term.trans)
         for prefix in prefixs:
             shutil.move(
                 os.path.join(
                     args_term.out_folder, "statistics",
                     "stat_compare_transcript_terminator_" + prefix + ".csv"),
                 os.path.join(
                     args_term.out_folder, "statistics",
                     "_".join(["stat_compare_terminator_transcript", prefix,
                               type_ + ".csv"])))
             log.write("\t" + os.path.join(
                     args_term.out_folder, "statistics",
                     "_".join(["stat_compare_terminator_transcript", prefix,
                               type_ + ".csv"])) + "\n")
Example #3
0
 def _compare_term_tran(self, args_tran):
     if args_tran.terms is not None:
         print("comparing between terminators and transcripts...")
         self.multiparser.parser_gff(args_tran.terms, "term")
         self.multiparser.combine_gff(
                 args_tran.gffs,
                 os.path.join(args_tran.terms, "tmp"), None, "term")
         compare_term_tran(self.gff_outfolder,
                           os.path.join(args_tran.terms, "tmp"),
                           args_tran.fuzzy_term, args_tran.fuzzy_term,
                           args_tran.out_folder, "transcript")
Example #4
0
 def _compare_term_tran(self, args_tran):
     '''searching the associated terminator to transcript'''
     if args_tran.terms is not None:
         print("comparing between terminators and transcripts...")
         self.multiparser.parser_gff(args_tran.terms, "term")
         self.multiparser.combine_gff(args_tran.gffs,
                                      os.path.join(args_tran.terms, "tmp"),
                                      None, "term")
         compare_term_tran(self.gff_outfolder,
                           os.path.join(args_tran.terms, "tmp"),
                           args_tran.fuzzy_term, args_tran.fuzzy_term,
                           args_tran.out_folder, "transcript",
                           args_tran.terms, self.gff_outfolder)
Example #5
0
 def _compare_term_tran(self, args_term):
     self.multiparser.combine_gff(args_term.gffs, self.tran_path,
                                  None, "transcript")
     for type_ in ("best", "express", "all_candidates"):
         compare_term_tran(self.tran_path,
                           os.path.join(self.outfolder["term"], type_),
                           args_term.fuzzy_up_ta, args_term.fuzzy_down_ta,
                           args_term.out_folder, "terminator")
         shutil.move(
             os.path.join(
                 args_term.out_folder, "statistics",
                 "stat_comparison_terminator_transcript.csv"),
             os.path.join(
                 args_term.out_folder, "statistics",
                 "stat_comparison_terminator_transcript_" + type_ + ".csv"))
Example #6
0
 def _compare_term_tran(self, args_tran, log):
     '''searching the associated terminator to transcript'''
     if args_tran.terms is not None:
         print("Comparing between terminators and transcripts")
         self.multiparser.parser_gff(args_tran.terms, "term")
         if args_tran.gffs is not None:
             self.multiparser.combine_gff(
                 args_tran.gffs,
                 os.path.join(args_tran.terms, "tmp"), None, "term")
         log.write("Running compare_tran_term.py to compare transcripts "
                   "with terminators.\n")
         compare_term_tran(self.gff_outfolder,
                           os.path.join(args_tran.terms, "tmp"),
                           args_tran.fuzzy_term, args_tran.fuzzy_term,
                           args_tran.out_folder, "transcript",
                           args_tran.terms, self.gff_outfolder)
         for file_ in os.listdir(os.path.join(args_tran.out_folder, "statistics")):
             if file_.startswith("stat_compare_transcript_terminator_"):
                 log.write("\t" + file_ + " is generated.\n")