Exemplo n.º 1
0
            self.ligand_file_restr, umax, rest_kf, nlambdas, lambda_list,
            nlambdas, nlambdas - 1)
        f = open(impact_input_file, "w")
        f.write(input)
        f.close()


##################### MAIN CODE ##########################
if __name__ == '__main__':

    # Setup the logger
    logger = schrodinger.utils.log.get_output_logger("bedam_prep_ac")

    # Parse arguments:
    usage = "%prog [options] <inputfile>"
    parser = cmdline.SingleDashOptionParser(usage)
    (options, args) = parser.parse_args(sys.argv[1:])

    if len(args) != 1:
        parser.error("Please specify ONE input file")

    commandFile = args[0]

    print ""
    print "========================================================="
    print "       BEDAM Job Preparation Using Academic IMPACT       "
    print "========================================================="
    print ""
    print "SCHRODINGER: " + os.environ['SCHRODINGER']
    print "Started at: " + str(time.asctime())
    print "Input file:", commandFile
Exemplo n.º 2
0
def parse_command_line():

    usage = """
$SCHRODINGER/run desalt_smiles.py <file> [options]"""

    description = """This version of the SMILES desalting script will remove
common salts and solvents from SMILES strings using an internal library.
SMILES, SDF and Maestro input and output formats can be used. However, the
script will internally convert all structures to canonical SMILES prior to
removing the salt.

If a salt(s) is detected and the salt(s) is unknown, both the compound and the
salt(s) will be written to a separate file. The user has the option to override
this behavior and simply return the largest molecule in the SMILES string. If
a single entry contains duplicate molecules, the first molecule will be retained.
"""
    _version = '$Revision: 3.4 $'

    parser = cmdline.SingleDashOptionParser(usage=usage,
                                            description=description,
                                            version_source=_version)

    parser.add_option(
        "-l",
        dest="override",
        action="store_true",
        default=False,
        help=
        "For SMILES strings containing unknown salts, return the largest single molecule in the SMILES string. The default behavior is to write the entire entry to a separate file."
    )
    parser.add_option(
        "-name",
        type="string",
        dest="name",
        default="",
        help=
        "Field in a SD or Maestro file that can be used to overwrite the name of molecules."
    )
    parser.add_option(
        "-o",
        type="string",
        dest="output_file",
        default="",
        metavar="file",
        help=
        "Desalted structure output file. Valid formats are SMILES, Maestro or SDF format."
    )

    (options, args) = parser.parse_args()

    # Check for input files and output options

    if len(args) == 0:
        print "No input file specified."
        parser.print_help()
        sys.exit(1)
    elif len(args) >= 2:
        print "Cannot specify multiple input files."
        parser.print_help()
        sys.exit(1)
    elif not os.path.exists(args[0]):
        print "\nError: Input file '%s' not found.\n" % args[0]
        sys.exit(1)

    out = False
    out_format = ""

    in_format = get_structure_file_format(args[0])

    if in_format != "smiles" and in_format != "sd" and in_format != "maestro":
        print "\nError: Unrecognized file format.\n"
        sys.exit(1)

    if options.output_file != "":
        if os.path.exists(options.output_file):
            print "\nError: Output file '%s' already exists.\n" % options.output_file
            sys.exit(1)

        out_format = get_structure_file_format(options.output_file)

        if out_format == "smiles":
            out = True
        elif out_format == "sd":
            out = True
        elif out_format == "maestro":
            out = True
        elif out == False:
            print ""
            print "Not a valid output format"
            print ""
            parser.print_help()
            sys.exit(1)
    elif options.output_file == "":
        out_format = in_format

    return (options, args, in_format, out_format, out)