Commit 9a20b4dd by Maarten L. Hekkelman

upgrade c++ to 17

updates for refactoring libcif++
parent 9a39b566
......@@ -91,8 +91,8 @@ OBJECTS = $(APPLICATION:%=$(OBJDIR)/%.o)
ifneq "$(MRC)" ""
OBJECTS += $(APPLICATION:%=$(OBJDIR)/%_rsrc.o)
$(OBJDIR)/$(APPLICATION)_rsrc.o: $(CIFPP_RSRC)/dictionaries
$(MRC) -o $@ $^
$(OBJDIR)/$(APPLICATION)_rsrc.o: $(wildcard $(CIFPP_RSRC)/dictionaries/*)
$(MRC) -o $@ $(CIFPP_RSRC)/dictionaries
endif
-include $(OBJECTS:%.o=%.d)
......@@ -121,3 +121,7 @@ distclean: clean
.PHONY: FORCE
FORCE:
.PHONY: test
test:
echo $(wildcard $(CIFPP_RSRC)/dictionaries/*)
AC_INIT([dssp], 3.0, [m.hekkelman@nki.nl])
AC_INIT([dssp], 4.0, [m.hekkelman@nki.nl])
dnl Switch to a C++ compiler, and check if it works.
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_14([noext])
AX_CXX_COMPILE_STDCXX_17([noext])
AC_CONFIG_SRCDIR([src/dssp.cpp])
AC_CONFIG_AUX_DIR(config)
......@@ -47,7 +47,7 @@ AC_ARG_WITH([cif++],
])
AX_CHECK_LIBRARY([LIBCIFPP], [cif++/Config.h], [cif++],
AX_CHECK_LIBRARY([LIBCIFPP], [cif++/Config.hpp], [cif++],
[],
[AC_MSG_ERROR([libcif++ not found - cannot continue])])
......
......@@ -10,11 +10,12 @@
#include <boost/format.hpp>
#include <boost/date_time/gregorian/formatters.hpp>
#include <cif++/Config.h>
#include <cif++/Structure.h>
#include <cif++/Secondary.h>
#include <cif++/CifUtils.h>
#include <cif++/Cif2PDB.h>
#include <cif++/Config.hpp>
#include <cif++/Structure.hpp>
#include <cif++/Secondary.hpp>
#include <cif++/CifUtils.hpp>
#include <cif++/Cif2PDB.hpp>
#include <cif++/FixDMC.hpp>
#include <boost/program_options.hpp>
......@@ -54,8 +55,6 @@ std::string ResidueToDSSPLine(const mmcif::DSSP::ResidueInfo& info)
if (residue.asymID().length() > 1)
throw std::runtime_error("This file contains data that won't fit in the original DSSP format");
auto ca = residue.atomByID("CA");
char code = 'X';
if (mmcif::kAAMap.find(residue.compoundID()) != mmcif::kAAMap.end())
code = mmcif::kAAMap.at(residue.compoundID());
......@@ -137,9 +136,10 @@ std::string ResidueToDSSPLine(const mmcif::DSSP::ResidueInfo& info)
}
}
auto ca = residue.atomByID("CA");
auto const& [cax, cay, caz] = ca.location();
return (kDSSPResidueLine % info.nr() % ca.authSeqId() % ca.pdbxAuthInsCode() % ca.authAsymId() % code %
return (kDSSPResidueLine % info.nr() % ca.authSeqID() % ca.pdbxAuthInsCode() % ca.authAsymID() % code %
ss % helix[0] % helix[1] % helix[2] % bend % chirality % bridgelabel[0] % bridgelabel[1] %
bp[0] % bp[1] % sheet % floor(info.accessibility() + 0.5) %
NHO[0] % ONH[0] % NHO[1] % ONH[1] %
......@@ -220,9 +220,8 @@ void writeDSSP(const mmcif::Structure& structure, const mmcif::DSSP& dssp, std::
// insert a break line whenever we detect missing residues
// can be the transition to a different chain, or missing residues in the current chain
auto b = ri.chainBreak();
if (b != mmcif::ChainBreak::None)
os << (kDSSPResidueLine % (last + 1) % (b == mmcif::ChainBreak::Gap ? '*' : ' ')) << std::endl;
if (ri.nr() != last + 1)
os << (kDSSPResidueLine % (last + 1) % (ri.chainBreak() == mmcif::ChainBreak::NewChain ? '*' : ' ')) << std::endl;
os << ResidueToDSSPLine(ri) << std::endl;
last = ri.nr();
......@@ -263,7 +262,7 @@ void annotateDSSP(const mmcif::Structure& structure, const mmcif::DSSP& dssp, st
// --------------------------------------------------------------------
int main(int argc, char* argv[])
int d_main(int argc, const char* argv[])
{
using namespace std::literals;
......@@ -280,6 +279,8 @@ int main(int argc, char* argv[])
("output-format", po::value<std::string>(), "Output format, can be either 'dssp' for classic DSSP or 'mmcif' for annotated mmCIF. The default is chosen based on the extension of the output file, if any.")
("create-missing", "Create missing backbone atoms")
#if not USE_RSRC
("rsrc-dir", po::value<std::string>(), "Directory containing the 'resources' used by this application")
#endif
......@@ -352,7 +353,12 @@ int main(int argc, char* argv[])
}
mmcif::File f(vm["xyzin"].as<std::string>());
mmcif::Structure structure(f);
mmcif::Structure structure(f, mmcif::StructureOpenOptions::SkipHydrogen);
// --------------------------------------------------------------------
if (vm.count("create-missing"))
mmcif::CreateMissingBackboneAtoms(structure, true);
// --------------------------------------------------------------------
......@@ -384,3 +390,22 @@ int main(int argc, char* argv[])
return 0;
}
// --------------------------------------------------------------------
int main(int argc, const char* argv[])
{
int result = 0;
try
{
result = d_main(argc, argv);
}
catch (const std::exception& ex)
{
print_what(ex);
exit(1);
}
return result;
}
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