20 import molfile_to_params
21 from rosetta
import Pose
22 from rosetta
import pose_from_pdb
23 from rosetta
import init
33 filename = urllib.urlretrieve(
'http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=' + cid +
'&disopt=3DDisplaySDF')[0]
35 raise IOError(
'Cannot access pubchem database, please check your Internet access')
37 if os.path.getsize(filename)>0:
38 sdfile =
open(filename)
39 sdfdata = sdfile.read()
44 sdffilename =
'CID_' + cid +
'.sdf'
45 sdfile =
open(sdffilename,
'w')
49 print 'CID',cid,
'successfully written to .sdf file',sdffilename
53 raise IOError(
'Invalid CID code')
65 if os.path.exists( os.getcwd() +
'/' + sdfile ):
66 converter = openbabel.OBConversion()
67 converter.SetInAndOutFormats(
'sdf',
'mdl')
68 mol = openbabel.OBMol()
69 converter.ReadFile(mol,sdfile)
70 print 'if the file',mdlfilename,
'already exists, it will be overwritten'
72 converted = converter.WriteFile(mol,mdlfilename)
74 print '.mdl file',mdlfilename,
' successfully written'
76 print 'Conversion Failed! could not produce the .mdl file',mdlfilename
78 raise IOError(
'No such file or directory named '+sdfile)
83 molfile_to_params.main([mdlfile,
'-n'+name])
94 Returns a "custom" ResidueTypeSet with the normal ResidueTypes and any
95 new ones added as a Vector1 of .params filenames,
96 the input <params_list>
99 res_set = generate_nonstandard_residue_set( Vector1( ['ATP.params'] ) )
106 res_set = ChemicalManager.get_instance().nonconst_residue_type_set(
108 atoms = ChemicalManager.get_instance().atom_type_set(
'fa_standard' )
109 mm_atoms = ChemicalManager.get_instance().mm_atom_type_set(
'fa_standard' )
110 orbitals = ChemicalManager.get_instance().orbital_type_set(
'fa_standard' )
114 elements = ChemicalManager.get_instance().element_set(
'default' )
115 res_set.read_files( params_list , atoms , elements , mm_atoms , orbitals )
119 res_set.read_files( params_list , atoms , mm_atoms , orbitals )
124 filename =
'CID_' + str(cid)
133 sdf2mdl( filename +
'.sdf' , filename +
'.mdl' )
143 database = os.path.abspath( os.environ[
'PYROSETTA_DATABASE'] )
144 fa_standard = database +
'/chemical/residue_type_sets/fa_standard/'
145 fa_custom =
'residue_types/custom'
149 start_dir = os.getcwd()
151 if not os.path( database + fa_standard + fa_custom ):
153 os.chdir( database + fa_standard +
'residue_types' )
156 os.chdir( database + fa_standard )
157 f =
open(
'residue_type_sets.txt' ,
'w' )
159 data.append(
'\n## Custom\n' )
162 os.chdir( database + fa_standard + fa_custom )
168 os.chdir( database + fa_standard )
169 f =
open(
'residue_type_sets.txt' ,
'w' )
171 data.append( fa_custom +
'/' + name +
'.params\n' )
193 pose_from_pdb( pose , res_set , name +
'_0001.pdb')
199 pose_from_pdb( pose , name +
'_0001.pdb' )
206 pose_from_pdb( pose , res_set , filename )
bool open(utility::io::izstream &db_stream, std::string const &db_file, bool warn)
Open a database file on a provided stream.
void init()
set global 'init_was_called' to true