예제 #1
0
def make_restraints_from_mmcif_dict_single(cif_file_name_in, comp_id,
                                           mogul_dir, output_postfix,
                                           quartet_planes,
                                           quartet_hydrogen_planes, use_mmff,
                                           pdb_out_file_name,
                                           mmcif_restraints_out_file_name):

    # print 'in make_restraints_from_mmcif_dict_single() comp_id is ', comp_id
    # print 'in make_restraints_from_mmcif_dict_single() cif_file_name_in is ', cif_file_name_in

    if not test_for_mogul():
        return [(None, None)]

    mogul_file_name_stub = comp_id + '-' + output_postfix  # file component of files within mogul_dir

    m = pyrogen_boost.rdkit_mol_chem_comp_pdbx(cif_file_name_in, comp_id)

    if False:  # debugging
        for atom in m.GetAtoms():
            try:
                name = atom.GetProp('name')
                chir = atom.GetProp('_CIPCode')
                print ' atom', atom, 'name', name, 'chir', chir
            except KeyError as e:
                print 'pyrogen.py:: atom', atom, " with name ", name, ' has no _CIPCode property'
                pass

    # maybe user didn't select the correct comp_id for the given dictionary mmcif
    if m.GetNumAtoms() == 0:
        print 'No atoms for comp_id', comp_id
        return False
    else:

        name = ''
        try:
            name = m.GetProp('_Name')
        except KeyError:
            print 'caught KeyError in make_restraints_from_mmcif_dict_single() trying GetProp _Name'

        return make_restraints(m, comp_id, mogul_dir, mogul_file_name_stub,
                               pdb_out_file_name,
                               mmcif_restraints_out_file_name, quartet_planes,
                               quartet_hydrogen_planes, use_mmff, False, False,
                               False)
예제 #2
0
파일: pyrogen.py 프로젝트: hksonngan/coot
def make_restraints_from_mmcif_dict_single(cif_file_name_in, comp_id, mogul_dir, output_postfix,
					   quartet_planes, quartet_hydrogen_planes, use_mmff,
                                           pdb_out_file_name, mmcif_restraints_out_file_name):

   # print 'in make_restraints_from_mmcif_dict_single() comp_id is ', comp_id
   # print 'in make_restraints_from_mmcif_dict_single() cif_file_name_in is ', cif_file_name_in

   if not test_for_mogul():
       return [(None, None)]
    
   mogul_file_name_stub = comp_id + '-' + output_postfix # file component of files within mogul_dir

   m = pyrogen_boost.rdkit_mol_chem_comp_pdbx(cif_file_name_in, comp_id)

   if False:  # debugging
      for atom in m.GetAtoms():
         try:
            name   = atom.GetProp('name')
            chir   = atom.GetProp('_CIPCode')
            print ' atom', atom, 'name', name, 'chir', chir
         except KeyError as e:
            print 'pyrogen.py:: atom', atom, " with name ", name, ' has no _CIPCode property'
            pass


   # maybe user didn't select the correct comp_id for the given dictionary mmcif
   if m.GetNumAtoms() == 0:
      print 'No atoms for comp_id', comp_id
      return False
   else :

      name = ''
      try:
         name = m.GetProp('_Name')
      except KeyError:
         print 'caught KeyError in make_restraints_from_mmcif_dict_single() trying GetProp _Name'

      return make_restraints(m, comp_id, mogul_dir, mogul_file_name_stub,
                             pdb_out_file_name, mmcif_restraints_out_file_name,
                             quartet_planes, quartet_hydrogen_planes, use_mmff, False, False, False)
예제 #3
0
파일: pyrogen.py 프로젝트: hksonngan/coot
        # ------------------------ Tautomers and SMILES  ---------------------------------------------

	mol = False
	if len(args) > 0:
	    smi_raw = args[0]
	    smiles,compound_name = smiles_and_name_from(smi_raw)
	    mol = Chem.MolFromSmiles(smiles)
	else:
	    if options.sdf_file != None:
		mol = Chem.MolFromMolFile(options.sdf_file)
	    else:
		if options.mmcif_file_name != None:
		    types = pysw.types_from_mmcif_dictionary(options.mmcif_file_name)
		    print '-- tautomer mode: mmcif file types:', types
		    for type in types:
			mol_local = pyrogen_boost.rdkit_mol_chem_comp_pdbx(options.mmcif_file_name, type)
			score_and_print_tautomers(mol_local, type, options.output_postfix, options.drawing)

	if mol:
           if options.show_tautomers:
              score_and_print_tautomers(mol, comp_id, options.output_postfix, options.drawing)
           if options.show_smiles:
              s = Chem.MolToSmiles(mol);
              print s

    else:

        # ------------------------ dict-build-mode ---------------------------------------------------

        mmcif_file_name = options.mmcif_file_name
        # shall we go get the dictionary?
예제 #4
0
파일: pyrogen.py 프로젝트: wojdyr/coot
        # ------------------------ Tautomers and SMILES  ---------------------------------------------

	mol = False
	if len(args) > 0:
	    smi_raw = args[0]
	    smiles,compound_name = smiles_and_name_from(smi_raw)
	    mol = Chem.MolFromSmiles(smiles)
	else:
	    if options.sdf_file != None:
		mol = Chem.MolFromMolFile(options.sdf_file)
	    else:
		if options.mmcif_file_name != None:
		    types = pysw.types_from_mmcif_dictionary(options.mmcif_file_name)
		    print '-- tautomer mode: mmcif file types:', types
		    for type in types:
			mol_local = pyrogen_boost.rdkit_mol_chem_comp_pdbx(options.mmcif_file_name, type)
			score_and_print_tautomers(mol_local, type, options.output_postfix, options.drawing)

	if mol:
           if options.show_tautomers:
              score_and_print_tautomers(mol, comp_id, options.output_postfix, options.drawing)
           if options.show_smiles:
              s = Chem.MolToSmiles(mol);
              print s

    else:

        # ------------------------ dict-build-mode ---------------------------------------------------

        mmcif_file_name = options.mmcif_file_name
        # shall we go get the dictionary?