Xmipp  v3.23.11-Nereus
Public Member Functions | List of all members
cif::CCP4_compound_factory_impl Class Reference
Inheritance diagram for cif::CCP4_compound_factory_impl:
Inheritance graph
[legend]
Collaboration diagram for cif::CCP4_compound_factory_impl:
Collaboration graph
[legend]

Public Member Functions

 CCP4_compound_factory_impl (const fs::path &clibd_mon, std::shared_ptr< compound_factory_impl > next=nullptr)
 
compound * create (const std::string &id) override
 
- Public Member Functions inherited from cif::compound_factory_impl
 compound_factory_impl (std::shared_ptr< compound_factory_impl > next)
 
 compound_factory_impl (const fs::path &file, std::shared_ptr< compound_factory_impl > next)
 
virtual ~compound_factory_impl ()
 
compound * get (std::string id)
 
std::shared_ptr< compound_factory_implnext () const
 
bool is_known_peptide (const std::string &resName)
 
bool is_known_base (const std::string &resName)
 

Additional Inherited Members

- Protected Attributes inherited from cif::compound_factory_impl
std::shared_timed_mutex mMutex
 
std::vector< compound * > m_compounds
 
std::set< std::string > m_known_peptides
 
std::set< std::string > m_known_bases
 
std::set< std::string > m_missing
 
std::shared_ptr< compound_factory_implm_next
 

Detailed Description

Definition at line 564 of file compound.cpp.

Constructor & Destructor Documentation

◆ CCP4_compound_factory_impl()

cif::CCP4_compound_factory_impl::CCP4_compound_factory_impl ( const fs::path &  clibd_mon,
std::shared_ptr< compound_factory_impl next = nullptr 
)

Definition at line 576 of file compound.cpp.

578  , m_file((clibd_mon / "list" / "mon_lib_list.cif").string())
579  , m_CLIBD_MON(clibd_mon)
580 {
581  const std::regex peptideRx("(?:[lmp]-)?peptide", std::regex::icase);
582 
583  auto &chemComps = m_file["comp_list"]["chem_comp"];
584 
585  for (const auto &[group, threeLetterCode] : chemComps.rows<std::string, std::string>("group", "three_letter_code"))
586  {
587  if (std::regex_match(group, peptideRx))
588  m_known_peptides.insert(threeLetterCode);
589  else if (cif::iequals(group, "DNA") or cif::iequals(group, "RNA"))
590  m_known_bases.insert(threeLetterCode);
591  }
592 }
bool iequals(std::string_view a, std::string_view b)
Definition: text.cpp:59
compound_factory_impl(std::shared_ptr< compound_factory_impl > next)
Definition: compound.cpp:378
std::set< std::string > m_known_peptides
Definition: compound.cpp:370
std::set< std::string > m_known_bases
Definition: compound.cpp:371
std::shared_ptr< compound_factory_impl > next() const
Definition: compound.cpp:343

Member Function Documentation

◆ create()

compound * cif::CCP4_compound_factory_impl::create ( const std::string &  id)
overridevirtual

Reimplemented from cif::compound_factory_impl.

Definition at line 594 of file compound.cpp.

595 {
596  compound *result = nullptr;
597 
598  auto &cat = m_file["comp_list"]["chem_comp"];
599 
600  auto rs = cat.find(cif::key("three_letter_code") == id);
601 
602  if (rs.size() == 1)
603  {
604  auto row = rs.front();
605 
606  std::string name, group;
607  uint32_t numberAtomsAll, numberAtomsNh;
608  cif::tie(name, group, numberAtomsAll, numberAtomsNh) =
609  row.get("name", "group", "number_atoms_all", "number_atoms_nh");
610 
611  fs::path resFile = m_CLIBD_MON / cif::to_lower_copy(id.substr(0, 1)) / (id + ".cif");
612 
613  if (not fs::exists(resFile) and (id == "COM" or id == "CON" or "PRN")) // seriously...
614  resFile = m_CLIBD_MON / cif::to_lower_copy(id.substr(0, 1)) / (id + '_' + id + ".cif");
615 
616  if (fs::exists(resFile))
617  {
618  cif::file cf(resFile.string());
619 
620  // locate the datablock
621  auto &db = cf["comp_" + id];
622 
623  std::string type;
624 
625  // known groups are (counted from ccp4 monomer dictionary)
626 
627  // D-pyranose
628  // DNA
629  // L-PEPTIDE LINKING
630  // L-SACCHARIDE
631  // L-peptide
632  // L-pyranose
633  // M-peptide
634  // NON-POLYMER
635  // P-peptide
636  // RNA
637  // furanose
638  // non-polymer
639  // non_polymer
640  // peptide
641  // pyranose
642  // saccharide
643 
644  if (cif::iequals(id, "gly"))
645  type = "peptide linking";
646  else if (cif::iequals(group, "l-peptide") or cif::iequals(group, "L-peptide linking") or cif::iequals(group, "peptide") or cif::iequals(group, "p-peptide"))
647  type = "L-peptide linking";
648  else if (cif::iequals(group, "DNA"))
649  type = "DNA linking";
650  else if (cif::iequals(group, "RNA"))
651  type = "RNA linking";
652  else
653  type = "non-polymer";
654 
655  m_compounds.push_back(new compound(db, id, name, type, group));
656  result = m_compounds.back();
657  }
658  }
659 
660  return result;
661 }
std::vector< compound * > m_compounds
Definition: compound.cpp:369
bool iequals(std::string_view a, std::string_view b)
Definition: text.cpp:59
std::string to_lower_copy(std::string_view s)
Definition: text.cpp:120
if(fabs(c[*nmax+ *nmax *c_dim1])==0.e0)
viol type

The documentation for this class was generated from the following file: