def main(args=None): args = parser.parse_args(args) outfile = sys.stdout cmdsupport.mutual_exclusion( parser, args, "sim", ("sim", "sub", "sub_res", "sub_tau", "full", "substruct", "rdmaccs")) if args.sim: opener = types.get_fingerprint_family("Indigo-Similarity")() elif args.sub: opener = types.get_fingerprint_family("Indigo-Substructure")() elif args.sub_res: opener = types.get_fingerprint_family("Indigo-ResonanceSubstructure")() elif args.sub_tau: opener = types.get_fingerprint_family("Indigo-TautomerSubstructure")() elif args.full: opener = types.get_fingerprint_family("Indigo-Full")() elif args.substruct: opener = types.get_fingerprint_family("ChemFP-Substruct-Indigo")() elif args.rdmaccs: opener = types.get_fingerprint_family("RDMACCS-Indigo")() else: parser.error("should not get here") # Ready the input reader/iterator try: reader = opener.read_structure_fingerprints(args.filename, args.format) except IOError, err: sys.stderr.write("Cannot read structures: %s" % (err, )) raise SystemExit(1)
def main(args=None): args = parser.parse_args(args) outfile = sys.stdout cmdsupport.mutual_exclusion(parser, args, "sim", ("sim", "sub", "sub_res", "sub_tau", "full", "substruct", "rdmaccs" )) if args.sim: opener = types.get_fingerprint_family("Indigo-Similarity")() elif args.sub: opener = types.get_fingerprint_family("Indigo-Substructure")() elif args.sub_res: opener = types.get_fingerprint_family("Indigo-ResonanceSubstructure")() elif args.sub_tau: opener = types.get_fingerprint_family("Indigo-TautomerSubstructure")() elif args.full: opener = types.get_fingerprint_family("Indigo-Full")() elif args.substruct: opener = types.get_fingerprint_family("ChemFP-Substruct-Indigo")() elif args.rdmaccs: opener = types.get_fingerprint_family("RDMACCS-Indigo")() else: parser.error("should not get here") # Ready the input reader/iterator try: reader = opener.read_structure_fingerprints(args.filename, args.format) except IOError, err: sys.stderr.write("Cannot read structures: %s" % (err,)) raise SystemExit(1)
def main(args=None): args = parser.parse_args(args) outfile = sys.stdout cmdsupport.mutual_exclusion( parser, args, "FP2", ("FP2", "FP3", "FP4", "MACCS", "substruct", "rdmaccs")) if args.FP2: opener = types.get_fingerprint_family("OpenBabel-FP2")() elif args.FP3: opener = types.get_fingerprint_family("OpenBabel-FP3")() elif args.FP4: opener = types.get_fingerprint_family("OpenBabel-FP4")() elif args.MACCS: if not ob.HAS_MACCS: parser.error( "--MACCS is not supported in your OpenBabel installation (%s)" % (ob.GetReleaseVersion(), )) opener = types.get_fingerprint_family("OpenBabel-MACCS")() elif args.substruct: opener = types.get_fingerprint_family("ChemFP-Substruct-OpenBabel")() elif args.rdmaccs: opener = types.get_fingerprint_family("RDMACCS-OpenBabel")() else: parser.error("should not get here") if not ob.is_valid_format(args.format): parser.error("Unsupported format specifier: %r" % (args.format, )) if not cmdsupport.is_valid_tag(args.id_tag): parser.error("Invalid id tag: %r" % (args.id_tag, )) missing = cmdsupport.check_filenames(args.filenames) if missing: parser.error("Structure file %r does not exist" % (missing, )) # Ready the input reader/iterator metadata, reader = cmdsupport.read_multifile_structure_fingerprints( opener, args.filenames, format=args.format, id_tag=args.id_tag, aromaticity=None, errors=args.errors) try: io.write_fps1_output(reader, args.output, metadata) except ParseError, err: sys.stderr.write("ERROR: %s. Exiting." % (err, )) raise SystemExit(1)
def main(args=None): args = parser.parse_args(args) outfile = sys.stdout cmdsupport.mutual_exclusion(parser, args, "FP2", ("FP2", "FP3", "FP4", "MACCS", "substruct", "rdmaccs")) if args.FP2: opener = types.get_fingerprint_family("OpenBabel-FP2")() elif args.FP3: opener = types.get_fingerprint_family("OpenBabel-FP3")() elif args.FP4: opener = types.get_fingerprint_family("OpenBabel-FP4")() elif args.MACCS: if not ob.HAS_MACCS: parser.error( "--MACCS is not supported in your OpenBabel installation (%s)" % ( ob.GetReleaseVersion(),)) opener = types.get_fingerprint_family("OpenBabel-MACCS")() elif args.substruct: opener = types.get_fingerprint_family("ChemFP-Substruct-OpenBabel")() elif args.rdmaccs: opener = types.get_fingerprint_family("RDMACCS-OpenBabel")() else: parser.error("should not get here") if not ob.is_valid_format(args.format): parser.error("Unsupported format specifier: %r" % (args.format,)) if not cmdsupport.is_valid_tag(args.id_tag): parser.error("Invalid id tag: %r" % (args.id_tag,)) missing = cmdsupport.check_filenames(args.filenames) if missing: parser.error("Structure file %r does not exist" % (missing,)) # Ready the input reader/iterator metadata, reader = cmdsupport.read_multifile_structure_fingerprints( opener, args.filenames, format = args.format, id_tag = args.id_tag, aromaticity = None, errors = args.errors) try: io.write_fps1_output(reader, args.output, metadata) except ParseError, err: sys.stderr.write("ERROR: %s. Exiting." % (err,)) raise SystemExit(1)
def test_make_fingerprinter_from_type_with_empty_string(self): family = types.get_fingerprint_family("OpenEye-Path") with self.assertRaisesRegexp(ValueError, r"Empty fingerprint type \(''\)"): family.make_fingerprinter_from_type("")