Commit 8aa74b98 by rjoosten

Merge branch 'trunk' of github.com:PDB-REDO/dssp into trunk

parents 1ef68b65 b87ef206
...@@ -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 LANGUAGES CXX) project(mkdssp VERSION 4.3.1 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
...@@ -105,7 +105,7 @@ find_package(Threads) ...@@ -105,7 +105,7 @@ 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.0.8 REQUIRED) find_package(cifpp 5.1.0 REQUIRED)
if(BUILD_WEBSERVER) if(BUILD_WEBSERVER)
find_package(zeep REQUIRED) find_package(zeep REQUIRED)
...@@ -135,7 +135,8 @@ target_link_libraries(mkdssp PRIVATE dssp cifpp::cifpp libmcfp::libmcfp dssp::ds ...@@ -135,7 +135,8 @@ target_link_libraries(mkdssp PRIVATE dssp cifpp::cifpp libmcfp::libmcfp dssp::ds
if(USE_RSRC) if(USE_RSRC)
mrc_target_resources(mkdssp mrc_target_resources(mkdssp
${CIFPP_SHARE_DIR}/mmcif_pdbx.dic ${CIFPP_SHARE_DIR}/mmcif_pdbx.dic
${CIFPP_SHARE_DIR}/mmcif_ddl.dic) ${CIFPP_SHARE_DIR}/mmcif_ddl.dic
${PROJECT_SOURCE_DIR}/mmcif_pdbx/dssp-extension.dic)
endif() endif()
if(BUILD_WEBSERVER) if(BUILD_WEBSERVER)
......
Version 4.3.1
- Optimised for speed
- Fix in sheet numbering (mmCIF output)
Version 4.3 Version 4.3
- Write new output by default - Write new output by default
- Fix some issues with this new output, typo e.g. - Fix some issues with this new output, typo e.g.
......
...@@ -173,7 +173,7 @@ save__dssp_struct_bridge_pairs.acceptor_1_label_asym_id ...@@ -173,7 +173,7 @@ save__dssp_struct_bridge_pairs.acceptor_1_label_asym_id
; ;
_item.name '_dssp_struct_bridge_pairs.acceptor_1_label_asym_id' _item.name '_dssp_struct_bridge_pairs.acceptor_1_label_asym_id'
_item.category_id dssp_struct_bridge_pairs _item.category_id dssp_struct_bridge_pairs
_item.mandatory_code yes _item.mandatory_code no
_item_type.code code _item_type.code code
save_ save_
...@@ -250,7 +250,7 @@ save__dssp_struct_bridge_pairs.acceptor_2_label_asym_id ...@@ -250,7 +250,7 @@ save__dssp_struct_bridge_pairs.acceptor_2_label_asym_id
; ;
_item.name '_dssp_struct_bridge_pairs.acceptor_2_label_asym_id' _item.name '_dssp_struct_bridge_pairs.acceptor_2_label_asym_id'
_item.category_id dssp_struct_bridge_pairs _item.category_id dssp_struct_bridge_pairs
_item.mandatory_code yes _item.mandatory_code no
_item_type.code code _item_type.code code
save_ save_
...@@ -327,7 +327,7 @@ save__dssp_struct_bridge_pairs.donor_1_label_asym_id ...@@ -327,7 +327,7 @@ save__dssp_struct_bridge_pairs.donor_1_label_asym_id
; ;
_item.name '_dssp_struct_bridge_pairs.donor_1_label_asym_id' _item.name '_dssp_struct_bridge_pairs.donor_1_label_asym_id'
_item.category_id dssp_struct_bridge_pairs _item.category_id dssp_struct_bridge_pairs
_item.mandatory_code yes _item.mandatory_code no
_item_type.code code _item_type.code code
save_ save_
...@@ -404,7 +404,7 @@ save__dssp_struct_bridge_pairs.donor_2_label_asym_id ...@@ -404,7 +404,7 @@ save__dssp_struct_bridge_pairs.donor_2_label_asym_id
; ;
_item.name '_dssp_struct_bridge_pairs.donor_2_label_asym_id' _item.name '_dssp_struct_bridge_pairs.donor_2_label_asym_id'
_item.category_id dssp_struct_bridge_pairs _item.category_id dssp_struct_bridge_pairs
_item.mandatory_code yes _item.mandatory_code no
_item_type.code code _item_type.code code
save_ save_
......
...@@ -74,6 +74,8 @@ int d_main(int argc, const char *argv[]) ...@@ -74,6 +74,8 @@ int d_main(int argc, const char *argv[])
mcfp::make_option("write-other", "If set, write the type OTHER for loops, default is to leave this out"), mcfp::make_option("write-other", "If set, write the type OTHER for loops, default is to leave this out"),
mcfp::make_option("no-dssp-categories", "If set, will suppress output of new DSSP output in mmCIF format"), mcfp::make_option("no-dssp-categories", "If set, will suppress output of new DSSP output in mmCIF format"),
mcfp::make_option("calculate-accessibility", "Default is to not calculate the surface accessibility when the output format is mmCIF"),
mcfp::make_option<std::string>("mmcif-dictionary", "Path to the mmcif_pdbx.dic file to use instead of default"), mcfp::make_option<std::string>("mmcif-dictionary", "Path to the mmcif_pdbx.dic file to use instead of default"),
mcfp::make_option("help,h", "Display help message"), mcfp::make_option("help,h", "Display help message"),
...@@ -93,16 +95,10 @@ int d_main(int argc, const char *argv[]) ...@@ -93,16 +95,10 @@ int d_main(int argc, const char *argv[])
exit(0); exit(0);
} }
if (config.has("help")) if (config.has("help") or config.operands().empty())
{ {
std::cerr << config << std::endl; std::cerr << config << std::endl;
exit(0); exit(config.has("help") ? 0 : 1);
}
if (config.operands().empty())
{
std::cerr << "Input file not specified" << std::endl;
exit(1);
} }
if (config.has("output-format") and config.get<std::string>("output-format") != "dssp" and config.get<std::string>("output-format") != "mmcif") if (config.has("output-format") and config.get<std::string>("output-format") != "dssp" and config.get<std::string>("output-format") != "mmcif")
...@@ -130,8 +126,6 @@ int d_main(int argc, const char *argv[]) ...@@ -130,8 +126,6 @@ int d_main(int argc, const char *argv[])
} }
cif::file f = cif::pdb::read(in); cif::file f = cif::pdb::read(in);
if (cif::VERBOSE > 0 and not f.is_valid())
std::cerr << "Warning, the input file is not valid. Run with --verbose to see why." << std::endl;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -164,7 +158,7 @@ int d_main(int argc, const char *argv[]) ...@@ -164,7 +158,7 @@ int d_main(int argc, const char *argv[])
fmt = "cif"; fmt = "cif";
} }
dssp dssp(f.front(), 1, pp_stretch, true); dssp dssp(f.front(), 1, pp_stretch, fmt == "dssp" or config.has("calculate-accessibility"));
if (not output.empty()) if (not output.empty())
{ {
......
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 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.
*/
#pragma once
#include <condition_variable>
#include <mutex>
#include <queue>
template <typename T, size_t N = 100>
class blocking_queue
{
public:
void push(T const &value)
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.size() >= N)
m_full_signal.wait(lock);
m_queue.push(value);
m_empty_signal.notify_one();
}
T pop()
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
m_empty_signal.wait(lock);
auto value = m_queue.front();
m_queue.pop();
m_full_signal.notify_one();
return value;
}
template<class Rep, class Period>
std::tuple<bool,T> pop(const std::chrono::duration<Rep, Period>& wait_for)
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
{
auto now = std::chrono::system_clock::now();
if (m_empty_signal.wait_until(lock, now + wait_for) == std::cv_status::timeout)
return { true , T{} };
}
auto value = m_queue.front();
m_queue.pop();
m_full_signal.notify_one();
return { false, value };
}
bool is_full() const
{
std::unique_lock<std::mutex> lock(m_guard);
return m_queue.size() >= N;
}
private:
std::queue<T> m_queue;
mutable std::mutex m_guard;
std::condition_variable m_empty_signal, m_full_signal;
};
template <typename T, size_t N = 10>
class non_blocking_queue
{
public:
bool push(T const &value)
{
bool result = false;
std::unique_lock<std::mutex> lock(m_guard);
if (m_queue.size() < N)
{
m_queue.push(value);
m_empty_signal.notify_one();
result = true;
}
return result;
}
T pop()
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
m_empty_signal.wait(lock);
auto value = m_queue.front();
m_queue.pop();
return value;
}
private:
std::queue<T> m_queue;
mutable std::mutex m_guard;
std::condition_variable m_empty_signal;
};
\ No newline at end of file
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