Commit 8604c3ab by Maarten L. Hekkelman

merged

parents 7a611293 516db3d8
...@@ -210,7 +210,7 @@ $(1)_OBJECTS = $$(OBJDIR)/$(1)-test.o ...@@ -210,7 +210,7 @@ $(1)_OBJECTS = $$(OBJDIR)/$(1)-test.o
test/$(1)-test: $(LIB_TARGET) $$($(1)_OBJECTS) test/$(1)-test: $(LIB_TARGET) $$($(1)_OBJECTS)
@ echo ">>> building $(1)-test" @ echo ">>> building $(1)-test"
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $$@ $$($(1)_OBJECTS) -L.libs -lcifpp $(LIBS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $$@ $$($(1)_OBJECTS) -L.libs -lcifpp -lboost_program_options $(LIBS)
.PHONY: $(1)-test .PHONY: $(1)-test
$(1)-test: test/$(1)-test $(1)-test: test/$(1)-test
...@@ -218,7 +218,7 @@ $(1)-test: test/$(1)-test ...@@ -218,7 +218,7 @@ $(1)-test: test/$(1)-test
endef endef
TESTS = unit TESTS = unit # pdb2cif
$(foreach part,$(TESTS),$(eval $(call TEST_template,$(part)))) $(foreach part,$(TESTS),$(eval $(call TEST_template,$(part))))
......
...@@ -10,5 +10,3 @@ Version: @PACKAGE_VERSION@ ...@@ -10,5 +10,3 @@ Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lcifpp Libs: -L${libdir} -lcifpp
Cflags: -I${includedir} Cflags: -I${includedir}
Requires: @AX_PACKAGE_REQUIRES@
Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
\ No newline at end of file
...@@ -1124,6 +1124,9 @@ void PDBFileParser::PreParseInput(std::istream& is) ...@@ -1124,6 +1124,9 @@ void PDBFileParser::PreParseInput(std::istream& is)
uint32_t lineNr = 1; uint32_t lineNr = 1;
getline(is, lookahead); getline(is, lookahead);
if (lookahead.back() == '\r')
lookahead.pop_back();
// if (ba::starts_with(lookahead, "HEADER") == false) // if (ba::starts_with(lookahead, "HEADER") == false)
// throw std::runtime_error("This does not look like a PDB file, should start with a HEADER line"); // throw std::runtime_error("This does not look like a PDB file, should start with a HEADER line");
...@@ -1284,7 +1287,7 @@ void PDBFileParser::PreParseInput(std::istream& is) ...@@ -1284,7 +1287,7 @@ void PDBFileParser::PreParseInput(std::istream& is)
stoi(lookahead.substr(7, 3)) == compNr and stoi(lookahead.substr(7, 3)) == compNr and
contNr(16, 2) == n) contNr(16, 2) == n)
{ {
value += lookahead.substr(19); value += ba::trim_right_copy(lookahead.substr(19));;
getline(is, lookahead); getline(is, lookahead);
++lineNr; ++lineNr;
++n; ++n;
...@@ -1308,7 +1311,7 @@ void PDBFileParser::PreParseInput(std::istream& is) ...@@ -1308,7 +1311,7 @@ void PDBFileParser::PreParseInput(std::istream& is)
int n = 2; int n = 2;
while (lookahead.substr(0, 6) == type and contNr(8, 2) == n) while (lookahead.substr(0, 6) == type and contNr(8, 2) == n)
{ {
value += lookahead.substr(16); value += ba::trim_right_copy(lookahead.substr(16));;
getline(is, lookahead); getline(is, lookahead);
++lineNr; ++lineNr;
++n; ++n;
......
#include "../src/Config.hpp"
#include "../include/cif++/Cif++.hpp"
#include "../include/cif++/PDB2Cif.hpp"
#include <iostream>
#include <fstream>
#include <boost/program_options.hpp>
// #include "pdb2cif.h"
namespace po = boost::program_options;
int main(int argc, char* argv[])
{
using namespace std::literals;
po::options_description desc("pdb2cif-test "s + PACKAGE_VERSION + " options");
desc.add_options()
("input,i", po::value<std::string>(), "Input file")
("help,h", "Display help message")
("version", "Print version")
("verbose,v", "Verbose output")
("debug,d", po::value<int>(), "Debug level (for even more verbose output)");
po::positional_options_description p;
p.add("input", 1);
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
po::notify(vm);
if (vm.count("version"))
{
std::cout << argv[0] << " version " PACKAGE_VERSION << std::endl;
exit(0);
}
if (vm.count("help") or vm.count("input") == 0)
{
std::cerr << desc << std::endl;
exit(1);
}
cif::VERBOSE = vm.count("verbose") != 0;
if (vm.count("debug"))
cif::VERBOSE = vm["debug"].as<int>();
std::ifstream is(vm["input"].as<std::string>());
if (not is.is_open())
throw std::runtime_error("Could not open file " + vm["input"].as<std::string>());
cif::File f;
ReadPDBFile(is, f);
// f.write(std::cout);
return 0;
}
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