13 |
|
GNU General Public License for more details. |
14 |
|
***********************************************************************/ |
15 |
|
|
16 |
< |
#include "babelconfig.hpp" |
17 |
< |
#include "mol.hpp" |
18 |
< |
#include "obconversion.hpp" |
19 |
< |
#include "obmolecformat.hpp" |
16 |
> |
#include "pdbformat.hpp" |
17 |
|
|
18 |
+ |
|
19 |
|
#if !HAVE_SNPRINTF |
20 |
|
extern "C" int snprintf( char *, size_t, const char *, /* args */ ...); |
21 |
|
#endif |
33 |
|
namespace OpenBabel |
34 |
|
{ |
35 |
|
|
38 |
– |
class PDBFormat : public OBMoleculeFormat |
39 |
– |
{ |
40 |
– |
public: |
41 |
– |
//Register this format type ID |
42 |
– |
PDBFormat() |
43 |
– |
{ |
44 |
– |
OBConversion::RegisterFormat("pdb",this, "chemical/x-pdb"); |
45 |
– |
OBConversion::RegisterFormat("ent",this, "chemical/x-pdb"); |
46 |
– |
} |
47 |
– |
|
48 |
– |
virtual const char* Description() //required |
49 |
– |
{ |
50 |
– |
return |
51 |
– |
"Protein Data Bank format\n \ |
52 |
– |
Read Options e.g. -as\n\ |
53 |
– |
s Output single bonds only\n\ |
54 |
– |
b Disable bonding entirely\n\n"; |
55 |
– |
}; |
56 |
– |
|
57 |
– |
virtual const char* SpecificationURL() |
58 |
– |
{ return "http://www.rcsb.org/pdb/docs/format/pdbguide2.2/guide2.2_frame.html";}; |
59 |
– |
|
60 |
– |
virtual const char* GetMIMEType() |
61 |
– |
{ return "chemical/x-pdb"; }; |
62 |
– |
|
63 |
– |
//Flags() can return be any the following combined by | or be omitted if none apply |
64 |
– |
// NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY |
65 |
– |
virtual unsigned int Flags() |
66 |
– |
{ |
67 |
– |
return READONEONLY; |
68 |
– |
}; |
69 |
– |
|
70 |
– |
//*** This section identical for most OBMol conversions *** |
71 |
– |
//////////////////////////////////////////////////// |
72 |
– |
/// The "API" interface functions |
73 |
– |
virtual bool ReadMolecule(OBBase* pOb, OBConversion* pConv); |
74 |
– |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
75 |
– |
|
76 |
– |
}; |
77 |
– |
//*** |
78 |
– |
|
79 |
– |
//Make an instance of the format class |
80 |
– |
PDBFormat thePDBFormat; |
81 |
– |
|
82 |
– |
///////////////////////////////////////////////////////////////// |
83 |
– |
|
84 |
– |
|
36 |
|
static bool ParseAtomRecord(char *, OBMol &,int); |
37 |
|
static bool ParseConectRecord(char *,OBMol &); |
38 |
|
|
364 |
|
<< " According to the PDB specification,\n" |
365 |
|
<< " the record should have 70 columns, but OpenBabel found " |
366 |
|
<< strlen(buffer) << " columns."; |
367 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obInfo); |
367 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obInfo); |
368 |
|
} |
369 |
|
|
370 |
|
// Serial number of the first atom, read from column 7-11 of the |
377 |
|
<< " According to the PDB specification,\n" |
378 |
|
<< " columns 7-11 should contain the serial number of an atom.\n" |
379 |
|
<< " THIS CONECT RECORD WILL BE IGNORED."; |
380 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
380 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
381 |
|
return(false); |
382 |
|
} |
383 |
|
|
399 |
|
<< " columns 7-11 should contain the serial number of an atom.\n" |
400 |
|
<< " No atom was found with this serial number.\n" |
401 |
|
<< " THIS CONECT RECORD WILL BE IGNORED."; |
402 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
402 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
403 |
|
return(false); |
404 |
|
} |
405 |
|
|
448 |
|
<< " should be connected\n" |
449 |
|
<< " However, an atom with serial #" << boundedAtomsSerialNumbers[k] << " was not found.\n" |
450 |
|
<< " THIS CONECT RECORD WILL BE IGNORED."; |
451 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
451 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
452 |
|
break; |
453 |
|
} |
454 |
|
|