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

1 scripts running for too long #3

Merged
merged 26 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cf8b3d8
Cleanup gitignore
aalexmmaldonado Mar 21, 2024
336caca
Add logger for multi threading
aalexmmaldonado Mar 21, 2024
ad6880e
Switch from while to for
aalexmmaldonado Mar 21, 2024
9c31bb8
Optional print viz
aalexmmaldonado Mar 21, 2024
afbdf76
Cleanup logging
aalexmmaldonado Mar 21, 2024
1528b78
Used except Exception instead of bare exception
aalexmmaldonado Mar 21, 2024
f2c6b14
Correct docstring format
aalexmmaldonado Mar 21, 2024
3aac8a1
Add check for combinatorial explosion
aalexmmaldonado Mar 22, 2024
2068cc7
Fix docs github actions
aalexmmaldonado Mar 22, 2024
e8c8bbd
Fix indenting of build.yml
aalexmmaldonado Mar 22, 2024
966ddb3
Ignore coverage report
aalexmmaldonado Mar 22, 2024
5241ef8
Try to fix test paths
aalexmmaldonado Mar 22, 2024
8af6cea
Fix paths?
aalexmmaldonado Mar 22, 2024
e284778
Print files in codecov.yaml
aalexmmaldonado Mar 22, 2024
6e8932b
Set minimum n_processors
aalexmmaldonado Mar 22, 2024
2a85d9e
Add minimum cores in traj
aalexmmaldonado Mar 22, 2024
fe1f7ff
Fix number of cores logger
aalexmmaldonado Mar 22, 2024
a900b1d
Merge branch 'main' into 1-scripts-running-for-too-long
aalexmmaldonado Mar 22, 2024
42d9213
Add lfs: true to GitHub workflows...
aalexmmaldonado Mar 22, 2024
08c6ad6
Updated changelog
aalexmmaldonado Mar 22, 2024
9bdc8da
fix: Handle missing chain IDs
aalexmmaldonado Mar 22, 2024
124d448
Increase n_paths_max to 100000
aalexmmaldonado Mar 22, 2024
0c8f7ac
Correct test_issue_1_serial source and sinks
aalexmmaldonado Mar 22, 2024
c09cc90
Bump up n_paths_max to 1000000
aalexmmaldonado Mar 22, 2024
dc9b09e
Update usage instructions
aalexmmaldonado Mar 22, 2024
01e897e
Handle UserInput for dict
aalexmmaldonado Mar 22, 2024
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
40 changes: 21 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@ jobs:
matrix:
python-version: ["3.10", "3.9"]

steps:
- name: Checkout repo
uses: actions/checkout@v4
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
lfs: true

- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}

- name: Initialize conda environment
run: make conda-create
- name: Initialize conda environment
run: make conda-create

- name: Setup conda
run: make conda-setup
- name: Setup conda
run: make conda-setup

- name: Install conda dependencies
run: make from-conda-lock
- name: Install conda dependencies
run: make from-conda-lock

- name: Poetry install
run: make install
- name: Poetry install
run: make install

- name: Run tests
run: make test
- name: Run tests
run: make test
2 changes: 2 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true

- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: make install

- name: Build documentation
run: make docs-versioned
run: make docs

- name: Setup Pages
uses: actions/configure-pages@v3
Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ ENV/
docs/source/_build
docs/html
docs/source/doc
public/

# psi4
timer.dat
Expand All @@ -118,8 +119,4 @@ psi.*.clean
tests/tmp/
tests/files/tmp/*
!tests/files/tmp/.gitkeep

# Reptar data
examples/reptar-data

docs/source/autoapi
report.xml
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Added

- Will keep track of `TER` in frames to correctly handle assigning chain IDs.
- Check for combinatorial explosions.

### Changed

- Modularized code and set up for deploying to PyPI.
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,24 @@ TODO: check that the VMD plugin installation works.
- `vmd_install_extension wisp wisp_tk_cb "Analysis/Wisp"`
2. Now open VMD: Click Extensions > Analysis > WISP

## How to Use WISP from the Command Line
## Usage

You may use the `wisp` command-line interface as shown below.

```bash
wisp -pdb_trajectory_filename tests/files/trajectory_20_frames.pdb -source_residues "C_LEU_10" -sink_residues C_ASP_11
```

Or, you may use wisp as a library in Python.

```python
wisp -pdb_trajectory_filename multi_frame_pdb.pdb -source_residues "X_SER_1 X_LEU_4" -sink_residues X_ARG_37`
from wisp.run import run_wisp
config = {
"pdb_trajectory_filename": "tests/files/trajectory_20_frames.pdb",
"source_residues": ["C_LEU_10"],
"sink_residues": ["C_ASP_11"],
}
paths = run_wisp(config)
```

## Program Output
Expand Down
42 changes: 10 additions & 32 deletions tests/test_wisp.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
import shutil
import subprocess

import numpy as np
import pytest

from wisp.run import run_wisp

# Ensures we execute from file directory (for relative paths).
os.chdir(os.path.dirname(os.path.realpath(__file__)))
current_dir = os.path.dirname(os.path.abspath(__file__))

FILE_DIR = "./files/"
WRITING_DIR = "./tmp/"
FILE_DIR = os.path.join(current_dir, "files/")
WRITING_DIR = os.path.join(current_dir, "tmp/")


def test_example():
Expand Down Expand Up @@ -49,7 +49,7 @@ def test_example():
"spline_smoothness": 0.01,
"vmd_resolution": 6,
"output_directory": test_dir,
"logfile": open(os.path.join(test_dir, "log.txt"), "w"),
"logfile": open(os.path.join(test_dir, "log.txt"), "w", encoding="utf-8"),
"user_specified_contact_map_filename": "",
"user_specified_functionalized_matrix_filename": "",
"simply_formatted_paths_filename": os.path.join(
Expand Down Expand Up @@ -114,40 +114,18 @@ def test_issue_1_serial():
"shortest_path_opacity": 1.0,
"shortest_path_r": 0.0,
"shortest_path_radius": 1.0,
"sink_residues": ["A_HIE_840"],
"source_residues": ["A_ASN_692"],
"sink_residues": ["C_HIE_840"],
"source_residues": ["B_ASN_692"],
"spline_smoothness": 0.01,
"vmd_resolution": 6,
"output_directory": test_dir,
"logfile": open(os.path.join(test_dir, "log.txt"), "w"),
"logfile": open(os.path.join(test_dir, "log.txt"), "w", encoding="utf-8"),
"user_specified_contact_map_filename": "",
"user_specified_functionalized_matrix_filename": "",
"simply_formatted_paths_filename": os.path.join(
test_dir, "simply_formatted_paths.txt"
),
"pdb_single_frame_filename": "",
}
paths = run_wisp(config)
test_data = np.array([i[0] for i in paths], dtype=np.float64)

# ref_data = np.array(
# [
# 1.1363589537262389,
# 2.027418997284591,
# 2.205901870787125,
# 2.307449850568712,
# 2.442623103273746,
# 2.448087831142992,
# 2.501932824731498,
# 2.5026984744745864,
# 2.621657347053458,
# 2.6370708377784413,
# 2.6804156982340315,
# 2.7056328296310643,
# 2.8932868716011986,
# 2.977212301921493,
# 3.0311375788312436,
# ],
# dtype=np.float64,
# )
# assert np.allclose(test_data, ref_data)
with pytest.raises(SystemExit) as e:
run_wisp(config)
11 changes: 7 additions & 4 deletions wisp/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@


def output_directory_info(params):
"""Create a README.txt file in the output directory describing the directory contents
"""Create a README.txt file in the output directory describing the directory
contents.

Arguments:
params -- the user-specified command-line parameters, a UserInput object
Args:
params: The user-specified command-line parameters, a UserInput object
"""

f = open(os.path.join(params["output_directory"], "README.txt"), "w")
f = open(
os.path.join(params["output_directory"], "README.txt"), "w", encoding="utf-8"
)
f.write(
"This directory contains output from the program WISP. The best way to visualize the output is to use a free program called VMD, which can be downloaded from http://www.ks.uiuc.edu/Research/vmd/ ."
+ "\n\n"
Expand Down
Loading
Loading