Skip to content

Commit

Permalink
Fix legacy output
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed May 31, 2023
1 parent dd72655 commit db629fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/dssp-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ std::string ResidueToDSSPLine(const dssp::residue_info &info)
ss, helix[3], 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],
residue.tco(), residue.kappa(), alpha, residue.phi(), residue.psi(),
residue.tco().value_or(0),
residue.kappa().value_or(360),
residue.alpha().value_or(360),
residue.phi().value_or(360),
residue.psi().value_or(360),
cax, cay, caz)
.str();
}
Expand All @@ -153,7 +157,7 @@ void writeDSSP(const dssp &dssp, std::ostream &os)
std::time_t today = system_clock::to_time_t(system_clock::now());
std::tm *tm = std::gmtime(&today);

os << "==== Secondary Structure Definition by the program DSSP, NKI version 4.0 ==== DATE=" << std::put_time(tm, "%F") << " ." << std::endl
os << "==== Secondary Structure Definition by the program DSSP, NKI version 4.3 ==== DATE=" << std::put_time(tm, "%F") << " ." << std::endl
<< "REFERENCE W. KABSCH AND C.SANDER, BIOPOLYMERS 22 (1983) 2577-2637 ." << std::endl
<< dssp.get_pdb_header_line(dssp::pdb_record_type::HEADER) << '.' << std::endl
<< dssp.get_pdb_header_line(dssp::pdb_record_type::COMPND) << '.' << std::endl
Expand Down
12 changes: 8 additions & 4 deletions test/unit-test-dssp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
std::string line_t, line_r;
BOOST_CHECK(std::getline(test, line_t) and std::getline(reference, line_r));

const char *kHeaderLineStart = "==== Secondary Structure Definition by the program DSSP, NKI version 4.0 ====";
const char *kHeaderLineStart = "==== Secondary Structure Definition by the program DSSP, NKI version 4.3 ====";
BOOST_CHECK(line_t.compare(0, std::strlen(kHeaderLineStart), kHeaderLineStart) == 0);
BOOST_CHECK(line_r.compare(0, std::strlen(kHeaderLineStart), kHeaderLineStart) == 0);
// BOOST_CHECK(line_r.compare(0, std::strlen(kHeaderLineStart), kHeaderLineStart) == 0);

for (int line_nr = 2;; ++line_nr)
{
Expand All @@ -115,7 +115,11 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
<< line_t << std::endl
<< line_r << std::endl;

BOOST_CHECK(line_t == line_r);
if (line_t != line_r)
{
BOOST_CHECK(line_t == line_r);
break;
}
}

BOOST_CHECK(test.eof());
Expand Down Expand Up @@ -164,7 +168,7 @@ BOOST_AUTO_TEST_CASE(dssp_1)
std::string line;
getline(t, line);

std::cout << line << std::endl;
// std::cout << line << std::endl;

auto fld = cif::split(line, "\t");

Expand Down

0 comments on commit db629fb

Please sign in to comment.