Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 8b07bbb

Browse files
authored
Refactor tests (#15)
* refactor tests * linting * tweak dockerfile * rename test folder * Update Dockerfile and add working directory
1 parent 0b36b71 commit 8b07bbb

File tree

109 files changed

+2791
-442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2791
-442
lines changed

Dockerfile

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#==============================================================================================
2-
FROM python:3.6 as base
2+
FROM python:3.8 as base
33

44
LABEL author="Rodrigo V. Honorato <r.vargashonorato@uu.nl>"
55

@@ -10,18 +10,16 @@ RUN apt-get update && \
1010
&& \
1111
apt-get clean && rm -rf /var/lib/apt/lists/*
1212

13-
WORKDIR /opt/software
14-
15-
# Install Whiscy
16-
RUN git clone https://github.com/haddocking/whiscy.git && \
17-
cd whiscy && \
18-
git checkout tags/v1.1.1 && \
19-
cd /opt/software/whiscy/bin/protdist && \
20-
sh compile.sh
13+
# Copy Whiscy
14+
WORKDIR /opt/software/whiscy
15+
COPY . .
2116

17+
# install BioPython
2218
RUN pip install biopython==1.79
2319

24-
WORKDIR /opt/software/whiscy/bin
20+
# Build protdist
21+
WORKDIR /opt/software/whiscy/bin/protdist
22+
RUN sh compile.sh
2523

2624
# Build Muscle
2725
WORKDIR /opt/software/whiscy/muscle3.8.1551
@@ -30,7 +28,7 @@ RUN curl https://drive5.com/muscle/muscle_src_3.8.1551.tar.gz | tar xzv && \
3028
mv muscle /opt/software/whiscy/bin/muscle3.8.1551 && \
3129
sed -i "s/\/Users\/bjimenez\/bin\/muscle\/muscle3.8.31_i86darwin64/\/opt\/software\/whiscy\/bin\/muscle3.8.1551/g" /opt/software/whiscy/etc/local.json
3230

33-
# Install hsspconv
31+
# Build hsspconv
3432
RUN wget https://github.com/cmbi/hssp/archive/3.1.5.tar.gz && \
3533
tar -zxvf 3.1.5.tar.gz && \
3634
cd hssp-3.1.5 && \
@@ -41,7 +39,7 @@ RUN wget https://github.com/cmbi/hssp/archive/3.1.5.tar.gz && \
4139
sed -i "s/\/Users\/bjimenez\/bin\/hssp\/hsspconv/\/opt\/software\/whiscy\/bin\/hsspconv/g" /opt/software/whiscy/etc/local.json
4240

4341

44-
# Install freesasa
42+
# Build freesasa
4543
RUN wget https://github.com/mittinatten/freesasa/releases/download/2.0.3/freesasa-2.0.3.tar.gz && \
4644
tar -zxvf freesasa-2.0.3.tar.gz && \
4745
cd freesasa-2.0.3 && \
@@ -50,9 +48,16 @@ RUN wget https://github.com/mittinatten/freesasa/releases/download/2.0.3/freesa
5048

5149
# WHISCY exports
5250
ENV WHISCY_PATH=/opt/software/whiscy
53-
ENV PYTHONPATH="{$PYTHONPATH}:${WHISCY_PATH}"
51+
ENV PYTHONPATH="${PYTHONPATH}:${WHISCY_PATH}"
5452
ENV WHISCY_BIN="${WHISCY_PATH}/whiscy.py"
5553
ENV PATH="${WHISCY_PATH}:${WHISCY_PATH}/bin/freesasa/bin:${PATH}"
54+
55+
WORKDIR /data
56+
57+
###############################################################################################
58+
# No entrypoint here because Whiscy runs multiple commands
59+
###############################################################################################
60+
5661
#==============================================================================================
5762

5863
FROM base AS test
@@ -61,6 +66,5 @@ RUN pip install pytest coverage pytest pytest-cov hypothesis
6166

6267
WORKDIR /opt/software/whiscy
6368

64-
COPY test/ tests/
6569

6670
#==============================================================================================

bin/consadjust.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
__version__ = 1.0
44

5+
import argparse
6+
# Logging
7+
import logging
58
import math
69
import os
710
import sys
8-
import argparse
11+
912
import numpy as np
10-
from libwhiscy.whiscy_data import load_residue_weights, load_cons_file, load_z_table
11-
# Logging
12-
import logging
13+
14+
from libwhiscy.whiscy_data import (load_cons_file, load_residue_weights,
15+
load_z_table)
16+
1317
logger = logging.getLogger("consadjust")
1418
logger.setLevel(logging.INFO)
1519
ch = logging.StreamHandler(sys.stdout)

bin/parasmooth.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
__version__ = 1.0
44

5-
import math
6-
import os
75
import argparse
8-
import sys
96
# Logging
107
import logging
8+
import math
9+
import os
10+
import sys
11+
1112
logger = logging.getLogger("parasmooth")
1213
logger.setLevel(logging.INFO)
1314
ch = logging.StreamHandler(sys.stdout)
1415
ch.setLevel(logging.INFO)
1516
formatter = logging.Formatter('%(name)s [%(levelname)s] %(message)s')
1617
ch.setFormatter(formatter)
1718
logger.addHandler(ch)
18-
from libwhiscy.whiscy_data import load_cons_file, load_smoothing_parameter_file, \
19-
load_residue_distance_matrix
19+
from libwhiscy.whiscy_data import (load_cons_file,
20+
load_residue_distance_matrix,
21+
load_smoothing_parameter_file)
2022

2123

2224
def get_weight(par, val):

bin/residue_distance.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99

1010
__version__ = 1.0
1111

12+
import argparse
13+
# Logging
14+
import logging
1215
import os
1316
import sys
14-
import argparse
17+
1518
from Bio.PDB.PDBParser import PDBParser
16-
from libwhiscy.whiscy_data import load_conversion_table
19+
1720
from libwhiscy.pdbutil import is_hydrogen
18-
# Logging
19-
import logging
21+
from libwhiscy.whiscy_data import load_conversion_table
22+
2023
logger = logging.getLogger("residue_distance")
2124
logger.setLevel(logging.INFO)
2225
ch = logging.StreamHandler(sys.stdout)

bin/whiscy2bfactor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
__version__ = 1.0
66

7+
import argparse
78
import os
89
import sys
9-
import argparse
10-
1110

1211
STANDARD_TYPES = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C',
1312
'GLU': 'E', 'GLN': 'Q', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I',

bin/whiscy2haddock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
__version__ = 1.0
1010

11+
import argparse
1112
import os
1213
import sys
13-
import argparse
14-
import Bio.PDB
1514

15+
import Bio.PDB
1616

1717
STANDARD_TYPES = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C',
1818
'GLU': 'E', 'GLN': 'Q', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I',

libwhiscy/access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import subprocess
21
import os
2+
import subprocess
33

44

55
def calculate_accessibility(pdb_file_name, output_file_name):

libwhiscy/pam_calc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import os
2+
23
try:
34
from math import exp, isclose
45
except:
56
from math import exp
67
from numpy import isclose
7-
from libwhiscy.pam_data import logpameigval, pameigvec, pameigvecinv, code
8+
9+
from libwhiscy.pam_data import code, logpameigval, pameigvec, pameigvecinv
810

911

1012
class Distance():

libwhiscy/pdbutil.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
import os
55
import re
6+
7+
from Bio import AlignIO
68
from Bio.PDB import PDBList
9+
from Bio.PDB.PDBIO import Select
710
from Bio.PDB.PDBParser import PDBParser
811
from Bio.PDB.Polypeptide import is_aa, three_to_one
9-
from Bio.PDB.PDBIO import Select
10-
from Bio import AlignIO
1112

1213

1314
class NotAlternative(Select):

libwhiscy/quotes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import random
22

3-
43
_quotes = {"Mark Twain": "Too much of anything is bad, but too much good whiskey is barely enough.",
54
"Raymond Chandler": "There is no bad whiskey. There are only some whiskeys that aren’t as good as others.",
65
"Winston Churchill": "The water was not fit to drink. To make it palatable, we had to add whisky. By diligent effort, I learned to like it.",

0 commit comments

Comments
 (0)