Skip to content

Commit

Permalink
Refactor tests (#15)
Browse files Browse the repository at this point in the history
* refactor tests

* linting

* tweak dockerfile

* rename test folder

* Update Dockerfile and add working directory
  • Loading branch information
rvhonorato authored Apr 15, 2024
1 parent 0b36b71 commit 8b07bbb
Show file tree
Hide file tree
Showing 109 changed files with 2,791 additions and 442 deletions.
32 changes: 18 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#==============================================================================================
FROM python:3.6 as base
FROM python:3.8 as base

LABEL author="Rodrigo V. Honorato <[email protected]>"

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

WORKDIR /opt/software

# Install Whiscy
RUN git clone https://github.com/haddocking/whiscy.git && \
cd whiscy && \
git checkout tags/v1.1.1 && \
cd /opt/software/whiscy/bin/protdist && \
sh compile.sh
# Copy Whiscy
WORKDIR /opt/software/whiscy
COPY . .

# install BioPython
RUN pip install biopython==1.79

WORKDIR /opt/software/whiscy/bin
# Build protdist
WORKDIR /opt/software/whiscy/bin/protdist
RUN sh compile.sh

# Build Muscle
WORKDIR /opt/software/whiscy/muscle3.8.1551
Expand All @@ -30,7 +28,7 @@ RUN curl https://drive5.com/muscle/muscle_src_3.8.1551.tar.gz | tar xzv && \
mv muscle /opt/software/whiscy/bin/muscle3.8.1551 && \
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

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


# Install freesasa
# Build freesasa
RUN wget https://github.com/mittinatten/freesasa/releases/download/2.0.3/freesasa-2.0.3.tar.gz && \
tar -zxvf freesasa-2.0.3.tar.gz && \
cd freesasa-2.0.3 && \
Expand All @@ -50,9 +48,16 @@ RUN wget https://github.com/mittinatten/freesasa/releases/download/2.0.3/freesa

# WHISCY exports
ENV WHISCY_PATH=/opt/software/whiscy
ENV PYTHONPATH="{$PYTHONPATH}:${WHISCY_PATH}"
ENV PYTHONPATH="${PYTHONPATH}:${WHISCY_PATH}"
ENV WHISCY_BIN="${WHISCY_PATH}/whiscy.py"
ENV PATH="${WHISCY_PATH}:${WHISCY_PATH}/bin/freesasa/bin:${PATH}"

WORKDIR /data

###############################################################################################
# No entrypoint here because Whiscy runs multiple commands
###############################################################################################

#==============================================================================================

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

WORKDIR /opt/software/whiscy

COPY test/ tests/

#==============================================================================================
12 changes: 8 additions & 4 deletions bin/consadjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

__version__ = 1.0

import argparse
# Logging
import logging
import math
import os
import sys
import argparse

import numpy as np
from libwhiscy.whiscy_data import load_residue_weights, load_cons_file, load_z_table
# Logging
import logging

from libwhiscy.whiscy_data import (load_cons_file, load_residue_weights,
load_z_table)

logger = logging.getLogger("consadjust")
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
Expand Down
12 changes: 7 additions & 5 deletions bin/parasmooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

__version__ = 1.0

import math
import os
import argparse
import sys
# Logging
import logging
import math
import os
import sys

logger = logging.getLogger("parasmooth")
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(name)s [%(levelname)s] %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
from libwhiscy.whiscy_data import load_cons_file, load_smoothing_parameter_file, \
load_residue_distance_matrix
from libwhiscy.whiscy_data import (load_cons_file,
load_residue_distance_matrix,
load_smoothing_parameter_file)


def get_weight(par, val):
Expand Down
11 changes: 7 additions & 4 deletions bin/residue_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@

__version__ = 1.0

import argparse
# Logging
import logging
import os
import sys
import argparse

from Bio.PDB.PDBParser import PDBParser
from libwhiscy.whiscy_data import load_conversion_table

from libwhiscy.pdbutil import is_hydrogen
# Logging
import logging
from libwhiscy.whiscy_data import load_conversion_table

logger = logging.getLogger("residue_distance")
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
Expand Down
3 changes: 1 addition & 2 deletions bin/whiscy2bfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

__version__ = 1.0

import argparse
import os
import sys
import argparse


STANDARD_TYPES = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C',
'GLU': 'E', 'GLN': 'Q', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I',
Expand Down
4 changes: 2 additions & 2 deletions bin/whiscy2haddock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

__version__ = 1.0

import argparse
import os
import sys
import argparse
import Bio.PDB

import Bio.PDB

STANDARD_TYPES = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C',
'GLU': 'E', 'GLN': 'Q', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I',
Expand Down
2 changes: 1 addition & 1 deletion libwhiscy/access.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import subprocess
import os
import subprocess


def calculate_accessibility(pdb_file_name, output_file_name):
Expand Down
4 changes: 3 additions & 1 deletion libwhiscy/pam_calc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os

try:
from math import exp, isclose
except:
from math import exp
from numpy import isclose
from libwhiscy.pam_data import logpameigval, pameigvec, pameigvecinv, code

from libwhiscy.pam_data import code, logpameigval, pameigvec, pameigvecinv


class Distance():
Expand Down
5 changes: 3 additions & 2 deletions libwhiscy/pdbutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

import os
import re

from Bio import AlignIO
from Bio.PDB import PDBList
from Bio.PDB.PDBIO import Select
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import is_aa, three_to_one
from Bio.PDB.PDBIO import Select
from Bio import AlignIO


class NotAlternative(Select):
Expand Down
1 change: 0 additions & 1 deletion libwhiscy/quotes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import random


_quotes = {"Mark Twain": "Too much of anything is bad, but too much good whiskey is barely enough.",
"Raymond Chandler": "There is no bad whiskey. There are only some whiskeys that aren’t as good as others.",
"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.",
Expand Down
Empty file removed test/__init__.py
Empty file.
46 changes: 0 additions & 46 deletions test/test_access.py

This file was deleted.

31 changes: 0 additions & 31 deletions test/test_consadjust_regression.py

This file was deleted.

29 changes: 0 additions & 29 deletions test/test_pam_calc.py

This file was deleted.

32 changes: 0 additions & 32 deletions test/test_parasmooth_regression.py

This file was deleted.

29 changes: 0 additions & 29 deletions test/test_residue_distance_regression.py

This file was deleted.

Loading

0 comments on commit 8b07bbb

Please sign in to comment.