### Build, Install, and Run Tests Source: https://context7.com/pdb-redo/dssp/llms.txt Standard build, installation, and testing commands using CMake and CTest. ```bash cmake --build build -j ``` ```bash sudo cmake --install build ``` ```bash cd build && ctest ``` -------------------------------- ### Install dssp Target Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This rule installs the 'mkdssp' executable to the 'bin' directory at runtime. This is part of the overall installation process for the project. ```cmake install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin ) ``` -------------------------------- ### Install HTML Documentation Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Installs the 'mkdssp.html' file to the specified CCP4 HTML directory if the CCP4 path and its 'html' subdirectory exist. This is for integrating with external documentation systems. ```cmake if(EXISTS "${CCP4}/html") install(FILES doc/mkdssp.html DESTINATION ${CCP4}/html) endif() ``` -------------------------------- ### Install Man Page on UNIX Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Installs the 'mkdssp.1' man page to 'share/man/man1' on UNIX-like systems. This provides manual documentation accessible via the 'man' command. ```cmake if(UNIX) install(FILES doc/mkdssp.1 DESTINATION share/man/man1) endif() ``` -------------------------------- ### Use DSSP in Python Source: https://github.com/pdb-redo/dssp/blob/trunk/README.md Example of importing the mkdssp module and processing a compressed mmCIF file. ```python from mkdssp import dssp import os import gzip file_path = os.path.join("..", "test", "1cbs.cif.gz") with gzip.open(file_path, "rt") as f: file_content = f.read() dssp = dssp(file_content) print("residues: ", dssp.statistics.residues) for res in dssp: print(res.asym_id, res.seq_id, res.compound_id, res.type) ``` -------------------------------- ### Build the Python module Source: https://github.com/pdb-redo/dssp/blob/trunk/README.md Build and install the DSSP Python module by enabling the BUILD_PYTHON_MODULE flag during configuration. ```console git clone https://github.com/PDB-REDO/dssp.git cd dssp cmake -S . -B build -DBUILD_PYTHON_MODULE=ON cmake --build build sudo cmake --install build ``` -------------------------------- ### Configure NSIS Options Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Sets NSIS (Nullsoft Scriptable Install System) options, specifically enabling path modification. This is relevant for Windows installers created by CPack. ```cmake set(CPACK_NSIS_MODIFY_PATH ON) ``` -------------------------------- ### Include System Libraries and License Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Includes CMake modules for installing required system libraries and sets the license file for packaging. This ensures necessary runtime components are handled and the project's license is included. ```cmake include(InstallRequiredSystemLibraries) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") ``` -------------------------------- ### Configure Resource Files for mkdssp Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This snippet conditionally adds resource files to the 'mkdssp' target using 'mrc_target_resources' if USE_RSRC is enabled. Otherwise, it installs dictionary files. This is used for embedding or installing data files required by the application. ```cmake if(USE_RSRC) mrc_target_resources(mkdssp ${CIFPP_DATA_DIR}/mmcif_pdbx.dic ${CMAKE_CURRENT_SOURCE_DIR}/libdssp/mmcif_pdbx/dssp-extension.dic) else() get_target_property(LIBDSSP_SOURCE_DIR dssp SOURCE_DIR) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libdssp/mmcif_pdbx/dssp-extension.dic DESTINATION ${CIFPP_SHARE_DIR}) if(TARGET cifpp) install(FILES ${CIFPP_DATA_DIR}/mmcif_pdbx.dic DESTINATION ${CIFPP_SHARE_DIR}) endif() endif() ``` -------------------------------- ### Find and Add libcifpp Dependency Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This snippet attempts to find an installed libcifpp package. If not found, it adds libcifpp as a package using CPMAddPackage from Git, specifying the repository and tag. Use this when libcifpp is a required external dependency. ```cmake find_package(cifpp 10.0.1 QUIET) if(NOT (cifpp_FOUND OR TARGET cifpp)) # message(FATAL_ERROR "Could not find libcifpp. Please make sure you install libcifpp first, code can be found at https://github.com/PDB-REDO/libcifpp") CPMAddPackage( NAME cifpp GIT_REPOSITORY "https://github.com/PDB-REDO/libcifpp" GIT_TAG v10.0.1 EXCLUDE_FROM_ALL YES) endif() ``` -------------------------------- ### Build DSSP from Source Source: https://context7.com/pdb-redo/dssp/llms.txt Commands to clone the repository and configure the build using CMake. ```bash # Clone repository git clone https://github.com/PDB-REDO/dssp.git cd dssp # Configure build cmake -B build -DCMAKE_BUILD_TYPE=Release ``` -------------------------------- ### Build and Run Docker Image Source: https://context7.com/pdb-redo/dssp/llms.txt Commands to build a Docker image for DSSP and run the mkdssp tool within a container, mounting the current directory for input/output. ```bash # Build Docker image docker build -t dssp . ``` ```bash # Run mkdssp in container docker run -v $(pwd):/data dssp mkdssp /data/input.cif /data/output.dssp ``` -------------------------------- ### Configure Unit Test Executable and Dependencies Source: https://github.com/pdb-redo/dssp/blob/trunk/test/CMakeLists.txt Fetches Catch2 via CPM, defines the test executable, and links required libraries. ```cmake CPMFindPackage( NAME Catch2 3 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.4.0 EXCLUDE_FROM_ALL YES) add_executable(unit-test-dssp ${CMAKE_CURRENT_SOURCE_DIR}/unit-test-dssp.cpp ${PROJECT_SOURCE_DIR}/libdssp/src/dssp-io.cpp) target_include_directories(unit-test-dssp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include ) target_link_libraries(unit-test-dssp PRIVATE dssp cifpp::cifpp Catch2::Catch2) ``` -------------------------------- ### Build the mkdssp program Source: https://github.com/pdb-redo/dssp/blob/trunk/README.md Standard build process for the DSSP command-line tool using CMake. ```console git clone https://github.com/PDB-REDO/dssp.git cd dssp cmake -S . -B build cmake --build build cmake --install build ``` -------------------------------- ### CMake Build Source: https://context7.com/pdb-redo/dssp/llms.txt Instructions for building the DSSP project from source using CMake. ```APIDOC ## Building from Source - CMake ### Description Instructions for configuring and building the DSSP project using CMake. ### Steps 1. **Clone the repository**: ```bash git clone https://github.com/PDB-REDO/dssp.git cd dssp ``` 2. **Configure the build**: ```bash cmake -B build -DCMAKE_BUILD_TYPE=Release ``` ``` -------------------------------- ### Writing DSSP Results to File Source: https://context7.com/pdb-redo/dssp/llms.txt Shows how to export secondary structure calculations to legacy DSSP files or annotate existing mmCIF files. ```cpp #include #include #include int main() { cif::file f = cif::pdb::read("structure.cif"); dssp dssp_calc(f.front(), 1, 3, true); // Write classic DSSP format to file std::ofstream dssp_out("output.dssp"); dssp_calc.write_legacy_output(dssp_out); dssp_out.close(); // Annotate the mmCIF datablock with secondary structure // Parameters: datablock, writeOther, writeDSSPCategories dssp_calc.annotate(f.front(), false, // Don't write OTHER type for loops true); // Write DSSP-specific categories // Write annotated mmCIF cif::gzio::ofstream cif_out("output.cif.gz"); cif_out << f.front(); // Get PDB header lines (for legacy output) std::string header = dssp_calc.get_pdb_header_line(dssp::pdb_record_type::HEADER); std::string compnd = dssp_calc.get_pdb_header_line(dssp::pdb_record_type::COMPND); std::string source = dssp_calc.get_pdb_header_line(dssp::pdb_record_type::SOURCE); std::string author = dssp_calc.get_pdb_header_line(dssp::pdb_record_type::AUTHOR); return 0; } ``` -------------------------------- ### Create dssp Executable Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This snippet defines the main executable 'mkdssp' and specifies its source file. This is the primary command-line tool for the dssp project. ```cmake add_executable(mkdssp ${CMAKE_CURRENT_SOURCE_DIR}/src/mkdssp.cpp) ``` -------------------------------- ### Analyze Protein Structures with Python Source: https://context7.com/pdb-redo/dssp/llms.txt Demonstrates loading a structure file, accessing global statistics, iterating over residues, and querying specific residue properties using the mkdssp module. ```python from mkdssp import dssp, TestBond, helix_type, helix_position_type, structure_type, chain_break_type import gzip # Load structure file content with gzip.open("1cbs.cif.gz", "rt") as f: file_content = f.read() # Create DSSP calculator # Parameters: data, model_nr=1, min_poly_proline_stretch=3, calculate_accessibility=False d = dssp(file_content, 1, 3, True) # Access statistics stats = d.statistics print(f"Residues: {stats.residues}") print(f"Chains: {stats.chains}") print(f"SS bridges: {stats.SS_bridges}") print(f"Intra-chain SS bridges: {stats.intra_chain_SS_bridges}") print(f"H-bonds: {stats.H_bonds}") print(f"H-bonds in antiparallel bridges: {stats.H_bonds_in_antiparallel_bridges}") print(f"H-bonds in parallel bridges: {stats.H_bonds_in_parallel_bridges}") # Iterate over all residues for res in d: print(f"{res.asym_id}:{res.seq_id} {res.compound_id} SS={res.type}") # Access specific residue by asym_id and seq_id res = d.get("A", 15) print(f"Residue A:15:") print(f" Compound: {res.compound_id} ({res.compound_letter})") print(f" Secondary structure: {res.type}") print(f" Phi: {res.phi}, Psi: {res.psi}") print(f" Kappa: {res.kappa}, Alpha: {res.alpha}") print(f" TCO: {res.tco}, Omega: {res.omega}") print(f" Is pre-proline: {res.is_pre_pro}") print(f" Is cis: {res.is_cis}") print(f" Bend: {res.bend}") print(f" Sheet: {res.sheet}, Strand: {res.strand}") print(f" CA location: {res.ca_location}") # Returns {'x': ..., 'y': ..., 'z': ...} print(f" Chi angles: {res.chi}") print(f" Chain break: {res.chain_break}") print(f" Accessibility: {res.accessibility}") # Check helix position types h_3_10 = res.helix(helix_type._3_10) # 3-10 helix h_alpha = res.helix(helix_type.alpha) # Alpha helix h_pi = res.helix(helix_type.pi) # Pi helix h_pp = res.helix(helix_type.pp) # Poly-proline helix # Returns: helix_position_type.NoHelix, Start, End, StartAndEnd, or Middle # Get hydrogen bond partners for i in range(2): (acceptor, energy) = res.acceptor(i) if acceptor is not None: print(f" Acceptor {i}: {acceptor.asym_id}:{acceptor.seq_id}, E={energy}") (donor, energy) = res.donor(i) if donor is not None: print(f" Donor {i}: {donor.asym_id}:{donor.seq_id}, E={energy}") # Get bridge partners for i in range(2): (partner, ladder, direction) = res.bridge_partner(i) if partner is not None: print(f" Bridge partner {i}: {partner.asym_id}:{partner.seq_id}, " f"ladder={ladder}, direction={direction}") # Test hydrogen bond between two residues a = d.get('A', 137) b = d.get('A', 6) if TestBond(a, b): print("Hydrogen bond exists between A:137 and A:6") ``` -------------------------------- ### test_bond Function (C++) Source: https://context7.com/pdb-redo/dssp/llms.txt Demonstrates how to use the `test_bond` function in the C++ DSSP library to check for hydrogen bonds between two residues. ```APIDOC ## test_bond Function (C++) ### Description Tests whether a hydrogen bond exists between two residues according to DSSP criteria. ### Method `test_bond(res_a, res_b)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp #include void check_bonds(const dssp& dssp_calc) { // Get two residues dssp::key_type key_a{"A", 137}; dssp::key_type key_b{"A", 6}; auto res_a = dssp_calc[key_a]; auto res_b = dssp_calc[key_b]; // Test if there's a bond between them if (test_bond(res_a, res_b)) { std::cout << "Hydrogen bond exists between A:137 and A:6\n"; } } ``` ### Response #### Success Response (200) Returns `true` if a hydrogen bond exists, `false` otherwise. #### Response Example (Boolean return value) ``` -------------------------------- ### mkdssp Module (Python) Source: https://context7.com/pdb-redo/dssp/llms.txt Provides an overview of the `mkdssp` Python module, including initialization, accessing statistics, iterating over residues, and checking residue properties. ```APIDOC ## mkdssp Module (Python) ### Description The `mkdssp` Python module provides full access to DSSP functionality for Python applications. ### Initialization ```python from mkdssp import dssp import gzip with gzip.open("1cbs.cif.gz", "rt") as f: file_content = f.read() # Parameters: data, model_nr=1, min_poly_proline_stretch=3, calculate_accessibility=False d = dssp(file_content, 1, 3, True) ``` ### Accessing Statistics ```python stats = d.statistics print(f"Residues: {stats.residues}") print(f"Chains: {stats.chains}") print(f"SS bridges: {stats.SS_bridges}") print(f"Intra-chain SS bridges: {stats.intra_chain_SS_bridges}") print(f"H-bonds: {stats.H_bonds}") print(f"H-bonds in antiparallel bridges: {stats.H_bonds_in_antiparallel_bridges}") print(f"H-bonds in parallel bridges: {stats.H_bonds_in_parallel_bridges}") ``` ### Iterating Over Residues ```python for res in d: print(f"{res.asym_id}:{res.seq_id} {res.compound_id} SS={res.type}") ``` ### Accessing Specific Residue ```python res = d.get("A", 15) print(f"Residue A:15:") print(f" Compound: {res.compound_id} ({res.compound_letter})") print(f" Secondary structure: {res.type}") print(f" Phi: {res.phi}, Psi: {res.psi}") print(f" Kappa: {res.kappa}, Alpha: {res.alpha}") print(f" TCO: {res.tco}, Omega: {res.omega}") print(f" Is pre-proline: {res.is_pre_pro}") print(f" Is cis: {res.is_cis}") print(f" Bend: {res.bend}") print(f" Sheet: {res.sheet}, Strand: {res.strand}") print(f" CA location: {res.ca_location}") print(f" Chi angles: {res.chi}") print(f" Chain break: {res.chain_break}") print(f" Accessibility: {res.accessibility}") ``` ### Checking Helix Position ```python # Returns: helix_position_type.NoHelix, Start, End, StartAndEnd, or Middle h_3_10 = res.helix(helix_type._3_10) h_alpha = res.helix(helix_type.alpha) h_pi = res.helix(helix_type.pi) h_pp = res.helix(helix_type.pp) ``` ### Accessing Hydrogen Bond Partners ```python for i in range(2): (acceptor, energy) = res.acceptor(i) if acceptor is not None: print(f" Acceptor {i}: {acceptor.asym_id}:{acceptor.seq_id}, E={energy}") (donor, energy) = res.donor(i) if donor is not None: print(f" Donor {i}: {donor.asym_id}:{donor.seq_id}, E={energy}") ``` ### Accessing Bridge Partners ```python for i in range(2): (partner, ladder, direction) = res.bridge_partner(i) if partner is not None: print(f" Bridge partner {i}: {partner.asym_id}:{partner.seq_id}, " f"ladder={ladder}, direction={direction}") ``` ### Testing Hydrogen Bond Between Residues ```python from mkdssp import TestBond a = d.get('A', 137) b = d.get('A', 6) if TestBond(a, b): print("Hydrogen bond exists between A:137 and A:6") ``` ``` -------------------------------- ### Include CPack Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Includes the CPack module to enable packaging functionality based on the previously defined settings. This command should be near the end of the CMakeLists.txt file. ```cmake include(CPack) ``` -------------------------------- ### Link Libraries to mkdssp Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This command links the 'mkdssp' executable against the 'mcfp::mcfp' and 'dssp::dssp' libraries. Ensure these libraries are defined and available in your build environment. ```cmake target_link_libraries(mkdssp PRIVATE mcfp::mcfp dssp::dssp) ``` -------------------------------- ### Assign Secondary Structure via Command Line Source: https://context7.com/pdb-redo/dssp/llms.txt Use the mkdssp tool to process protein structure files. Supports various input formats, output formats, and configuration options. ```bash # Basic usage - output to stdout in mmCIF format (default) mkdssp input.cif # Process a PDB file and output classic DSSP format mkdssp --output-format=dssp input.pdb output.dssp # Process gzipped input and create compressed mmCIF output mkdssp input.cif.gz output.cif.gz # Specify minimum poly-proline stretch length (default is 3) mkdssp --min-pp-stretch=2 input.cif output.cif # Include OTHER type for loops in mmCIF output mkdssp --write-other input.cif output.cif # Calculate surface accessibility explicitly for mmCIF output mkdssp --calculate-accessibility input.cif output.cif # Suppress DSSP-specific categories in mmCIF output mkdssp --no-dssp-categories input.cif output.cif # Use custom mmCIF dictionary mkdssp --mmcif-dictionary=/path/to/mmcif_pdbx.dic input.cif # Verbose output mkdssp -v input.cif output.dssp ``` -------------------------------- ### Apply MSVC Compiler Options Source: https://github.com/pdb-redo/dssp/blob/trunk/test/CMakeLists.txt Sets exception handling flags specifically for MSVC compilers. ```cmake if(MSVC) # Specify unwind semantics so that MSVC knowns how to handle exceptions target_compile_options(unit-test-dssp PRIVATE /EHsc) endif() ``` -------------------------------- ### Define Test Execution Commands Source: https://github.com/pdb-redo/dssp/blob/trunk/test/CMakeLists.txt Registers the unit test and optional Python integration tests with CTest. ```cmake add_test(NAME unit-test-dssp COMMAND $ --data-dir ${CMAKE_CURRENT_SOURCE_DIR} --rsrc-dir ${CIFPP_DATA_DIR}) if(BUILD_PYTHON_MODULE) find_package(Python REQUIRED Interpreter) add_test(NAME python_module COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/test-python.py") set_tests_properties(python_module PROPERTIES ENVIRONMENT "PYTHONPATH=$;LIBCIFPP_DATA_DIR=${CIFPP_DATA_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") add_test(NAME python_module_numpy COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/test_numpy2_compat.py") set_tests_properties(python_module_numpy PROPERTIES ENVIRONMENT "PYTHONPATH=$;LIBCIFPP_DATA_DIR=${CIFPP_DATA_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") endif() ``` -------------------------------- ### Calculate Secondary Structure with C++ API Source: https://context7.com/pdb-redo/dssp/llms.txt Utilize the dssp class to load structures and iterate through residue-level secondary structure assignments. ```cpp #include #include #include int main() { // Load a structure file cif::file f; cif::gzio::ifstream in("1cbs.cif.gz"); f.load(in); // Fix up PDB-style mmCIF files if needed cif::pdb::fixup_pdbx(f); // Create DSSP calculator // Parameters: datablock, model_nr, min_poly_proline_stretch, calculate_accessibility dssp dssp_calc(f.front(), 1, 3, true); // Get statistics auto stats = dssp_calc.get_statistics(); std::cout << "Residues: " << stats.count.residues << "\n"; std::cout << "Chains: " << stats.count.chains << "\n"; std::cout << "H-bonds: " << stats.count.H_bonds << "\n"; std::cout << "SS-bridges: " << stats.count.SS_bridges << "\n"; std::cout << "Accessible surface: " << stats.accessible_surface << " A^2\n"; // Iterate over all residues for (const auto& res : dssp_calc) { std::cout << res.asym_id() << ":" << res.seq_id() << " " << res.compound_id() << " SS: " << static_cast(res.type()) << " Phi: " << res.phi().value_or(360) << " Psi: " << res.psi().value_or(360) << "\n"; } // Access specific residue by key (asym_id, seq_id) dssp::key_type key{"A", 15}; auto residue = dssp_calc[key]; std::cout << "Residue A:15 secondary structure: " << static_cast(residue.type()) << "\n"; return 0; } ``` -------------------------------- ### Configure CIFPP Data Directories Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This snippet sets the CIFPP data directory based on whether the cifpp target was found. It defines CIFPP_SOURCE_DIR and CIFPP_DATA_DIR. This is used to locate resource files for cifpp. ```cmake if(TARGET cifpp) get_target_property(CIFPP_SOURCE_DIR cifpp SOURCE_DIR) set(CIFPP_SHARE_DIR share/libcifpp) set(CIFPP_DATA_DIR ${CIFPP_SOURCE_DIR}/rsrc) elseif(DEFINED CIFPP_SHARE_DIR) set(CIFPP_DATA_DIR ${CIFPP_SHARE_DIR}) else() message(FATAL_ERROR "dssp: The CIFPP_SHARE_DIR variable is not found in the cifpp configuration files") endif() ``` -------------------------------- ### Accessing Residue Properties with residue_info Source: https://context7.com/pdb-redo/dssp/llms.txt Demonstrates how to extract secondary structure, geometry, and hydrogen bond information from a residue_info object. ```cpp #include #include void analyze_residue(const dssp::residue_info& res) { // Identification std::string asym_id = res.asym_id(); // Label asym ID int seq_id = res.seq_id(); // Label sequence ID std::string compound = res.compound_id(); // Three-letter code (e.g., "ALA") char letter = res.compound_letter(); // One-letter code (e.g., 'A') // PDB-style identifiers std::string pdb_chain = res.pdb_strand_id(); int pdb_num = res.pdb_seq_num(); std::string ins_code = res.pdb_ins_code(); // Secondary structure dssp::structure_type ss = res.type(); // Types: Loop(' '), Alphahelix('H'), Betabridge('B'), Strand('E'), // Helix_3('G'), Helix_5('I'), Helix_PPII('P'), Turn('T'), Bend('S') // Helix position within each helix type auto h3_10 = res.helix(dssp::helix_type::_3_10); auto h_alpha = res.helix(dssp::helix_type::alpha); auto h_pi = res.helix(dssp::helix_type::pi); auto h_pp = res.helix(dssp::helix_type::pp); // Returns: None, Start, End, StartAndEnd, or Middle // Dihedral angles (optional - may not be defined at chain ends) std::optional phi = res.phi(); // Phi angle std::optional psi = res.psi(); // Psi angle std::optional omega = res.omega(); // Omega angle (peptide bond) std::optional kappa = res.kappa(); // Virtual bond angle std::optional alpha = res.alpha(); // Virtual torsion angle std::optional tco = res.tco(); // CO direction cosine // Geometry auto [x, y, z] = res.ca_location(); // C-alpha coordinates bool is_bend = res.bend(); // Is bend position bool is_cis = res.is_cis(); // Cis peptide bond bool is_pre_pro = res.is_pre_pro(); // Precedes proline // Beta sheet information int sheet_nr = res.sheet(); // Sheet number (0 if none) int strand_nr = res.strand(); // Strand number within sheet // Bridge partners for (int i = 0; i < 2; ++i) { auto [partner, ladder, parallel] = res.bridge_partner(i); if (partner) { std::cout << "Bridge partner " << i << ": " << partner.asym_id() << ":" << partner.seq_id() << " ladder=" << ladder << " parallel=" << parallel << "\n"; } } // Hydrogen bonds (donor and acceptor) for (int i = 0; i < 2; ++i) { auto [acceptor, acc_energy] = res.acceptor(i); auto [donor, don_energy] = res.donor(i); if (acceptor) std::cout << "Acceptor " << i << ": " << acceptor.seq_id() << " E=" << acc_energy << " kcal/mol\n"; if (donor) std::cout << "Donor " << i << ": " << donor.seq_id() << " E=" << don_energy << " kcal/mol\n"; } // Surface accessibility (only if calculated) double accessibility = res.accessibility(); // SS-bridge number (for cysteines only) int ss_bridge = res.ssBridgeNr(); // Chi angles (side chain torsions) size_t n_chi = res.nr_of_chis(); for (size_t i = 0; i < n_chi; ++i) { std::cout << "Chi" << i+1 << ": " << res.chi(i) << "\n"; } } ``` -------------------------------- ### Add dssp Library Subdirectory Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt This snippet adds the libdssp subdirectory to the build. It conditionally excludes it from all targets if INSTALL_LIBRARY is not set, controlling whether the library is built by default. ```cmake if(INSTALL_LIBRARY) add_subdirectory(libdssp) else() add_subdirectory(libdssp EXCLUDE_FROM_ALL) endif() ``` -------------------------------- ### Add Documentation Subdirectory Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Conditionally adds the 'doc' subdirectory to the build if BUILD_DOCUMENTATION is enabled. This allows for separate build rules for documentation generation. ```cmake if(BUILD_DOCUMENTATION) add_subdirectory(doc) endif() ``` -------------------------------- ### Test Hydrogen Bonds in C++ Source: https://context7.com/pdb-redo/dssp/llms.txt Uses the test_bond function to verify the existence of a hydrogen bond between two residues in a DSSP calculation object. ```cpp #include void check_bonds(const dssp& dssp_calc) { // Get two residues dssp::key_type key_a{"A", 137}; dssp::key_type key_b{"A", 6}; auto res_a = dssp_calc[key_a]; auto res_b = dssp_calc[key_b]; // Test if there's a bond between them if (test_bond(res_a, res_b)) { std::cout << "Hydrogen bond exists between A:137 and A:6\n"; } } ``` -------------------------------- ### Find Pandoc Executable Source: https://github.com/pdb-redo/dssp/blob/trunk/doc/CMakeLists.txt This CMake code snippet finds the Pandoc executable. If not found, a message is displayed indicating that documentation files cannot be recreated. ```cmake find_program(PANDOC pandoc) if(PANDOC) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pandoc-md.sh CONTENT "${PANDOC} ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.1 -t markdown | sed -e \"s/\\\' \\\' (space)/ ' ' (space)/\" > ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.md" FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.md DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.1 COMMAND "${CMAKE_CURRENT_BINARY_DIR}/pandoc-md.sh" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ VERBATIM) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.html DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.1 COMMAND ${PANDOC} -o mkdssp.html mkdssp.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ VERBATIM) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.pdf DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.1 COMMAND ${PANDOC} -o mkdssp.pdf mkdssp.1 -t html WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ VERBATIM) add_custom_target(doc_files DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.html ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.pdf ${CMAKE_CURRENT_SOURCE_DIR}/mkdssp.md) add_dependencies(mkdssp doc_files) else() message(STATUS "Could not find pandoc, cannot recreate documentation files") endif() ``` -------------------------------- ### Python Enumerations for DSSP Source: https://context7.com/pdb-redo/dssp/llms.txt Lists the available enumerations for secondary structure types, helix types, helix positions, chain breaks, and ladder directions. ```python from mkdssp import structure_type, helix_type, helix_position_type, chain_break_type, ladder_direction_type # Secondary structure types structure_type.Loop # ' ' - Loop/coil structure_type.Alphahelix # 'H' - Alpha helix structure_type.Betabridge # 'B' - Beta bridge structure_type.Strand # 'E' - Extended strand structure_type.Helix_3 # 'G' - 3-10 helix structure_type.Helix_5 # 'I' - Pi helix structure_type.Helix_PPII # 'P' - Poly-proline II helix structure_type.Turn # 'T' - Hydrogen-bonded turn structure_type.Bend # 'S' - Bend # Helix types for helix() method helix_type._3_10 # 3-10 helix helix_type.alpha # Alpha helix helix_type.pi # Pi helix helix_type.pp # Poly-proline helix # Helix position within a helix helix_position_type.NoHelix # Not in helix helix_position_type.Start # Start of helix helix_position_type.End # End of helix helix_position_type.StartAndEnd # Single-residue helix helix_position_type.Middle # Middle of helix # Chain break types chain_break_type.NoGap # No break chain_break_type.NewChain # Start of new chain chain_break_type.Gap # Gap within chain # Ladder direction (for bridge partners) ladder_direction_type.parallel ladder_direction_type.anti_parallel ``` -------------------------------- ### Configure Tarball Generation Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Configures CPack settings for creating source tarballs. It enables TGZ compression and specifies files to ignore during packaging. This is used for creating distributable source archives. ```cmake set(CPACK_SOURCE_TGZ ON) set(CPACK_SOURCE_TBZ2 OFF) set(CPACK_SOURCE_TXZ OFF) set(CPACK_SOURCE_TZ OFF) set(CPACK_SOURCE_IGNORE_FILES "/data/components.cif;/build;/.vscode;/.git") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) ``` -------------------------------- ### mkdssp - Assign Secondary Structure to Proteins Source: https://context7.com/pdb-redo/dssp/llms.txt The `mkdssp` command-line tool processes protein structure files (PDB, mmCIF) and outputs secondary structure assignments. It supports various output formats and options for customization. ```APIDOC ## mkdssp - Assign Secondary Structure to Proteins ### Description The `mkdssp` command-line tool processes protein structure files and outputs secondary structure assignments. It accepts both mmCIF and PDB format input files, with optional gzip compression. ### Method Command Line Tool ### Endpoint N/A (Local execution) ### Parameters #### Command Line Arguments - **input_file** (string) - Required - Path to the input structure file (PDB or mmCIF, can be gzipped). - **output_file** (string) - Optional - Path to the output file. If not provided, output goes to stdout. - **--output-format** (string) - Optional - Specifies the output format. Supported values: `dssp` (classic DSSP format), `cif` (mmCIF format, default). - **--min-pp-stretch** (integer) - Optional - Minimum length of a poly-proline stretch to be recognized (default is 3). - **--write-other** (boolean) - Optional - Include 'OTHER' type for loops in mmCIF output. - **--calculate-accessibility** (boolean) - Optional - Calculate surface accessibility explicitly for mmCIF output. - **--no-dssp-categories** (boolean) - Optional - Suppress DSSP-specific categories in mmCIF output. - **--mmcif-dictionary** (string) - Optional - Path to a custom mmCIF dictionary file. - **-v, --verbose** (boolean) - Optional - Enable verbose output. ### Request Example ```bash # Basic usage - output to stdout in mmCIF format (default) mkdssp input.cif # Process a PDB file and output classic DSSP format mkdssp --output-format=dssp input.pdb output.dssp # Process gzipped input and create compressed mmCIF output mkdssp input.cif.gz output.cif.gz # Specify minimum poly-proline stretch length (default is 3) mkdssp --min-pp-stretch=2 input.cif output.cif # Include OTHER type for loops in mmCIF output mkdssp --write-other input.cif output.cif # Calculate surface accessibility explicitly for mmCIF output mkdssp --calculate-accessibility input.cif output.cif # Suppress DSSP-specific categories in mmCIF output mkdssp --no-dssp-categories input.cif output.cif # Use custom mmCIF dictionary mkdssp --mmcif-dictionary=/path/to/mmcif_pdbx.dic input.cif # Verbose output mkdssp -v input.cif output.dssp ``` ### Response Output is written to stdout or a specified file, in the chosen format (mmCIF or DSSP). ``` -------------------------------- ### Configure mkdssp CMake Build Source: https://github.com/pdb-redo/dssp/blob/trunk/python-module/CMakeLists.txt Configures the build environment for the mkdssp Python module, including dependency checks and target definitions. ```cmake include(CPM) if(CMAKE_VERSION GREATER_EQUAL 3.30) cmake_policy(SET CMP0167 NEW) endif() find_package(Python 3.13 REQUIRED COMPONENTS Interpreter Development) if(NOT EXISTS ${Python_LIBRARIES}) message(FATAL_ERROR "The python library ${Python_LIBRARIES} does not seem to exist?") endif() find_package(Boost 1.86 REQUIRED COMPONENTS python) # --------- add_library(mkdssp_module SHARED dssp-python-plugin.cpp) target_compile_features(mkdssp_module PUBLIC cxx_std_20) target_include_directories(mkdssp_module PRIVATE ${Python_INCLUDE_DIRS}) target_link_libraries(mkdssp_module PRIVATE dssp::dssp ${Python_LIBRARIES} Boost::python) set_target_properties(mkdssp_module PROPERTIES PREFIX "" SUFFIX ".so" OUTPUT_NAME mkdssp LINKER_LANGUAGE CXX LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) if(WIN32) # python modules use this on Windows set_target_properties( mkdssp_module PROPERTIES SUFFIX ".pyd" RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) install(TARGETS mkdssp_module RUNTIME DESTINATION "${Python_SITELIB}") else() install(TARGETS mkdssp_module LIBRARY DESTINATION "${Python_SITELIB}") endif() ``` -------------------------------- ### Enumerations (Python) Source: https://context7.com/pdb-redo/dssp/llms.txt Lists and describes the available enumerations in the `mkdssp` Python module for secondary structure types, helix types, helix positions, chain breaks, and ladder directions. ```APIDOC ## Enumerations (Python) ### Description Provides a reference for the enumerations available in the `mkdssp` Python module. ### Secondary Structure Types ```python from mkdssp import structure_type structure_type.Loop # ' ' - Loop/coil structure_type.Alphahelix # 'H' - Alpha helix structure_type.Betabridge # 'B' - Beta bridge structure_type.Strand # 'E' - Extended strand structure_type.Helix_3 # 'G' - 3-10 helix structure_type.Helix_5 # 'I' - Pi helix structure_type.Helix_PPII # 'P' - Poly-proline II helix structure_type.Turn # 'T' - Hydrogen-bonded turn structure_type.Bend # 'S' - Bend ``` ### Helix Types ```python from mkdssp import helix_type helix_type._3_10 # 3-10 helix helix_type.alpha # Alpha helix helix_type.pi # Pi helix helix_type.pp # Poly-proline helix ``` ### Helix Position Types ```python from mkdssp import helix_position_type helix_position_type.NoHelix # Not in helix helix_position_type.Start # Start of helix helix_position_type.End # End of helix helix_position_type.StartAndEnd # Single-residue helix helix_position_type.Middle # Middle of helix ``` ### Chain Break Types ```python from mkdssp import chain_break_type chain_break_type.NoGap # No break chain_break_type.NewChain # Start of new chain chain_break_type.Gap # Gap within chain ``` ### Ladder Direction Types ```python from mkdssp import ladder_direction_type ladder_direction_type.parallel ladder_direction_type.anti_parallel ``` ``` -------------------------------- ### dssp Class - Core Secondary Structure Calculator (C++ API) Source: https://context7.com/pdb-redo/dssp/llms.txt The `dssp` class in the C++ library provides a programmatic interface to calculate secondary structure assignments from protein structure data. ```APIDOC ## dssp Class - Core Secondary Structure Calculator ### Description The `dssp` class is the main interface for calculating secondary structure. It processes a CIF datablock or mm::structure and provides iterators to access residue-level information. ### Method C++ Library Class ### Endpoint N/A (Library usage) ### Parameters #### Constructor Parameters - **datablock** (cif::datablock&) - Required - The datablock containing the structure data. - **model_nr** (int) - Required - The model number to process. - **min_poly_proline_stretch** (int) - Optional - Minimum length of a poly-proline stretch (default is 3). - **calculate_accessibility** (bool) - Optional - Whether to calculate surface accessibility (default is false). ### Request Example ```cpp #include #include #include int main() { // Load a structure file cif::file f; cif::gzio::ifstream in("1cbs.cif.gz"); f.load(in); // Fix up PDB-style mmCIF files if needed cif::pdb::fixup_pdbx(f); // Create DSSP calculator // Parameters: datablock, model_nr, min_poly_proline_stretch, calculate_accessibility dssp dssp_calc(f.front(), 1, 3, true); // Get statistics auto stats = dssp_calc.get_statistics(); std::cout << "Residues: " << stats.count.residues << "\n"; std::cout << "Chains: " << stats.count.chains << "\n"; std::cout << "H-bonds: " << stats.count.H_bonds << "\n"; std::cout << "SS-bridges: " << stats.count.SS_bridges << "\n"; std::cout << "Accessible surface: " << stats.accessible_surface << " A^2\n"; // Iterate over all residues for (const auto& res : dssp_calc) { std::cout << res.asym_id() << ":" << res.seq_id() << " " << res.compound_id() << " SS: " << static_cast(res.type()) << " Phi: " << res.phi().value_or(360) << " Psi: " << res.psi().value_or(360) << "\n"; } // Access specific residue by key (asym_id, seq_id) dssp::key_type key{"A", 15}; auto residue = dssp_calc[key]; std::cout << "Residue A:15 secondary structure: " << static_cast(residue.type()) << "\n"; return 0; } ``` ### Response Provides access to secondary structure information for each residue, including type, phi, psi angles, and other calculated properties. Statistics about the overall structure are also available. ``` -------------------------------- ### Add Testing Subdirectory Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Conditionally adds the 'test' subdirectory to the build if BUILD_TESTING is enabled and the project is at the top level. This integrates the project's test suite into the build process. ```cmake if(BUILD_TESTING AND PROJECT_IS_TOP_LEVEL) add_subdirectory(test) endif() ``` -------------------------------- ### Add Python Module Subdirectory Source: https://github.com/pdb-redo/dssp/blob/trunk/CMakeLists.txt Conditionally adds the 'python-module' subdirectory to the build if BUILD_PYTHON_MODULE is enabled. This allows for building Python bindings or modules for the dssp project. ```cmake if(BUILD_PYTHON_MODULE) add_subdirectory(python-module) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.