19 #ifndef OST_MMCIF_READER_HH
20 #define OST_MMCIF_READER_HH
34 namespace ost {
namespace io {
69 MMCifReader(std::istream& stream, mol::EntityHandle& ent_handle,
70 const IOProfile& profile);
77 MMCifReader(
const String& filename, mol::EntityHandle& ent_handle,
78 const IOProfile& profile);
90 void SetRestrictChains(
const String& restrict_chains);
104 return restrict_chains_;
122 virtual bool OnBeginData(
const StringRef& data_name);
136 const std::vector<StringRef>& columns);
139 virtual void OnEndData();
180 indices_[mapping] = header.
GetIndex(item);
182 if (indices_[mapping] == -1) {
188 this->GetCurrentLinenum()));
205 bool ParseAtomIdent(
const std::vector<StringRef>& columns,
217 void ParseAndAddAtom(
const std::vector<StringRef>& columns);
222 void ParseEntity(
const std::vector<StringRef>& columns);
227 void ParseEntityPoly(
const std::vector<StringRef>& columns);
232 void ParseCitation(
const std::vector<StringRef>& columns);
247 void ParseCitationAuthor(
const std::vector<StringRef>& columns);
250 void ParseStructRef(
const std::vector<StringRef>& columns);
253 void ParseStructRefSeq(
const std::vector<StringRef>& columns);
256 void ParseStructRefSeqDif(
const std::vector<StringRef>& columns);
260 void ParseExptl(
const std::vector<StringRef>& columns);
265 void ParseRefine(
const std::vector<StringRef>& columns);
270 void ParsePdbxStructAssembly(
const std::vector<StringRef>& columns);
275 void ParsePdbxStructAssemblyGen(
const std::vector<StringRef>& columns);
277 std::vector<std::vector<String> > UnPackOperExperession(
StringRef expression);
279 void StoreExpression(
const char* l,
const char* s,
280 bool& is_range,
int lborder,
281 std::vector<String>& single_block);
283 void StoreRange(
const char*& l,
const char* s,
bool& is_range,
int& lborder,
284 std::vector<String>& single_block);
289 void ParsePdbxStructOperList(
const std::vector<StringRef>& columns);
294 void ParseDatabasePDBRev(
const std::vector<StringRef>& columns);
299 void ParsePdbxAuditRevisionHistory(
const std::vector<StringRef>& columns);
304 void ParsePdbxAuditRevisionDetails(
const std::vector<StringRef>& columns);
309 void ParsePdbxDatabaseStatus(
const std::vector<StringRef>& columns);
314 void ParseStruct(
const std::vector<StringRef>& columns);
319 void ParseStructConf(
const std::vector<StringRef>& columns);
324 void ParseStructSheetRange(
const std::vector<StringRef>& columns);
329 void ParsePdbxDatabasePdbObsSpr(
const std::vector<StringRef>& columns);
334 void ParsePdbxEntityBranch(
const std::vector<StringRef>& columns);
339 void ParsePdbxEntityBranchLink(
const std::vector<StringRef>& columns);
347 } MMCifSecStructElement;
352 MMCifSecStructElement DetermineSecStructType(
const StringRef& type)
const;
399 PDBX_SEQ_ONE_LETTER_CODE,
400 PDBX_SEQ_ONE_LETTER_CODE_CAN
415 PDBX_DATABASE_ID_DOI,
416 PDBX_DATABASE_ID_PUBMED,
426 } CitationAuthorItems;
448 } PdbxStructAssemblyItems;
476 } StructRefSeqDifItems;
483 } PdbxStructAssemblyGenItems;
501 } PdbxStructOperListItems;
509 PDBX_FORMULA_WEIGHT_METHOD,
511 PDBX_MODEL_TYPE_DETAILS,
518 SC_BEG_LABEL_ASYM_ID,
519 SC_BEG_LABEL_COMP_ID,
523 SC_END_LABEL_ASYM_ID,
524 SC_END_LABEL_COMP_ID,
531 SSR_BEG_LABEL_ASYM_ID,
532 SSR_BEG_LABEL_COMP_ID,
533 SSR_BEG_LABEL_SEQ_ID,
534 SSR_END_LABEL_ASYM_ID,
535 SSR_END_LABEL_COMP_ID,
536 SSR_END_LABEL_SEQ_ID,
539 SSR_BEG_AUTH_ASYM_ID,
540 SSR_END_AUTH_ASYM_ID,
541 } StructSheetRangeItems;
549 } PdbxDatabasePDBObsSpr;
557 } DatabasePDBRevItems;
565 } PdbxAuditRevisionHistoryItems;
569 PARD_REVISION_ORDINAL,
571 } PdbxAuditRevisionDetailsItems;
575 PDS_RECVD_INITIAL_DEPOSITION_DATE,
576 } PdbxDatabaseStatusItems;
591 BL_ENTITY_BRANCH_LIST_NUM_1,
592 BL_ENTITY_BRANCH_LIST_NUM_2,
593 BL_ATOM_STEREO_CONFIG_1,
594 BL_ATOM_STEREO_CONFIG_2,
596 } EntityBranchLinkItems;
607 PDBX_STRUCT_ASSEMBLY,
608 PDBX_STRUCT_ASSEMBLY_GEN,
609 PDBX_STRUCT_OPER_LIST,
613 PDBX_DATABASE_PDB_OBS_SPR,
618 PDBX_AUDIT_REVISION_HISTORY,
619 PDBX_AUDIT_REVISION_DETAILS,
620 PDBX_DATABASE_STATUS,
622 PDBX_ENTITY_BRANCH_LINK,
632 typedef std::map<String, MMCifEntityDesc> MMCifEntityDescMap;
637 MMCifEntityDescMap::iterator GetEntityDescMapIterator(
const String& entity_id);
642 std::vector<String> chains;
643 std::vector<std::vector<String> > operations;
647 typedef std::vector<MMCifBioUAssembly> MMCifBioUAssemblyVector;
649 typedef std::map<String, std::pair<std::vector<int>, std::vector<String> > >
650 MMCifCitationAuthorMap;
658 typedef std::vector<MMCifHSEntry> MMCifHSVector;
665 typedef std::map<String, MMCifPSAEntry> MMCifPSAMap;
668 struct MMCifRevisionDesc {
670 MMCifRevisionDesc(
int _num,
const String& _date,
int _major,
int _minor)
690 unsigned char bond_order;
691 } MMCifPdbxEntityBranchLink;
692 typedef std::map<String, std::vector<MMCifPdbxEntityBranchLink> >
693 MMCifPdbxEntityBranchLinkMap;
696 MMCifCategory category_;
698 int indices_[MAX_ITEMS_IN_ROW];
699 const IOProfile& profile_;
700 mol::EntityHandle& ent_handle_;
704 mol::ChainHandle curr_chain_;
705 mol::ResidueHandle curr_residue_;
709 bool warned_name_mismatch_;
710 bool warned_rule_based_;
714 std::vector<std::pair<mol::ChainHandle, String> > chain_id_pairs_;
716 MMCifEntityDescMap entity_desc_map_;
720 MMCifCitationAuthorMap authors_map_;
721 MMCifBioUAssemblyVector bu_assemblies_;
722 MMCifPSAMap bu_origin_map_;
723 MMCifHSVector helix_list_;
724 MMCifHSVector strand_list_;
727 std::vector<MMCifRevisionDesc> revisions_;
728 std::map<int, String> revision_types_;
729 bool database_PDB_rev_added_;
731 MMCifPdbxEntityBranchLinkMap entity_branch_link_map_;
739 const StringRef value_order);
745 const unsigned char bond_order);
convenient datatype for referencing character data
void SetAuthChainID(bool id)
Enable or disable reading of auth_chain_id instead aof label_chain id (default)
container class for additional information from MMCif files
boost::shared_ptr< CompoundLibBase > CompoundLibBasePtr
const MMCifInfoStructRefs & GetStructRefs() const
seq::SequenceList GetSeqRes() const
Return sequences.
const String & GetRestrictChains() const
pointer_it< T > end(const std::vector< T > &values)
DLLEXPORT_OST_IO unsigned char MMCifValueOrderToOSTBondOrder(const StringRef value_order)
Translate mmCIF info on bond type (e.g. pdbx_entity_branch_link.value_order) to OST bond_order...
std::vector< MMCifInfoStructRefPtr > MMCifInfoStructRefs
DLLEXPORT_OST_IO String OSTBondOrderToMMCifValueOrder(const unsigned char bond_order)
Translate an OST bond_order to mmCIF value_order.
std::vector< SequenceImplPtr > SequenceList
void SetReadSeqRes(bool flag)
Toggle reading of SEQRES.
const MMCifInfo & GetInfo()
Get additional information of the mmCIF file.
void TryStoreIdx(const int mapping, const String &item, const StarLoopDesc &header)
Store an item index from loop header in preparation for reading a row. Throws an exception if the ite...
const String & GetCategory() const
int GetIndex(const String &name) const
void SetReadCanonicalSeqRes(bool flag)
Toggle reading of canonical sequence residues (entity_poly.pdbx_seq_one_letter_code_can instead of en...
bool GetReadSeqRes() const
Check if reading of SEQRES is enabled.