Пример #1
0
    def _setup_base_options(self):
        RunRosetta._setup_base_options(self)

        if not self.options.json_benchmark:
            sys.exit(
                "No Benchmark Json Given.  This is currently required to run benchmarks."
            )

        self.extra_options = SetupRosettaOptionsBenchmark(
            self.options.json_benchmark)
        self._resolve_options()
Пример #2
0
    def __init__(self, program=None, parser=None):
        """
        Derived class for any set of Benchmarks in Rosetta

        """
        RunRosetta.__init__(self, program=program, parser=parser)

        self._current_settings = defaultdict()
        self._current_settings_ordered_keys = []

        self.key_bm_options = 'bm_options'
        self.key_bm_names = 'bm_names'

        self._setup_base_options()
Пример #3
0
    def _add_args(self, parser=None):
        RunRosetta._add_args(self, parser)

        ############################ RAbD Specific Options ################################

        benchmark_options = self.parser.add_argument_group(
            "Benchmark Options", "Options specific for Benchmarking")

        benchmark_options.add_argument(
            "--json_benchmark",
            help="JSON file for setting up specific benchmark")

        benchmark_options.add_argument(
            "--separate_job_per_pdb",
            default=False,
            action="store_true",
            help=
            "Separate each PDB in any PDB list given (to python app) into a separate Job and Directory"
        )
Пример #4
0
    def _get_output_string(self):

        s = RunRosetta._get_output_string(self)

        rosetta_opts = self.extra_options.get_benchmark_names(
            only_rosetta=True)
        for opt in rosetta_opts:
            #print opt
            s = s + " " + self.extra_options.get_rosetta_option_of_key(
                opt) + " " + str(self._current_settings[opt])

        return s
Пример #5
0
    def _get_make_mpi_tracer_dir(self):

        #print name

        if self.options.separate_job_per_pdb:
            log_path = self.base_options._get_make_log_root_dir()
            log_path = log_path + "." + path.get_decoy_name(
                self._current_settings['pdb'])

            if not os.path.exists(log_path):
                os.mkdir(log_path)
            return log_path
        else:
            return RunRosetta._get_make_mpi_tracer_dir(self)
def main():

    ####################################################################################################################
    ##                                                  OPTIONS
    ####################################################################################################################

    parser = ArgumentParser(
        "Creates Features Databases for antibody design using MPI.  "
        "This uses RunRosettaMPI, so that it can be run locally or on a cluster."
    )

    analysis_options = parser.add_argument_group(
        "RAbD Analyze",
        "Options specific for Analysis of RAbD Output Structures")

    ############################
    ## Required Options
    ############################
    #parser.add_argument("--PDBLIST",
    #                  help = "Analyze a PDBLIST of the strategy.  Relative or full paths",
    #                  default=None)

    analysis_options.add_argument(
        "--indir",
        help=
        "Input directory used for either PDBLIST path (if PDBLIST and this is given) or a path full of PDBs to analyze",
        default=None)

    analysis_options.add_argument(
        "--analysis",
        help="Analysis to run on PDBs",
        default="all",
        choices=["all", "cluster_features", "antibody_features"])

    analysis_options.add_argument(
        "--use_present_dbs",
        default=False,
        help="Do not attempt to delete features databases present",
        action="store_true")

    analysis_options.add_argument(
        "--db_prefix",
        help=
        "Prefix to use for output databases.  Recommended to use the design and strategy name",
        required=True)

    analysis_options.add_argument(
        "--native",
        help="Indicate that this is a set of native structures",
        default=False,
        action="store_true")

    run_mpi_rosetta = RunRosetta(program="rosetta_scripts",
                                 parser=parser,
                                 db_mode=True)

    options = parser.parse_args()

    if not options.l and not options.indir:
        sys.exit(
            "Cannot analyze strategy without a PDBLIST or an input directory full of PDBs"
        )
    if options.indir and not os.path.exists(options.indir):
        sys.exit(options.indir + " does not exist - cannot continue")

    if options.outdir == "decoys":
        run_mpi_rosetta._set_outdir("databases")

    ##### Get or make the path to the PDBLIST ######

    pdb_lists = []
    if not options.l and options.indir:
        if not options.native:
            pdb_lists = make_pdblists_non_native(options.indir)
        else:
            pdb_lists = make_pdblists_native(options.indir)
    elif options.l and options.indir:
        PDBLIST = open(options.l, 'r')
        NEW_PDBLIST = open(options.indir + "/FULLPATH_PDBLIST.txt", 'w')

        for line in PDBLIST:
            new_line = options.indir + "/" + line.strip()
            print "finding: " + new_line
            new_line = path.get_decoy_path(new_line)

            if not os.path.exists(new_line):
                sys.exit(new_line + " does not exist - cannot continue")

            NEW_PDBLIST.write(new_line + "\n")
        NEW_PDBLIST.close()
        PDBLIST.close()
        pdb_list = options.indir + "/FULLPATH_PDBLIST.txt"
        pdb_lists.append(["", pdb_list])
    else:
        pdb_lists.append(["", options.l])

    for pdb_list in pdb_lists:
        if not os.path.exists(pdb_list[1]):
            sys.exit(pdb_list[1] + " does not exist!")

    ####################################################################################################################
    ##                     Analysis Components.  One option for each type of analysis.
    ####################################################################################################################

    possible_names = [
        run_mpi_rosetta.options.db_prefix + "." + x + "_" +
        run_mpi_rosetta.options.db_name
        for x in ["ab", "cl", "rela_ab", "rela_cl", "norm_ab", "norm"]
    ]

    db_suffix = run_mpi_rosetta.options.db_name

    print repr(possible_names)
    if not options.use_present_dbs:
        rm_features_dbs(run_mpi_rosetta.options.outdir, possible_names)

    #### Create Features Databases ###
    starting_job_name = run_mpi_rosetta.options.job_name
    if starting_job_name == "rosetta_run":
        print "Using db_prefix as job name."
        starting_job_name = options.db_prefix

    for pdb_list in pdb_lists:
        print "PDBList " + repr(pdb_list)
        if options.analysis == "all" or options.analysis == "antibody_features":
            run_mpi_rosetta._set_json_run("antibody_features.json")
            run_mpi_rosetta.options.l = pdb_list[1]
            run_mpi_rosetta.options.db_name = options.db_prefix + "." + pdb_list[
                0] + "ab_" + db_suffix
            run_mpi_rosetta.options.job_name = starting_job_name + "." + pdb_list[
                0][0:-1] + "_ab"
            print "DB Name " + run_mpi_rosetta.options.db_name
            run_mpi_rosetta.run()
            '''
            create_features_db(pdb_list,
                           'antibody_features',  options.compiler,
                           options.score_weights, options.out_name,
                           options.out_db_batch, options.outdir, options.use_present_dbs, "", options.mpi, options.np)
            '''

        if options.analysis == "all" or options.analysis == "cluster_features":
            run_mpi_rosetta._set_json_run("cluster_features.json")
            run_mpi_rosetta.options.l = pdb_list[1]
            run_mpi_rosetta.options.db_name = options.db_prefix + "." + pdb_list[
                0] + "cl_" + db_suffix
            run_mpi_rosetta.options.job_name = starting_job_name + "." + pdb_list[
                0][0:-1] + "_cl"
            run_mpi_rosetta.run()
            '''
Пример #7
0
 def run_single():
     self._write_current_benchmark_file()
     RunRosetta.run(self)