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 |
|
|