Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dssp #50714

Closed
wants to merge 20 commits into from
Closed

Add Dssp #50714

Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions recipes/dssp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

# Link dynamically
sed -i -e 's/\-static //' makefile

echo "DEST_DIR=${PREFIX}" > make.config
echo "MAN_DIR=${PREFIX}/share/man/man1" >> make.config

echo "BOOST_INC_DIR=${BUILD_PREFIX}/include" >> make.config
echo "BOOST_LIB_DIR=${BUILD_PREFIX}/lib" >> make.config
# Use conda-provided cxx
sed -i -e 's/^CXX/#CXX/' makefile

# clang++ won't find std::tuple unless in C++11 mode;
# don't compile with anything newer than C++11 since we use the removed
# std::unary_function
if [ `uname -s` = "Darwin" ]; then
CFLAGS="-std=c++11 -Wno-enum-constexpr-conversion ${CFLAGS}"
fi

make -j${CPU_COUNT} install
87 changes: 87 additions & 0 deletions recipes/dssp/dssp-boost-tr1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
diff -Nur dssp-3.0.0/src/dssp.cpp dssp-3.0.0-patched/src/dssp.cpp
--- dssp-3.0.0/src/dssp.cpp 2017-09-21 02:42:09.000000000 -0700
+++ dssp-3.0.0-patched/src/dssp.cpp 2018-04-25 11:05:47.499486529 -0700
@@ -73,7 +73,7 @@

double alpha;
char chirality;
- std::tr1::tie(alpha,chirality) = residue.Alpha();
+ std::tie(alpha,chirality) = residue.Alpha();

uint32 bp[2] = {};
char bridgelabel[2] = { ' ', ' ' };
diff -Nur dssp-3.0.0/src/primitives-3d.cpp dssp-3.0.0-patched/src/primitives-3d.cpp
--- dssp-3.0.0/src/primitives-3d.cpp 2017-09-21 02:42:09.000000000 -0700
+++ dssp-3.0.0-patched/src/primitives-3d.cpp 2018-04-25 11:05:54.642577464 -0700
@@ -152,7 +152,7 @@

// --------------------------------------------------------------------

-std::tr1::tuple<double,MPoint> QuaternionToAngleAxis(MQuaternion q)
+std::tuple<double,MPoint> QuaternionToAngleAxis(MQuaternion q)
{
if (q.R_component_1() > 1)
q = Normalize(q);
@@ -168,7 +168,7 @@

MPoint axis(q.R_component_2() / s, q.R_component_3() / s, q.R_component_4() / s);

- return std::tr1::make_tuple(angle, axis);
+ return std::make_tuple(angle, axis);
}

MPoint CenterPoints(std::vector<MPoint>& points)
diff -Nur dssp-3.0.0/src/primitives-3d.h dssp-3.0.0-patched/src/primitives-3d.h
--- dssp-3.0.0/src/primitives-3d.h 2017-09-21 02:42:09.000000000 -0700
+++ dssp-3.0.0-patched/src/primitives-3d.h 2018-04-25 11:05:18.542117901 -0700
@@ -12,7 +12,7 @@
#pragma once

#include <boost/math/quaternion.hpp>
-#include <boost/tr1/tuple.hpp>
+#include <tuple>

#include <vector>

@@ -71,7 +71,7 @@

MQuaternion Normalize(MQuaternion q);

-std::tr1::tuple<double,MPoint> QuaternionToAngleAxis(MQuaternion q);
+std::tuple<double,MPoint> QuaternionToAngleAxis(MQuaternion q);
MPoint Centroid(std::vector<MPoint>& points);
MPoint CenterPoints(std::vector<MPoint>& points);
MQuaternion AlignPoints(const std::vector<MPoint>& a,
diff -Nur dssp-3.0.0/src/structure.cpp dssp-3.0.0-patched/src/structure.cpp
--- dssp-3.0.0/src/structure.cpp 2017-09-21 02:42:09.000000000 -0700
+++ dssp-3.0.0-patched/src/structure.cpp 2018-04-25 11:05:41.581411192 -0700
@@ -554,7 +554,7 @@
return result;
}

-std::tr1::tuple<double,char> MResidue::Alpha() const
+std::tuple<double,char> MResidue::Alpha() const
{
double alhpa = 360;
char chirality = ' ';
@@ -571,7 +571,7 @@
else
chirality = '+';
}
- return std::tr1::make_tuple(alhpa, chirality);
+ return std::make_tuple(alhpa, chirality);
}

double MResidue::Kappa() const
diff -Nur dssp-3.0.0/src/structure.h dssp-3.0.0-patched/src/structure.h
--- dssp-3.0.0/src/structure.h 2017-09-21 02:42:09.000000000 -0700
+++ dssp-3.0.0-patched/src/structure.h 2018-04-25 11:05:03.233921919 -0700
@@ -171,7 +171,7 @@

double Phi() const;
double Psi() const;
- std::tr1::tuple<double,char>
+ std::tuple<double,char>
Alpha() const;
double Kappa() const;
double TCO() const;
52 changes: 52 additions & 0 deletions recipes/dssp/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% set version = "3.0.0" %}
{% set name = "dssp" %}
# This file, the patch file and build file were taken from conda salilab channel's recipes - please see https://github.com/salilab/conda-recipes for more.
package:
name: {{ name }}
version: {{ version }}

source:
url: https://salilab.org/dssp/dssp-{{ version }}.tgz
sha256: 25d39a2107767b622a59dd9fa790112c1516564b8518fc6ac0fab081d5ac3ab0
patches:
- dssp-boost-tr1.patch #Rebuild with latest gcc and boost - this was taken from the

build:
number: 0
run_exports:
- {{ pin_subpackage('dssp', max_pin="x.x") }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- boost-cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 'make' and the compilers should be in 'build'. The libraries should be in 'host'

- zlib
- bzip2
- make
run:
- {{ pin_compatible('boost-cpp') }}
Comment on lines +19 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Restructure dependencies sections.

Libraries should be in the host section, not in build. Only build tools like make and compilers should be in the build section. This ensures proper build environment setup.

 requirements:
   build:
     - {{ compiler('c') }}
     - {{ compiler('cxx') }}
-    - boost-cpp
-    - zlib
-    - bzip2
     - make
+  host:
+    - boost-cpp
+    - zlib
+    - bzip2
   run:
     - {{ pin_compatible('boost-cpp') }}
+    - zlib
+    - bzip2
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- boost-cpp
- zlib
- bzip2
- make
run:
- {{ pin_compatible('boost-cpp') }}
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- make
host:
- boost-cpp
- zlib
- bzip2
run:
- {{ pin_compatible('boost-cpp') }}
- zlib
- bzip2


about:
home: http://swift.cmbi.ru.nl/gv/dssp/
summary: 'Secondary structure assignment'
license: Boost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license_file ?

description: >
The DSSP program was designed by Wolfgang Kabsch and Chris Sander to
standardize secondary structure assignment. DSSP is a database of secondary
structure assignments (and much more) for all protein entries in the Protein
Data Bank (PDB). DSSP is also the program that calculates DSSP entries from
PDB entries. DSSP does not predict secondary structure.

Note that this is a very old version of DSSP, which we have used in the
past. It is kept here in the hope that others may find it useful - but
it may not work on newer systems (e.g. Apple Silicon Macs). We recommend
using the most recent version of DSSP instead.
See [the DSSP website](http://swift.cmbi.ru.nl/gv/dssp/) for more details.

If you have problems with this conda package, please
[open an issue](https://github.com/salilab/conda-recipes/issues).

Comment on lines +30 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update package metadata for better compliance.

Several improvements are needed in the about section:

  1. Add license_file field
  2. Use HTTPS for the home URL
  3. Consider adding doc_url and dev_url fields
  4. The warning about old version seems inconsistent with version 3.0.0
 about:
-  home: http://swift.cmbi.ru.nl/gv/dssp/
+  home: https://swift.cmbi.ru.nl/gv/dssp/
   summary: 'Secondary structure assignment'
   license: Boost
+  license_file: LICENSE
+  doc_url: https://swift.cmbi.ru.nl/gv/dssp/DSSP_3.html
+  dev_url: https://github.com/cmbi/dssp
   description: >
     The DSSP program was designed by Wolfgang Kabsch and Chris Sander to
     standardize secondary structure assignment. DSSP is a database of secondary
     structure assignments (and much more) for all protein entries in the Protein
     Data Bank (PDB). DSSP is also the program that calculates DSSP entries from
     PDB entries. DSSP does not predict secondary structure.

-    Note that this is a very old version of DSSP, which we have used in the
-    past. It is kept here in the hope that others may find it useful - but
-    it may not work on newer systems (e.g. Apple Silicon Macs). We recommend
-    using the most recent version of DSSP instead.
+    This is version 3.0.0 of DSSP, which includes modern C++ standards support
+    and compatibility with newer systems.
     See [the DSSP website](http://swift.cmbi.ru.nl/gv/dssp/) for more details.

-    If you have problems with this conda package, please
-    [open an issue](https://github.com/salilab/conda-recipes/issues).
+    If you have problems with this conda package, please open an issue at
+    https://github.com/bioconda/bioconda-recipes/issues

Committable suggestion skipped: line range outside the PR's diff.

test:
commands:
- mkdssp --version
34 changes: 34 additions & 0 deletions recipes/tamper/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

mkdir -p ${PREFIX}/bin/
mkdir -p ${PREFIX}/share/tamper/
mkdir -p ${PREFIX}/share/tamper/src/
mkdir -p ${PREFIX}/share/tamper/checkpoints/trained
cp -r src/. ${PREFIX}/share/tamper/src/
cp -r checkpoints/trained/. ${PREFIX}/share/tamper/checkpoints/trained
ls ${PREFIX}/share/tamper/src/
Comment on lines +7 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add source directory verification and error checking for file copying.

The current implementation doesn't verify source directories exist or handle copy errors properly.

+# Verify source directories exist
+[ ! -d "src" ] && echo "Error: src directory not found" && exit 1
+[ ! -d "checkpoints/trained" ] && echo "Error: checkpoints/trained directory not found" && exit 1
+
-cp -r src/. ${PREFIX}/share/tamper/src/
-cp -r checkpoints/trained/. ${PREFIX}/share/tamper/checkpoints/trained
-ls ${PREFIX}/share/tamper/src/
+cp -rv src/. ${PREFIX}/share/tamper/src/ || exit 1
+cp -rv checkpoints/trained/. ${PREFIX}/share/tamper/checkpoints/trained || exit 1
+
+# Verify files were copied
+echo "Verifying copied files..."
+[ -z "$(ls -A ${PREFIX}/share/tamper/src/)" ] && echo "Error: No files copied to src directory" && exit 1
+[ -z "$(ls -A ${PREFIX}/share/tamper/checkpoints/trained/)" ] && echo "Error: No files copied to checkpoints directory" && exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cp -r src/. ${PREFIX}/share/tamper/src/
cp -r checkpoints/trained/. ${PREFIX}/share/tamper/checkpoints/trained
ls ${PREFIX}/share/tamper/src/
# Verify source directories exist
[ ! -d "src" ] && echo "Error: src directory not found" && exit 1
[ ! -d "checkpoints/trained" ] && echo "Error: checkpoints/trained directory not found" && exit 1
cp -rv src/. ${PREFIX}/share/tamper/src/ || exit 1
cp -rv checkpoints/trained/. ${PREFIX}/share/tamper/checkpoints/trained || exit 1
# Verify files were copied
echo "Verifying copied files..."
[ -z "$(ls -A ${PREFIX}/share/tamper/src/)" ] && echo "Error: No files copied to src directory" && exit 1
[ -z "$(ls -A ${PREFIX}/share/tamper/checkpoints/trained/)" ] && echo "Error: No files copied to checkpoints directory" && exit 1


#This allows src code to be executbale for user and group
chmod -R u+x ${PREFIX}/share/tamper/src/
chmod -R g+x ${PREFIX}/share/tamper/src/

ls -lah ${PREFIX}/share/tamper/src/

#Adding python executable for the script to work
echo "#!/bin/bash" > ${PREFIX}/bin/predict_tAMPer
echo "python ${PREFIX}/share/tamper/src/predict_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/predict_tAMPer

echo "#!/bin/bash" > ${PREFIX}/bin/train_tAMPer.py
echo "python ${PREFIX}/share/tamper/src/train_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/train_tAMPer

Comment on lines +17 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve script creation and fix inconsistent naming.

Several issues need attention:

  1. train_tAMPer.py has a .py extension despite being a bash script
  2. Using echo for script creation is error-prone
  3. Missing error checking
-echo "#!/bin/bash" > ${PREFIX}/bin/predict_tAMPer
-echo "python ${PREFIX}/share/tamper/src/predict_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/predict_tAMPer
-
-echo "#!/bin/bash" > ${PREFIX}/bin/train_tAMPer.py
-echo "python ${PREFIX}/share/tamper/src/train_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/train_tAMPer
+# Create predict_tAMPer wrapper
+cat > "${PREFIX}/bin/predict_tAMPer" << 'EOF' || exit 1
+#!/bin/bash
+python "${PREFIX}/share/tamper/src/predict_tAMPer.py" "$@"
+EOF
+
+# Create train_tAMPer wrapper (removed .py extension)
+cat > "${PREFIX}/bin/train_tAMPer" << 'EOF' || exit 1
+#!/bin/bash
+python "${PREFIX}/share/tamper/src/train_tAMPer.py" "$@"
+EOF
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#Adding python executable for the script to work
echo "#!/bin/bash" > ${PREFIX}/bin/predict_tAMPer
echo "python ${PREFIX}/share/tamper/src/predict_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/predict_tAMPer
echo "#!/bin/bash" > ${PREFIX}/bin/train_tAMPer.py
echo "python ${PREFIX}/share/tamper/src/train_tAMPer.py \"\$@\"" >> ${PREFIX}/bin/train_tAMPer
#Adding python executable for the script to work
# Create predict_tAMPer wrapper
cat > "${PREFIX}/bin/predict_tAMPer" << 'EOF' || exit 1
#!/bin/bash
python "${PREFIX}/share/tamper/src/predict_tAMPer.py" "$@"
EOF
# Create train_tAMPer wrapper (removed .py extension)
cat > "${PREFIX}/bin/train_tAMPer" << 'EOF' || exit 1
#!/bin/bash
python "${PREFIX}/share/tamper/src/train_tAMPer.py" "$@"
EOF

#Checking if files are copied within bin
echo "Files in ${PREFIX}/bin/:"
ls -l ${PREFIX}/bin/

chmod +x ${PREFIX}/bin/predict_tAMPer
chmod +x ${PREFIX}/bin/train_tAMPer

#Verify permissions
echo "Permissions after chmod:"
ls -l ${PREFIX}/share/tamper/src/
Comment on lines +28 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve permission setting and verification.

The current verification process could be more robust with proper error checking and validation.

-chmod +x ${PREFIX}/bin/predict_tAMPer
-chmod +x ${PREFIX}/bin/train_tAMPer
+chmod +x "${PREFIX}/bin/predict_tAMPer" || exit 1
+chmod +x "${PREFIX}/bin/train_tAMPer" || exit 1
 
-#Verify permissions
-echo "Permissions after chmod:"
-ls -l ${PREFIX}/share/tamper/src/
+# Verify executables are properly set up
+for cmd in predict_tAMPer train_tAMPer; do
+    if [ ! -x "${PREFIX}/bin/${cmd}" ]; then
+        echo "Error: ${cmd} is not executable" >&2
+        exit 1
+    fi
+done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
chmod +x ${PREFIX}/bin/predict_tAMPer
chmod +x ${PREFIX}/bin/train_tAMPer
#Verify permissions
echo "Permissions after chmod:"
ls -l ${PREFIX}/share/tamper/src/
chmod +x "${PREFIX}/bin/predict_tAMPer" || exit 1
chmod +x "${PREFIX}/bin/train_tAMPer" || exit 1
# Verify executables are properly set up
for cmd in predict_tAMPer train_tAMPer; do
if [ ! -x "${PREFIX}/bin/${cmd}" ]; then
echo "Error: ${cmd} is not executable" >&2
exit 1
fi
done


43 changes: 43 additions & 0 deletions recipes/tamper/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% set name = "tamper" %}
{% set version = "1.0.1" %}

package:
name: '{{ name|lower }}'
version: '{{ version }}'

source:
url: https://github.com/bcgsc/tAMPer/releases/download/v{{ version }}/tAMPer_v{{ version }}.tar.gz
sha256: 0c4cfc57a844b89dbc9c020084b5d12b096359a7341350552f5ea707d882486a

build:
number: 1
noarch: generic
run_exports:
- {{ pin_subpackage(name, max_pin='x.x') }}

requirements:
host:
- python >=3.9
run:
- biopython
- dssp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use conda-forge dssp package instead of adding a new one.

According to the PR comments, DSSP is already available in conda-forge (https://anaconda.org/conda-forge/dssp). Instead of creating a new package in bioconda, consider using the existing conda-forge package by adding the channel specification:

- dssp
+ conda-forge::dssp
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- dssp
- conda-forge::dssp

- fair-esm>=2.0.0
- loguru
- pandas
- python>=3.9
- pytorch
- pytorch_cluster
- pytorch_geometric
- torch-scatter
Comment on lines +28 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add version constraints for PyTorch dependencies.

The PyTorch ecosystem packages often have strict version compatibility requirements. Missing version constraints could lead to dependency conflicts.

-   pytorch
-   pytorch_cluster
-   pytorch_geometric
-   torch-scatter
+   pytorch>=2.0
+   pytorch_cluster>=1.6
+   pytorch_geometric>=2.3
+   torch-scatter>=2.1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- pytorch
- pytorch_cluster
- pytorch_geometric
- torch-scatter
- pytorch>=2.0
- pytorch_cluster>=1.6
- pytorch_geometric>=2.3
- torch-scatter>=2.1


test:
commands:
- train_tAMPer -h
- predict_tAMPer -h

about:
home: https://github.com/bcgsc/tAMPer
license: GPL-3
license_family: GPL
license_file: LICENSE
summary: Structure-aware deep learning model for peptides toxicity prediction