Commit 3f5e6201 by Maarten L. Hekkelman

loading compound info, finished with error checking and verbose mode

parent 851a43ba
......@@ -3922,8 +3922,7 @@ std::string GetPDBSOURCELine(cif::File& cifFile, std::string::size_type truncate
{ "pdbx_host_org_vector_type", "EXPRESSION_SYSTEM_VECTOR_TYPE" },
{ "pdbx_host_org_vector", "EXPRESSION_SYSTEM_VECTOR" },
{ "pdbx_host_org_gene", "EXPRESSION_SYSTEM_GENE" },
{ "plasmid_name", "EXPRESSION_SYSTEM_PLASMID" },
{ "details", "OTHER_DETAILS" }
{ "plasmid_name", "EXPRESSION_SYSTEM_PLASMID" }
};
for (auto gr: gen.find(cif::Key("entity_id") == entityID))
......
......@@ -621,8 +621,14 @@ CompoundFactory::CompoundFactory()
const char *clibd_mon = getenv("CLIBD_MON");
if (clibd_mon != nullptr and fs::is_directory(clibd_mon))
mImpl = new CCP4CompoundFactoryImpl(clibd_mon);
else if (cif::VERBOSE)
std::cerr << "CCP4 monomers library not found, CLIBD_MON is not defined" << std::endl;
mImpl = new CCDCompoundFactoryImpl(mImpl);
auto ccd = cif::loadResource("components.cif");
if (ccd)
mImpl = new CCDCompoundFactoryImpl(mImpl);
else if (cif::VERBOSE)
std::cerr << "CCD components.cif file was not found" << std::endl;
}
CompoundFactory::~CompoundFactory()
......@@ -685,17 +691,25 @@ void CompoundFactory::popDictionary()
const Compound *CompoundFactory::create(std::string id)
{
return mImpl->get(id);
static bool warned = false;
if (mImpl == nullptr and warned == false)
{
std::cerr << "Warning: no compound information library was found, resulting data may be incorrect or incomplete" << std::endl;
warned = true;
}
return mImpl ? mImpl->get(id) : nullptr;
}
bool CompoundFactory::isKnownPeptide(const std::string &resName) const
{
return mImpl->isKnownPeptide(resName);
return mImpl ? mImpl->isKnownPeptide(resName) : kAAMap.count(resName) > 0;
}
bool CompoundFactory::isKnownBase(const std::string &resName) const
{
return mImpl->isKnownBase(resName);
return mImpl ? mImpl->isKnownBase(resName) : kBaseMap.count(resName) > 0;
}
} // namespace mmcif
......@@ -512,11 +512,7 @@ double Res::CalculateSurface(const std::vector<Res>& inResidues)
void CalculateAccessibilities(std::vector<Res>& inResidues, DSSP_Statistics& stats)
{
if (cif::VERBOSE)
std::cerr << "Calculate accessibilities" << std::endl;
stats.accessibleSurface = 0;
for (auto& residue: inResidues)
stats.accessibleSurface += residue.CalculateSurface(inResidues);
}
......@@ -1186,9 +1182,6 @@ DSSPImpl::DSSPImpl(const Structure& s, int min_poly_proline_stretch_length)
, mPolymers(mStructure.polymers())
, m_min_poly_proline_stretch_length(min_poly_proline_stretch_length)
{
if (cif::VERBOSE)
std::cerr << "Calculating DSSP ";
size_t nRes = accumulate(mPolymers.begin(), mPolymers.end(),
0.0, [](double s, auto& p) { return s + p.size(); });
......@@ -1266,20 +1259,11 @@ void DSSPImpl::calculateSecondaryStructure()
mSSBonds.emplace_back(&*r1, &*r2);
}
if (cif::VERBOSE) std::cerr << ".";
CalculateHBondEnergies(mResidues);
if (cif::VERBOSE) std::cerr << ".";
CalculateBetaSheets(mResidues, mStats);
if (cif::VERBOSE) std::cerr << ".";
CalculateAlphaHelices(mResidues, mStats);
if (cif::VERBOSE) std::cerr << ".";
CalculatePPHelices(mResidues, mStats, m_min_poly_proline_stretch_length);
if (cif::VERBOSE) std::cerr << std::endl;
if (cif::VERBOSE > 1)
{
for (auto& r: mResidues)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment