gcon_nproc=True,
                               arrow_nproc=False)

    args = parser.parse_args()

    # currently, the user is NOT allowed to set the definition for full missed start/end
    # (i.e. how much of the query must be mapped to consider it a hit)
    ice_opts = IceOptions2(
        ece_penalty=args.ece_penalty,
        ece_min_len=args.ece_min_len,
        max_missed_start=args.max_missed_start,
        max_missed_end=args.max_missed_end,
        full_missed_start=30,
        full_missed_end=20,
        aligner_choice=args.aligner_choice,
    )

    unique_id = random.randint(1, 1000000)
    sge_opts = SgeOptions2(unique_id,
                           use_sge=args.use_sge,
                           max_sge_jobs=args.max_sge_jobs,
                           blasr_nproc=args.blasr_nproc,
                           gcon_nproc=args.gcon_nproc,
                           sge_queue=args.sge_queue,
                           sge_env_name=args.sge_env_name,
                           qsub_extra=args.qsub_extra)

    run_IceIterative2(args.fasta_filenames.split(','),
                      args.fastq_filenames.split(','), args.all_fasta_filename,
                      ice_opts, sge_opts, args.root_dir, args.init_uc_pickle)
    def run(self):
        """Execute ice_partial.py all|one|split|i|merge."""
        cmd = self.args.subCommand
        logging.info("Running {f} {cmd} v{v}.".format(f=op.basename(__file__),
                                                      cmd=cmd,
                                                      v=get_version()))
        cmd_str = ""
        try:
            args = self.args
            obj = None
            if cmd in ('all', 'one'):
                # currently user NOT allowed to set full missed start/end
                # (we also set it to 30/10 bp which is more stringent than in IceIterative2,
                # which is hard set to 50/30)
                ice_opts = IceOptions2(ece_penalty=args.ece_penalty,
                                       ece_min_len=args.ece_min_len,
                                       max_missed_start=args.max_missed_start,
                                       max_missed_end=args.max_missed_end,
                                       full_missed_start=30,
                                       full_missed_end=10,
                                       min_match_len=50,
                                       aligner_choice=args.aligner_choice)

            if cmd == "all":
                sge_opts = SgeOptions2(unique_id=args.unique_id,
                                       use_sge=args.use_sge,
                                       max_sge_jobs=args.max_sge_jobs,
                                       sge_queue=args.sge_queue,
                                       sge_env_name=args.sge_env_name,
                                       qsub_extra=args.qsub_extra)
                obj = IceAllPartials2(
                    root_dir=args.root_dir,
                    fasta_filenames=args.fasta_filenames.split(','),
                    fastq_filenames=args.fastq_filenames.split(',')
                    if args.fastq_filenames is not None else None,
                    ref_fasta=args.ref_fasta,
                    out_pickle=args.out_pickle,
                    ice_opts=ice_opts,
                    sge_opts=sge_opts,
                    cpus=args.cpus,
                    tmp_dir=args.tmp_dir)
            elif cmd == "one":
                # Only assign nfl reads in the given input_fasta file to isoforms
                # "one" is always run locally so no need for SGE option
                obj = IcePartialOne2(input_fasta=args.input_fasta,
                                     input_fastq=args.input_fastq,
                                     ref_fasta=args.ref_fasta,
                                     out_pickle=args.out_pickle,
                                     done_filename=args.done_filename,
                                     ice_opts=ice_opts,
                                     cpus=args.cpus,
                                     tmp_dir=args.tmp_dir)
            elif cmd == "split":
                obj = IcePartialSplit2(root_dir=args.root_dir,
                                       nfl_fa=args.nfl_fa,
                                       nfl_fq=args.nfl_fq,
                                       N=args.N)
            # elif cmd == "i":
            #     obj = IcePartialI(root_dir=args.root_dir, i=args.i,
            #                       ccs_fofn=args.ccs_fofn,
            #                       blasr_nproc=args.blasr_nproc,
            #                       tmp_dir=args.tmp_dir)
            elif cmd == "merge":
                obj = IcePartialMerge(root_dir=args.root_dir, N=args.N)
            else:
                raise ValueError(
                    "Unknown command passed to {f}: {cmd}.".format(
                        f=op.basename(__file__), cmd=cmd))

            cmd_str = obj.cmd_str()
            logging.info("Running CMD: {cmd_str}".format(cmd_str=cmd_str))
            obj.run()
        except:
            logging.exception("Exiting {cmd_str} with return code 1.".format(
                cmd_str=cmd_str))
            return 1
        return 0
Exemple #3
0
                        type=int,
                        help="ECE min len (default: 20)")
    parser.add_argument("--max_missed_start",
                        default=100,
                        type=int,
                        help="Max missed 5'(default: 100 bp)")
    parser.add_argument("--max_missed_end",
                        default=30,
                        type=int,
                        help="Max missed 3' (default: 30 bp)")
    parser.add_argument("--cpus",
                        default=4,
                        help="Number of CPUs aligner uses (default: 4)")

    args = parser.parse_args()

    ice_opts = IceOptions2(ece_penalty=args.ece_penalty,
                           ece_min_len=args.ece_min_len,
                           max_missed_start=args.max_missed_start,
                           max_missed_end=args.max_missed_end,
                           full_missed_start=30,
                           full_missed_end=20)

    sge_opts = SgeOptions2(unique_id=123, blasr_nproc=args.cpus)

    # set min_match_len to (low_cDNA_size-max_missed_start-max_missed_end), rounded to lowest 100 bp
    ice_opts.detect_cDNA_size(args.flnc_fa)
    x = ice_opts.low_cDNA_size - ice_opts.max_missed_start - ice_opts.max_missed_end
    ice_opts.min_match_len = max(50, (x / 100) * 100)

    run_IceInit2(args.flnc_fa, args.output_pickle, ice_opts, sge_opts)
 def run(self):
     """Execute ice_quiver.py all|i|merge|postprocess."""
     cmd = self.args.subCommand
     logging.info("Running {f} {cmd} v{v}.".format(f=op.basename(__file__),
                                                   cmd=cmd,
                                                   v=get_version()))
     cmd_str = ""
     try:
         args = self.args
         obj = None
         if cmd == "all":
             sge_opts = SgeOptions2(unique_id=args.unique_id,
                                    use_sge=args.use_sge,
                                    max_sge_jobs=args.max_sge_jobs,
                                    blasr_nproc=args.blasr_nproc,
                                    arrow_nproc=args.arrow_nproc,
                                    sge_env_name=args.sge_env_name,
                                    sge_queue=args.sge_queue,
                                    qsub_extra=args.qsub_extra)
             ipq_opts = IceArrowHQLQOptions2(
                 hq_isoforms_fa=args.hq_isoforms_fa,
                 hq_isoforms_fq=args.hq_isoforms_fq,
                 lq_isoforms_fa=args.lq_isoforms_fa,
                 lq_isoforms_fq=args.lq_isoforms_fq,
                 qv_trim_5=args.qv_trim_5,
                 qv_trim_3=args.qv_trim_3,
                 hq_arrow_min_accuracy=args.hq_arrow_min_accuracy)
             obj = IceArrowAll2(root_dir=args.root_dir,
                                subread_xml=args.subread_xml,
                                sge_opts=sge_opts,
                                ipq_opts=ipq_opts,
                                tmp_dir=args.tmp_dir)
         # elif cmd == "i":
         #     sge_opts = SgeOptions(unique_id=args.unique_id,
         #                           use_sge=args.use_sge,
         #                           max_sge_jobs=args.max_sge_jobs,
         #                           blasr_nproc=args.blasr_nproc,
         #                           arrow_nproc=args.arrow_nproc)
         #     obj = IceQuiverI(root_dir=args.root_dir, i=args.i, N=args.N,
         #                      bas_fofn=args.bas_fofn,
         #                      fasta_fofn=None,
         #                      sge_opts=sge_opts,
         #                      tmp_dir=args.tmp_dir)
         #elif cmd == "merge":
         #    obj = IceQuiverMerge(root_dir=args.root_dir, N=args.N)
         elif cmd == "postprocess":
             ipq_opts = IceArrowHQLQOptions2(
                 hq_isoforms_fa=args.hq_isoforms_fa,
                 hq_isoforms_fq=args.hq_isoforms_fq,
                 lq_isoforms_fa=args.lq_isoforms_fa,
                 lq_isoforms_fq=args.lq_isoforms_fq,
                 qv_trim_5=args.qv_trim_5,
                 qv_trim_3=args.qv_trim_3,
                 hq_arrow_min_accuracy=args.hq_arrow_min_accuracy,
                 hq_min_full_length_reads=args.hq_min_full_length_reads)
             obj = IceArrowPostProcess2(
                 root_dir=args.root_dir,
                 ipq_opts=ipq_opts,
                 quit_if_not_done=args.quit_if_not_done,
                 summary_fn=args.summary_fn,
                 report_fn=args.report_fn)
         else:
             raise ValueError(
                 "Unknown command passed to {f}: {cmd}.".format(
                     f=op.basename(__file__), cmd=cmd))
         cmd_str = obj.cmd_str()
         logging.info("Running CMD: {cmd_str}".format(cmd_str=cmd_str))
         obj.run()
     except:
         logging.exception("Exiting {cmd_str} with return code 1.".format(
             cmd_str=cmd_str))
         return 1
     return 0