Commit fedc1c0e by Maarten L. Hekkelman

remove web server from main dssp code

add annotation and writing to dssp library
parent 1cc1e91e
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
# set the project name # set the project name
project(mkdssp VERSION 4.3.1.1 LANGUAGES CXX) project(mkdssp VERSION 4.3.2 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
...@@ -106,15 +106,16 @@ find_package(Threads) ...@@ -106,15 +106,16 @@ find_package(Threads)
if(NOT PDB_REDO_META) if(NOT PDB_REDO_META)
find_package(libmcfp REQUIRED) find_package(libmcfp REQUIRED)
find_package(cifpp 5.1.0 REQUIRED) find_package(cifpp 5.1.0 REQUIRED)
if(BUILD_WEBSERVER)
find_package(zeep REQUIRED)
find_package(gxrio REQUIRED)
endif()
endif() endif()
# The DSSP code is in a separate library, optionally to be used by others # The DSSP code is in a separate library, optionally to be used by others
add_library(dssp ${PROJECT_SOURCE_DIR}/src/dssp.cpp ${PROJECT_SOURCE_DIR}/include/dssp.hpp) add_library(dssp
${PROJECT_SOURCE_DIR}/src/dssp.cpp
${PROJECT_SOURCE_DIR}/include/dssp.hpp
${PROJECT_SOURCE_DIR}/src/dssp-io.cpp
${PROJECT_SOURCE_DIR}/src/dssp-io.hpp
)
add_library(dssp::dssp ALIAS dssp) add_library(dssp::dssp ALIAS dssp)
target_link_libraries(dssp PRIVATE cifpp::cifpp) target_link_libraries(dssp PRIVATE cifpp::cifpp)
...@@ -125,10 +126,7 @@ target_include_directories(dssp ...@@ -125,10 +126,7 @@ target_include_directories(dssp
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
) )
add_executable(mkdssp add_executable(mkdssp ${PROJECT_SOURCE_DIR}/src/mkdssp.cpp)
${PROJECT_SOURCE_DIR}/src/dssp-io.cpp
${PROJECT_SOURCE_DIR}/src/dssp-io.hpp
${PROJECT_SOURCE_DIR}/src/mkdssp.cpp)
target_link_libraries(mkdssp PRIVATE dssp cifpp::cifpp libmcfp::libmcfp dssp::dssp) target_link_libraries(mkdssp PRIVATE dssp cifpp::cifpp libmcfp::libmcfp dssp::dssp)
...@@ -139,46 +137,6 @@ if(USE_RSRC) ...@@ -139,46 +137,6 @@ if(USE_RSRC)
${PROJECT_SOURCE_DIR}/mmcif_pdbx/dssp-extension.dic) ${PROJECT_SOURCE_DIR}/mmcif_pdbx/dssp-extension.dic)
endif() endif()
if(BUILD_WEBSERVER)
find_program(YARN yarn REQUIRED)
add_executable(dsspd
${PROJECT_SOURCE_DIR}/src/dssp-io.cpp
${PROJECT_SOURCE_DIR}/src/dssp-server.cpp)
target_link_libraries(dsspd PRIVATE dssp cifpp::cifpp libmcfp::libmcfp dssp::dssp zeep::zeep gxrio::gxrio)
# yarn rules for javascripts
set(webpack_input
${CMAKE_CURRENT_SOURCE_DIR}/webapp/pdb-redo-style.scss
${CMAKE_CURRENT_SOURCE_DIR}/webapp/index.js
${CMAKE_CURRENT_SOURCE_DIR}/webpack.config.js
)
set(webpack_output ${CMAKE_CURRENT_SOURCE_DIR}/docroot/scripts/index.js)
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/node_modules
COMMAND ${YARN}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM)
add_custom_command(OUTPUT ${webpack_output}
DEPENDS ${webpack_input} ${CMAKE_CURRENT_SOURCE_DIR}/node_modules
COMMAND ${YARN} run $<IF:$<CONFIG:Debug>,build,build-production>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM)
add_custom_target(generate_webpack DEPENDS ${webpack_output})
add_dependencies(dsspd generate_webpack)
mrc_target_resources(dsspd
${CIFPP_SHARE_DIR}/mmcif_pdbx.dic
${CIFPP_SHARE_DIR}/mmcif_ddl.dic
${PROJECT_SOURCE_DIR}/docroot/)
endif()
# Install rules # Install rules
install(TARGETS dssp install(TARGETS dssp
EXPORT dsspTargets EXPORT dsspTargets
......
<!DOCTYPE html SYSTEM "about:legacy-compat" [ <!ENTITY nbsp "&#160;">
]>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:z2="http://www.hekkelman.com/libzeep/m2" lang="nl">
<head z2:replace="~{head::head(~{::title},~{::head/script})}">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>PDB-REDO</title>
</head>
<body class="site">
<nav z2:replace="~{menu :: navbar('download')}" />
<div class="container site-content">
<article>
<h2>Using the DSSP software locally</h2>
<p>If you want to run large sets of DSSP calculations you can install DSSP locally by:
<ul>
<li>Downloading the current <a href="https://pdb-redo.eu/dssp/others/mkdssp.gz">Linux and WSL binary</a></li>
<li>Building DSSP from <a href="https://github.com/PDB-REDO/dssp">source</a></li>
<li>Installing the <a href="https://launchpad.net/ubuntu/+source/dssp">Debian/Ubuntu package</a> (note that this version is a bit older)</li>
<li>Installing the <a href="https://www.ccp4.ac.uk/">CCP4 suite</a> that comes with (an older version of) DSSP</li>
</ul>
Use <code>mkdssp -h</code> to get a short help message on how to run DSSP. Alternatively, you can use the
<a z2:href="@{/api-doc}">DSSP API</a> to commit batches of calculations.
</p>
</article>
<article>
<h2>Downloading ready-made DSSP annotations</h2>
<p>For your convenience we have already run DSSP on the entire Protein Data Bank. All entries are available in <a z2:href="@{/about#mmCIF}">mmCIF format</a>
and, if they fit, in the <a z2:href="@{/about#DSSP}">legacy DSSP format.</a></p>
<h3>Manually download (single entries) via the website or using <code>wget</code>:</h3>
<ul>
<li><code>wget https://pdb-redo.eu/dssp/9xyz.cif.gz</code> downloads annotated mmCIF file</li>
<li><code>wget https://pdb-redo.eu/dssp/9xyz.dssp</code> downloads the legacy DSSP file (if available)</li>
</ul>
<h3>Download entire DSSP databank using <code>rsync</code>:</h3>
<ul>
<li><code>rsync -av rsync://rsync.pdb-redo.eu/dssp/ dssp/</code> downloads the entire archive.
</li>
</ul>
<h2>License</h2>
<p><a z2:href="@{/license}">Here</a> you can find the data usage license.</p>
</article>
</div>
<footer z2:replace="~{footer::content}"></footer>
</body>
</html>
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:z2="http://www.hekkelman.com/libzeep/m2" lang="nl">
<head z2:replace="~{head::head(~{::title},~{::head/script})}">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>PDB-REDO - Error</title>
</head>
<body class="site">
<nav z2:replace="~{menu :: navbar('token')}" />
<div class="container site-content">
<div class="container-fluid mt-5">
<div class="alert alert-danger" role="alert">
<span z2:if="${error.nr}" class="error-nr" z2:text="${error.nr}"></span>
<span class="error-head-text" z2:text="${error.head}"></span>
</div>
</div>
<div class="container-fluid mt-5">
<p class="error-main-text" z2:text="${error.description}"></p>
<p z2:if="${error.message}" z2:text="${error.message}"></p>
</div>
<div class="container-fluid mt-5">
<ul class="error-info">
<li z2:if="${error.request.method}">Method: <em z2:text="${error.request.method}"></em></li>
<li z2:if="${error.request.uri}">URI: <em z2:text="${error.request.uri}"></em></li>
<li z2:if="${error.request.username}">Username: <em z2:text="${error.request.username}"></em></li>
</ul>
</div>
</div>
<footer z2:replace="~{footer::content}" />
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:z2="http://www.hekkelman.com/libzeep/m2">
<body>
<footer z2:fragment="content">Maarten L. Hekkelman, Anastassis Perrakis &amp; Robbie P. Joosten
Department of Biochemistry, B8
Plesmanlaan 121, 1066CX Amsterdam
Tel: +31 20 512 1951</footer>
</body>
</html>
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:z2="http://www.hekkelman.com/libzeep/m2"
lang="nl" >
<head z2:fragment="head(title,script)">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; child-src 'none'; img-src 'self' data:;" />
<title z2:replace="${title}">DSSP - PDB-REDO version</title>
<script z2:src="@{/scripts/index.js}"></script>
<script z2:replace="${script}"></script>
<link z2:href="@{/css/index.css}" rel="stylesheet" />
<!-- favicon stuff -->
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png"/>
<link rel="icon" type="image/png" href="/images/favicon/favicon-32x32.png" sizes="32x32"/>
<link rel="icon" type="image/png" href="/images/favicon/favicon-16x16.png" sizes="16x16"/>
<link rel="manifest" href="/images/favicon/manifest.json"/>
<link rel="mask-icon" href="/images/favicon/safari-pinned-tab.svg" color="#5bbad5"/>
<meta name="theme-color" content="#ffffff"/>
</head>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="160px" height="120px" viewBox="0 0 160 120" enable-background="new 0 0 160 120" xml:space="preserve">
<g>
<g>
<path fill="#3366CC" d="M47.144,92.745c0,0.372-0.335,0.559-1.005,0.559h-4.731c-0.5,0-1.049-0.119-1.646-0.357
c-0.599-0.238-1.055-0.526-1.37-0.864l-3.352-3.458c-1.38-1.421-3.049-2.132-5.007-2.132h-4.811v5.59
c0,0.338-0.181,0.626-0.542,0.864s-0.799,0.357-1.311,0.357h-3.707c-0.512,0-0.952-0.119-1.32-0.357s-0.552-0.526-0.552-0.864
V75.897c0-0.338,0.177-0.628,0.532-0.871c0.354-0.242,0.788-0.363,1.301-0.363h16.264c3.01,0,5.478,0.532,7.403,1.599
c1.925,1.065,2.888,2.505,2.888,4.315c0,2.522-2.478,4.104-7.433,4.745c0.789,0.19,1.519,0.518,2.188,0.981
c0.671,0.464,1.439,1.138,2.307,2.021l3.588,3.757C47.038,92.324,47.144,92.546,47.144,92.745z M25.222,82.813h8.398
c1.354,0,2.546-0.178,3.578-0.533c1.031-0.355,1.547-0.923,1.547-1.703c0-0.779-0.516-1.348-1.547-1.703
c-1.032-0.354-2.225-0.532-3.578-0.532h-8.398V82.813z"/>
<path fill="#3366CC" d="M50.416,92.056V75.871c0-0.338,0.184-0.623,0.552-0.857s0.809-0.351,1.32-0.351h22.73
c0.513,0,0.949,0.121,1.311,0.363c0.361,0.243,0.543,0.533,0.543,0.871v1.222c0,0.338-0.182,0.627-0.543,0.865
s-0.798,0.357-1.311,0.357H57.848v3.782h14.785c0.513,0,0.95,0.119,1.312,0.357s0.542,0.526,0.542,0.865v1.222
c0,0.338-0.181,0.626-0.542,0.864s-0.799,0.357-1.312,0.357H57.848v3.835h17.132c0.499,0,0.926,0.117,1.281,0.351
c0.354,0.234,0.532,0.521,0.532,0.858v1.248c0,0.338-0.185,0.626-0.552,0.864c-0.368,0.238-0.809,0.357-1.321,0.357H52.288
c-0.512,0-0.952-0.119-1.32-0.357S50.416,92.411,50.416,92.056z"/>
<path fill="#3366CC" d="M80.5,92.107V75.924c0-0.355,0.184-0.654,0.552-0.897c0.368-0.242,0.809-0.363,1.32-0.363h11.021
c5.704,0,9.854,0.752,12.449,2.255c2.596,1.504,3.894,3.861,3.894,7.071c0,3.211-1.298,5.566-3.894,7.065
c-2.596,1.5-6.745,2.249-12.449,2.249H82.372c-0.512,0-0.952-0.115-1.32-0.345S80.5,92.445,80.5,92.107z M87.932,89.625h5.244
c3.535,0,5.94-0.425,7.215-1.274c1.275-0.849,1.912-2.303,1.912-4.361c0-2.058-0.637-3.514-1.912-4.367
c-1.274-0.854-3.68-1.28-7.215-1.28h-5.244V89.625z"/>
<path fill="#3366CC" d="M139.867,91.373c-2.688,1.556-6.631,2.334-11.828,2.334c-5.198,0-9.145-0.778-11.838-2.334
c-2.694-1.556-4.042-4.019-4.042-7.39s1.348-5.832,4.042-7.384c2.693-1.551,6.64-2.327,11.838-2.327
c5.197,0,9.141,0.776,11.828,2.327c2.688,1.552,4.031,4.013,4.031,7.384S142.555,89.817,139.867,91.373z M134.476,79.343
c-1.327-1.04-3.473-1.561-6.437-1.561s-5.112,0.521-6.446,1.561s-2.001,2.589-2.001,4.646c0,2.059,0.667,3.605,2.001,4.642
c1.334,1.035,3.482,1.553,6.446,1.553s5.109-0.518,6.437-1.553c1.327-1.036,1.991-2.583,1.991-4.642
C136.467,81.932,135.803,80.383,134.476,79.343z"/>
</g>
</g>
<g>
<path fill="#FF9933" d="M23.095,52.253v19.542H18.2V24.766h20.604c6.278,0,11.138,1.254,14.578,3.764
c3.441,2.507,5.161,5.83,5.161,9.964c0,4.178-1.72,7.515-5.161,10.014c-3.44,2.499-8.3,3.746-14.578,3.746H23.095z M23.095,48.959
h15.709c4.936,0,8.643-0.985,11.124-2.956s3.723-4.452,3.723-7.445c0-3.015-1.235-5.519-3.702-7.51
c-2.468-1.993-6.184-2.988-11.145-2.988H23.095V48.959z"/>
<path fill="#FF9933" d="M60.034,71.795V24.766h17.396c7.319,0,13.363,1.916,18.136,5.749c4.771,3.833,7.154,8.753,7.154,14.761
v6.041c0,6.029-2.384,10.95-7.154,14.762c-4.772,3.813-10.816,5.717-18.136,5.717H60.034z M64.928,28.06V68.5h12.503
c5.921,0,10.794-1.622,14.618-4.873c3.825-3.249,5.737-7.358,5.737-12.329v-6.132c0-4.906-1.919-8.983-5.757-12.232
c-3.839-3.249-8.706-4.874-14.599-4.874H64.928z"/>
<path fill="#FF9933" d="M104.607,71.795V24.766h17.478c6.223,0,11.069,1.029,14.537,3.087c3.468,2.057,5.202,5.153,5.202,9.29
c0,2.414-0.87,4.514-2.61,6.304c-1.742,1.788-4.107,3.026-7.096,3.716c3.646,0.518,6.607,1.863,8.884,4.037
c2.274,2.172,3.413,4.681,3.413,7.521c0,4.198-1.733,7.426-5.201,9.687c-3.47,2.259-8.109,3.389-13.921,3.389H104.607z
M109.5,45.857h13.778c4.33,0,7.683-0.747,10.054-2.245c2.371-1.496,3.558-3.698,3.558-6.605c0-2.972-1.263-5.206-3.784-6.702
c-2.522-1.498-6.195-2.245-11.021-2.245H109.5V45.857z M109.5,49.151V68.5h15.793c4.414,0,7.882-0.852,10.403-2.56
c2.522-1.705,3.784-4.092,3.784-7.162c0-2.812-1.146-5.118-3.434-6.922c-2.29-1.803-5.614-2.705-9.973-2.705H109.5z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<!DOCTYPE html SYSTEM "about:legacy-compat" [ <!ENTITY nbsp "&#160;">
]>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:z2="http://www.hekkelman.com/libzeep/m2" lang="nl">
<head z2:replace="~{head::head(~{::title},~{::head/script})}">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>DSSP</title>
</head>
<body class="site">
<nav z2:replace="~{menu :: navbar('home')}"></nav>
<div class="container site-content">
<article>
<h2>DSSP: Assign secondary structure to proteins</h2>
<p>DSSP (Dictionary of Secondary Structure in Proteins) is an algorithm originally designed by Wolfgang Kabsch and Chris Sander to standardise secondary structure assigment based on atomic coordinates. DSSP does not predict secondary structure. You can run DSSP using the form below or you can <a z2:href="@{/download}">install</a> the program locally. Ready-made annotations of PDB entries are available below and you can also <a z2:href="@{/download}">download</a> the whole databank at once. More details about the DSSP output are <a z2:href="@{/about}">here</a>.
</p>
</article>
<article>
<h2>Submit your structure</h2>
<form z2:fragment="submit-form" name="job-form" method="post" enctype="multipart/form-data"
z2:action="@{/do}">
<div class="input-group mb-3">
<label class="input-group-text" for="input-group-pdb-file">Coordinates</label>
<input type="file" class="form-control" id="input-group-pdb-file" name="data" required="required" />
</div>
<div class="input-group mb-3">
<label class="input-group-text" for="format-select">Format</label>
<select class="form-select" id="format-select" name="format">
<option value="mmcif">Annotated mmCIF</option>
<option value="dssp">Historic DSSP format, may fail on larger structures</option>
</select>
</div>
<button type="submit" class="btn btn-sm btn-primary mt-3">Submit</button>
</form>
</article>
</div>
<footer z2:replace="~{footer::content}"></footer>
</body>
</html>
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:z2="http://www.hekkelman.com/libzeep/m2" lang="nl">
<head z2:replace="~{head::head(~{::title},~{::head/script})}">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>DSSP</title>
</head>
<body class="site">
<nav z2:replace="~{menu :: navbar('about')}"></nav>
<div class="container site-content">
<article>
<h2>Usage Policy</h2>
<p>Data files contained in the DSSP databank (rsync://rsync.pdb-redo.eu/dssp; <a
z2:href="@{/db}">https://pdb-redo.eu/dssp</a>) are free of all copyright restrictions and made fully
and freely available for both non-commercial and commercial use. Users of the data should attribute
DSSP, the Protein Data Bank and the original authors of that structural data. By using the materials available in the
DSSP databank, the user agrees to abide by the conditions described below:</p>
<ul>
<li>The archival data files in the DSSP databank are made freely available to all users. Data files
within the archive may be redistributed in original form without restriction. Redistribution of
modified data files is allowed only if the parent data file is attributed.</li>
<li>Where applicable, the usage policy of the parent PDB archive entries applies.</li>
<li>The data in the DSSP databank are provided on an "as is" basis. Neither DSSP nor its parent
or comprising institutions can be held liable to any party for direct, indirect, special,
incidental, or consequential damages, including lost profits, arising from the use of DSSP
materials.</li>
<li>Resources on pdb-redo.eu/dssp are provided without warranty of any kind, either expressed or implied.
This includes but is not limited to merchantability or fitness for a particular purpose. The
institutions managing this site make no representation that these resources will not infringe any
patent or other proprietary right.</li>
</ul>
</article>
</div>
<footer z2:replace="~{footer::content}"></footer>
</body>
</html>
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:z2="http://www.hekkelman.com/libzeep/m2" lang="nl">
<body>
<header z2:fragment="navbar(page)" class="d-flex">
<a href="https://pdb-redo.eu/"><img z2:src="@{/images/PDB_logo_rect_medium.svg}" /></a>
<div>
<div class="my-overflow">
<nav class="first">
<a href="http://www.nki.nl" target="_BLANK">NKI Research</a> |
<!-- <a href="http://www.nki.nl/divisions/biochemistry/" title="BioChemistry Homepage"
target="_BLANK">Biochemistry</a>
|-->
<a href="https://www.nki.nl/research/research-groups/anastassis-tassos-perrakis/" target="_BLANK">Perrakis
group</a>
</nav>
</div>
<nav class="navbar navbar-expand-md bg-nav-secondary navbar-light second">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" z2:classappend="${page == 'home' ? 'active' : ''}"
href="https://pdb-redo.eu/dssp">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Tools
</a>
<ul class="dropdown-menu m-0" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="https://alphafill.eu">AlphaFill</a></li>
<li><a class="dropdown-item" href="https://pdb-redo.eu">PDB-REDO</a></li>
<li><a class="dropdown-item" href="https://pdb-redo.eu/tortoize">Tortoize</a></li>
<li><a class="dropdown-item" href="https://ccd.rhpc.nki.nl/">CCD</a></li>
<li><a class="dropdown-item" href="https://pdb-redo.eu/archive">Archive</a></li>
<li><a class="dropdown-item" href="https://lahma.pdb-redo.eu/">Lahma</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" z2:classappend="${page == 'about' ? 'active' : ''}"
z2:href="@{/about}">About</a>
</li>
<li class="nav-item">
<a class="nav-link" z2:classappend="${page == 'download' ? 'active' : ''}"
z2:href="@{/download}">Download</a>
</li>
</ul>
</div>
</nav>
</div>
</header>
</body>
</html>
...@@ -246,6 +246,14 @@ class dssp ...@@ -246,6 +246,14 @@ class dssp
bool empty() const { return begin() == end(); } bool empty() const { return begin() == end(); }
// --------------------------------------------------------------------
// Writing out the data, either in legacy format...
void write_legacy_output(std::ostream& os) const;
// ... or as annotation in the cif::datablock
void annotate(cif::datablock &db, bool writeOther, bool writeDSSPCategories) const;
// convenience method, when creating old style DSSP files // convenience method, when creating old style DSSP files
enum class pdb_record_type enum class pdb_record_type
......
{
"name": "dsspd",
"version": "1.0.0",
"description": "A web service for DSSP",
"main": "index.js",
"author": "Maarten L. Hekkelman",
"license": "BSD-2-Clause",
"scripts": {
"build": "webpack --config webpack.config.js",
"build-production": "webpack --config webpack.config.js --env PRODUCTION"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@popperjs/core": "^2.10.2",
"@webcomponents/webcomponentsjs": "^2.7.0",
"babel-loader": "^9.1.2",
"bs-custom-file-input": "^1.3.4",
"clean-webpack-plugin": "^4.0.0",
"crypto-es": "^1.2.7",
"css-loader": "^6.5.0",
"file-loader": "^6.2.0",
"lit": "^2.6.1",
"mini-css-extract-plugin": "^2.4.3",
"postcss-loader": "^7.0.2",
"sass": "^1.58.1",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.2.5",
"ts-loader": "^9.2.6",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.76.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@babel/runtime-corejs3": "^7.20.13",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.10.3",
"core-js": "^3.28.0"
},
"babel": {
"presets": [
"@babel/typescript",
[
"@babel/env",
{
"modules": false
}
]
]
}
}
...@@ -1104,7 +1104,7 @@ void writeSummary(cif::datablock &db, const dssp &dssp) ...@@ -1104,7 +1104,7 @@ void writeSummary(cif::datablock &db, const dssp &dssp)
} }
} }
void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool writeExperimental, std::ostream &os) void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool writeExperimental)
{ {
using namespace std::literals; using namespace std::literals;
...@@ -1244,6 +1244,4 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr ...@@ -1244,6 +1244,4 @@ void annotateDSSP(cif::datablock &db, const dssp &dssp, bool writeOther, bool wr
{ "version", kVersionNumber }, { "version", kVersionNumber },
{ "date", kBuildDate }, { "date", kBuildDate },
{ "classification", "model annotation" } }); { "classification", "model annotation" } });
db.write(os);
} }
...@@ -29,8 +29,4 @@ ...@@ -29,8 +29,4 @@
#include "dssp.hpp" #include "dssp.hpp"
void writeDSSP(const dssp& dssp, std::ostream& os); void writeDSSP(const dssp& dssp, std::ostream& os);
void annotateDSSP(cif::datablock &db, const dssp& dssp, bool writeOther, bool writeExperimental, std::ostream& os); void annotateDSSP(cif::datablock &db, const dssp& dssp, bool writeOther, bool writeExperimental);
void writeDSSP(std::istream &is, std::ostream& os);
void annotateDSSP(cif::datablock &db, const dssp& dssp, bool writeOther, bool writeExperimental, std::ostream& os);
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2023 NKI/AVL, Netherlands Cancer Institute
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "dssp-io.hpp"
#include "revision.hpp"
#include <cif++.hpp>
#include <gxrio.hpp>
#include <mcfp.hpp>
#include <zeep/http/daemon.hpp>
#include <zeep/http/html-controller.hpp>
#include <zeep/http/rest-controller.hpp>
#include <zeep/streambuf.hpp>
// --------------------------------------------------------------------
class dssp_html_controller : public zeep::http::html_controller
{
public:
dssp_html_controller()
: zeep::http::html_controller()
{
mount("{css,scripts,fonts,images,favicon}/", &dssp_html_controller::handle_file);
mount("{favicon.ico,browserconfig.xml,manifest.json}", &dssp_html_controller::handle_file);
map_get("", "index");
map_get("about", "about");
map_get("download", "download");
map_get("license", "license");
}
};
// --------------------------------------------------------------------
class dssp_rest_controller : public zeep::http::rest_controller
{
public:
dssp_rest_controller()
: zeep::http::rest_controller("")
{
map_post_request("do", &dssp_rest_controller::work, "data", "format");
}
zeep::http::reply work(const zeep::http::file_param &coordinates, std::optional<std::string> format);
};
zeep::http::reply dssp_rest_controller::work(const zeep::http::file_param &coordinates, std::optional<std::string> format)
{
zeep::char_streambuf sb(coordinates.data, coordinates.length);
gxrio::istream in(&sb);
cif::file f = cif::pdb::read(in);
if (f.empty())
throw std::runtime_error("Invalid input file, is it empty?");
// --------------------------------------------------------------------
short pp_stretch = 3; //minPPStretch.value_or(3);
std::string fmt = format.value_or("mmcif");
dssp dssp(f.front(), 1, pp_stretch, true);
std::ostringstream os;
if (fmt == "dssp")
writeDSSP(dssp, os);
else
annotateDSSP(f.front(), dssp, true, true, os);
// --------------------------------------------------------------------
std::string name = f.front().name();
if (fmt == "dssp")
name += ".dssp";
else
name += ".cif";
zeep::http::reply rep{ zeep::http::ok };
rep.set_content(os.str(), "text/plain");
rep.set_header("content-disposition", "attachement; filename = \"" + name + '"');
return rep;
}
// --------------------------------------------------------------------
int main(int argc, char *argv[])
{
using namespace std::literals;
namespace zh = zeep::http;
cif::compound_factory::init(true);
int result = 0;
auto &config = mcfp::config::instance();
config.init("dsspd [options] start|stop|status|reload",
mcfp::make_option("help,h", "Display help message"),
mcfp::make_option("version", "Print version"),
mcfp::make_option("verbose,v", "verbose output"),
mcfp::make_option<std::string>("address", "0.0.0.0", "External address"),
mcfp::make_option<uint16_t>("port", 10351, "Port to listen to"),
mcfp::make_option<std::string>("user,u", "www-data", "User to run the daemon"),
mcfp::make_option<std::string>("context", "", "Root context for web server"),
mcfp::make_option("no-daemon,F", "Do not fork into background"),
mcfp::make_option<std::string>("config", "Config file to use"));
std::error_code ec;
config.parse(argc, argv, ec);
if (ec)
{
std::cerr << "Error parsing command line arguments: " << ec.message() << std::endl
<< std::endl
<< config << std::endl;
exit(1);
}
config.parse_config_file("config", "dsspd.conf", { ".", "/etc" }, ec);
if (ec)
{
std::cerr << "Error parsing config file: " << ec.message() << std::endl;
exit(1);
}
// --------------------------------------------------------------------
if (config.has("version"))
{
write_version_string(std::cout, config.has("verbose"));
exit(0);
}
if (config.has("help"))
{
std::cout << config << std::endl;
exit(0);
}
if (config.operands().empty())
{
std::cerr << "Missing command, should be one of start, stop, status or reload" << std::endl;
exit(1);
}
cif::VERBOSE = config.count("verbose");
std::string user = config.get<std::string>("user");
std::string address = config.get<std::string>("address");
uint16_t port = config.get<uint16_t>("port");
zeep::http::daemon server([&, context = config.get("context")]()
{
auto s = new zeep::http::server();
#ifndef NDEBUG
s->set_template_processor(new zeep::http::file_based_html_template_processor("docroot"));
#else
s->set_template_processor(new zeep::http::rsrc_based_html_template_processor());
#endif
s->add_controller(new dssp_rest_controller());
s->add_controller(new dssp_html_controller());
s->set_context_name(context);
return s; },
kProjectName);
std::string command = config.operands().front();
if (command == "start")
{
std::cout << "starting server at http://" << address << ':' << port << '/' << std::endl;
if (config.has("no-daemon"))
result = server.run_foreground(address, port);
else
result = server.start(address, port, 2, 2, user);
}
else if (command == "stop")
result = server.stop();
else if (command == "status")
result = server.status();
else if (command == "reload")
result = server.reload();
else
{
std::cerr << "Invalid command" << std::endl;
result = 1;
}
return result;
}
\ No newline at end of file
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "dssp.hpp" #include "dssp.hpp"
#include "queue.hpp" #include "queue.hpp"
#include "dssp-io.hpp"
#include <deque> #include <deque>
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
...@@ -2242,3 +2244,17 @@ std::string dssp::get_pdb_header_line(pdb_record_type pdb_record) const ...@@ -2242,3 +2244,17 @@ std::string dssp::get_pdb_header_line(pdb_record_type pdb_record) const
return {}; return {};
} }
} }
// --------------------------------------------------------------------
void dssp::write_legacy_output(std::ostream& os) const
{
writeDSSP(*this, os);
}
void dssp::annotate(cif::datablock &db, bool writeOther, bool writeDSSPCategories) const
{
annotateDSSP(db, *this, writeOther, writeDSSPCategories);
}
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
#include <cif++.hpp> #include <cif++.hpp>
#include "dssp.hpp" #include "dssp.hpp"
#include "dssp-io.hpp"
#include "revision.hpp" #include "revision.hpp"
namespace fs = std::filesystem; namespace fs = std::filesystem;
...@@ -185,16 +183,22 @@ int d_main(int argc, const char *argv[]) ...@@ -185,16 +183,22 @@ int d_main(int argc, const char *argv[])
} }
if (fmt == "dssp") if (fmt == "dssp")
writeDSSP(dssp, out); dssp.write_legacy_output(out);
else else
annotateDSSP(f.front(), dssp, writeOther, not config.has("no-dssp-categories"), out); {
dssp.annotate(f.front(), writeOther, not config.has("no-dssp-categories"));
out << f.front();
}
} }
else else
{ {
if (fmt == "dssp") if (fmt == "dssp")
writeDSSP(dssp, std::cout); dssp.write_legacy_output(std::cout);
else else
annotateDSSP(f.front(), dssp, writeOther, not config.has("no-dssp-categories"), std::cout); {
dssp.annotate(f.front(), writeOther, not config.has("no-dssp-categories"));
std::cout << f.front();
}
} }
return 0; return 0;
......
...@@ -138,7 +138,8 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2) ...@@ -138,7 +138,8 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2)
std::stringstream test; std::stringstream test;
annotateDSSP(f.front(), dssp, true, false, test); dssp.annotate(f.front(), true, false);
test << f.front();
cif::file rf(gTestDir / "1cbs-dssp.cif"); cif::file rf(gTestDir / "1cbs-dssp.cif");
......
import "core-js/stable";
import "regenerator-runtime/runtime";
import '@popperjs/core';
import 'bootstrap';
import './pdb-redo-style.scss';
@use "sass:math";
// (Required) Import Bootstrap
@import "bootstrap/scss/_functions";
@import "bootstrap/scss/_variables";
@import "bootstrap/scss/_mixins";
@import "~bootstrap-icons/font/bootstrap-icons.css";
.alert {
border: 1px solid;
}
@import "bootstrap/scss/_alert";
$font-family-sans-serif: "Verdana", "Arial", "Helvetica", "sans-serif";
$primary: rgb(100, 100, 100);
$primary-rgb: 100, 100, 100;
$nav-primary: #FF9933;
$nav-secondary: #ffecbf;
$nav-link: #3366cc;
$nav-primary-hover: #d8c7a5;
$dropdown-bg: $nav-secondary;
$dropdown-link-color: $nav-link;
$dropdown-link-hover-color: $nav-link;
$dropdown-link-hover-bg: $nav-primary-hover;
$dropdown-border-radius: 0;
$pdb-redo-colors: (
"primary": $primary,
"nav-primary": $nav-primary,
"nav-secondary": $nav-secondary,
);
$navbar-padding-y: 0;
$nav-link-padding-y: math.div($spacer, 2);
// (Required) Import Bootstrap
@import "bootstrap/scss/bootstrap";
$theme-colors: map-merge($pdb-redo-colors, $theme-colors);
@mixin hover-focus() {
&:hover,
&:focus {
@content;
}
}
.site {
display: flex;
min-height: 100vh;
height: 100%;
flex-direction: column;
header,
footer {
flex: none;
}
footer {
clear: both;
border-top: 1px solid #888;
padding: 0.5em;
margin-top: 2em;
font-size: small;
color: #555;
white-space: pre;
}
.site-content {
flex: 1 0 auto;
padding: var(--space) var(--space) 0;
width: 100%;
&::after {
content: '\00a0';
/* &nbsp; */
display: block;
margin-top: var(--space);
height: 0px;
visibility: hidden;
}
}
}
// for the pdb-redo header
header {
min-height: 6em;
padding-bottom: 1em;
img {
min-height: calc(6em + 30px);
margin: -15px 0;
width: auto;
}
div {
flex: 1 0 0%;
}
div.my-overflow {
overflow: hidden;
white-space: nowrap;
}
nav.first {
padding: 0.8em !important;
}
.navbar {
.navbar-nav {
.nav-link {
color: $nav-link;
@include hover-focus() {
background-color: $nav-primary-hover;
}
&.active {
background-color: lighten($nav-link, 5%);
color: white;
}
&.disabled {
color: mix($nav-link, $nav-secondary, 50%);
}
}
}
.navbar-toggler {
border-color: rgba($black, .1);
}
.navbar-toggler-icon {
background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
}
}
.first {
background-color: $nav-primary;
color: white;
a {
color: white;
text-decoration: none;
}
}
.second {
background-color: $nav-secondary;
}
a {
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
@media all and (max-width: 1024px) {
header {
min-height: 4em;
img {
min-height: calc(4em + 30px);
}
nav.first {
padding: 0.4em !important;
}
.second {
padding: 0.2em;
}
}
}
article {
margin-top: 1em;
margin-bottom: 2em;
}
article h2 {
margin-bottom: 0.5em;
}
a {
color: #3366cc;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
.error-info {
list-style: none;
}
.nummer {
text-align: right;
}
.error-head-text {
font-size: large;
}
.logo img {
margin: -15px 0;
height: 2em;
background-color: white;
}
ul.error-info {
margin: 0;
list-style: none;
}
a.action {
color: #888;
}
a.action:hover {
color: #555;
}
.no-list {
list-style: none;
margin: 0;
padding: 1px;
}
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const path = require('path');
const SCRIPTS = __dirname + "/webapp/";
const DEST = __dirname + "/docroot/scripts";
module.exports = (env) => {
const PRODUCTION = env != null && env.PRODUCTION;
const webpackConf = {
entry: {
index: SCRIPTS + "index.js"
},
output: {
path: DEST,
crossOriginLoading: 'anonymous'
},
module: {
rules: [
{
test: /\.js/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.(sa|sc|c)ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"postcss-loader",
"sass-loader"
]
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
include: path.resolve(__dirname, './node_modules/bootstrap-icons/font/fonts'),
type: 'asset/resource',
generator: {
filename: '../fonts/[name][ext]'
}
}
]
},
resolve: {
extensions: ['.js', '.scss'],
},
plugins: [
new MiniCssExtractPlugin({
filename: "../css/[name].css"
})
],
optimization: { minimizer: [] },
target: 'web'
};
if (PRODUCTION) {
webpackConf.mode = "production";
webpackConf.plugins.push(
new CleanWebpackPlugin({
verbose: true
}));
webpackConf.optimization.minimizer.push(
new TerserPlugin({ /* additional options here */ }),
new UglifyJsPlugin({ parallel: 4 })
);
} else {
webpackConf.mode = "development";
webpackConf.devtool = 'source-map';
webpackConf.plugins.push(new webpack.optimize.AggressiveMergingPlugin())
}
return webpackConf;
};
This source diff could not be displayed because it is too large. You can view the blob instead.
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