1
/*****************************************************************
2
* Unipro UGENE - Integrated Bioinformatics Suite
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
6
* This source code is distributed under the terms of the
7
* GNU General Public License. See the files COPYING and LICENSE
9
*****************************************************************/
11
#ifndef _GB2_PDB_FORMAT_H_
12
#define _GB2_PDB_FORMAT_H_
14
#include <core_api/DocumentFormats.h>
15
#include <core_api/DocumentModel.h>
16
#include <QtCore/QSharedDataPointer>
22
class AnnotationTableObject;
23
class DNASequenceObject;
25
typedef QSharedDataPointer<AtomData> SharedAtom;
29
class GB2_COREAPI_EXPORT PDBFormat : public DocumentFormat {
32
PDBFormat(QObject* p);
33
virtual DocumentFormatId getFormatId() const {return BaseDocumentFormats::PLAIN_PDB;}
34
virtual const QString& getFormatName() const {return formatName;}
35
virtual QStringList getSupportedDocumentFileExtensions();
36
virtual Document* loadExistingDocument(IOAdapterFactory* io, const QString& url, TaskStateInfo& ti, const QVariantMap& fs);
37
virtual void storeDocument(Document* d, TaskStateInfo& ti, IOAdapterFactory* io = NULL, const QString& newDocURL = QString::null);
38
virtual bool isObjectOpSupported(const Document* d , DocumentFormat::DocObjectOp op, GObjectType t) const;
39
virtual bool isDataFormatSupported(const char* data, int size) const;
40
virtual bool checkConstraints(const DocumentFormatConstraints& c) const;
41
static int getElementNumberByName(const QByteArray& elementName);
42
static double getAtomCovalentRadius(int atomicNumber);
43
static QChar getAcronymByName(const QByteArray& name);
47
static const int NUM_ELEMENTS = 120;
49
static QHash<QByteArray,int> atomNumMap;
50
static QHash<QByteArray, QChar> acronymNameMap;
51
static double atomRadiusTable[NUM_ELEMENTS];
53
void initUtilityMaps();
54
DNASequenceObject* createSequenceObject( const QByteArray& seq, const QByteArray& sequenceName);
55
void calculateBonds(BioStruct3D& bioStruct);
56
void fillBioStruct3DAnnotationTable(AnnotationTableObject* ao, const BioStruct3D& bioStruct);
63
QString currentPDBLine;
65
int currentMoleculeId;
66
bool flagMultipleModels;
67
bool flagAtomRecordPresent, flagSequenceRecordPresent;
68
QHash<QChar, int> chainIndexMap;
69
QMap<int, int> residueStartIndexMap;
70
QMap<int, int> unreferencedResidueStartIndexMap;
71
QVariantMap currentMoleculeDescr;
73
QByteArray getSpecValue(const QByteArray& specLine, const QByteArray& valueName);
74
int getChainIndexByName(const QChar& chainId);
75
void parseHeader(BioStruct3D& biostruct, TaskStateInfo& ti);
76
void parseCompound(BioStruct3D& biostruct, TaskStateInfo& ti);
77
void parseDBRef(BioStruct3D& biostruct, TaskStateInfo& ti);
78
void parseSequence(BioStruct3D& biostruct, TaskStateInfo& ti);
79
void parseSecondaryStructure(BioStruct3D& biostruct, TaskStateInfo& ti);
80
void parseHet(BioStruct3D& biostruct, TaskStateInfo& ti);
81
void parseAtomConnections(BioStruct3D& biostruct, TaskStateInfo& ti);
82
void parseAtom(BioStruct3D& biostruct, TaskStateInfo& ti);
83
QByteArray getNextSpecLine();
85
PDBParser(IOAdapter* io);
86
void parseBioStruct3D(BioStruct3D& biostruct, TaskStateInfo& ts);