From: Noel O'B. <no...@ca...> - 2006-01-04 14:21:40
|
Happy New Year! I am trying to read a PDB file into an OBMol with Python but without any luck. ---------------------------- from openbabel import * mymol = OBMol() a = OBConversion() a.SetInFormat("pdb") # Also tried PDB a.ReadFile(mymol,"1crn.pdb") # PDB file taken from the test file repository # Segmentation Fault ---------------------------- I am also having difficulty finding out (from within Python) what file formats are supported. The following C++ code snippet is in the documentation for OBConversion: ----------------------------- bool GetNextFormat ( Formatpos & itr, const char *& str, OBFormat *& pFormat ) [static] Repeatedly called to recover available Formats. Returns the ID + the first line of the description in str and a pointer to the format in pFormat. If called with str==NULL the first format is returned; subsequent formats are returned by calling with str!=NULL and the previous value of itr returns false, and str and pFormat NULL, when there are no more formats. Use like: const char* str=NULL; Formatpos pos; while(OBConversion::GetNextFormat(pos,str,pFormat)) { use str and pFormat } ----------------------------- However, there is no openbabel.Formatpos. Is there any other way of doing this? Regards, Noel |