Skip to content

Commit a995369

Browse files
authored
Merge pull request #215 from BioAnalyticResource/dev
Update main branch
2 parents 20c1679 + a7d7db5 commit a995369

28 files changed

Lines changed: 3995 additions & 41 deletions

.github/workflows/bar-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-22.04
1414
strategy:
1515
matrix:
16-
python-version: [3.8, 3.9, 3.10.13, 3.11, 3.12]
16+
python-version: [3.8, 3.9, 3.10.14, 3.11, 3.12]
1717

1818
services:
1919
redis:

.readthedocs.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
13+
# Build documentation in the "docs/" directory with Sphinx
14+
sphinx:
15+
configuration: docs/source/conf.py
16+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
17+
# builder: "dirhtml"
18+
# Fail on all warnings to avoid broken references
19+
# fail_on_warning: true
20+
21+
# Optionally build your docs in additional formats such as PDF and ePub
22+
formats:
23+
- pdf
24+
- epub
25+
26+
# Optional but recommended, declare the Python requirements required
27+
# to build your documentation
28+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
29+
python:
30+
install:
31+
- requirements: docs/requirements.txt

api/resources/fastpheno.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Author: Vince L
44
Fastpheno endpoint for retrieving tree data
55
"""
6+
67
from flask_restx import Namespace, Resource
78
from api import db
89
from api.models.fastpheno import Sites, Trees, Band, Height

api/resources/sequence.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Sequence endpoint that returns the amino acid sequence of a given protein, with additional options
55
for predicted sequences (Phyre2) that we host
66
"""
7+
78
from flask_restx import Namespace, Resource
89
from api.utils.bar_utils import BARUtils
910
from markupsafe import escape

api/resources/snps.py

100644100755
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from api.utils.hotspot_utils import HotspotUtils
2727
import sys
2828
from api import db, cache, limiter
29+
from api.utils.docking_utils import Docker
2930

3031

3132
snps = Namespace("SNPs", description="Information about SNPs", path="/snps")
@@ -47,6 +48,35 @@
4748
)
4849

4950

51+
@snps.route("/docking/<receptor>/<ligand>")
52+
class Docking(Resource):
53+
decorators = [limiter.limit("2/minute")]
54+
55+
@snps.param("receptor", _in="path", default="bri1")
56+
@snps.param("ligand", _in="path", default="brass")
57+
def get(self, receptor, ligand):
58+
receptor = escape(receptor)
59+
ligand = escape(ligand)
60+
docking_pdb_path = "/DATA/HEX_API/RESULTS/"
61+
62+
if not BARUtils.is_arabidopsis_gene_valid(receptor):
63+
return BARUtils.error_exit("Invalid arapbidopsis pdb gene id"), 400
64+
65+
matched = re.search("[a-z]", ligand)
66+
if matched is None:
67+
return BARUtils.error_exit("Invalid ligand name"), 400
68+
69+
# start function to initiate docking_utils file
70+
71+
final_json = Docker.start(receptor, ligand, docking_pdb_path)
72+
if final_json == "Receptor file not found":
73+
return BARUtils.error_exit("There are no data found for the given gene"), 400
74+
elif final_json == "Ligand file not found":
75+
return BARUtils.error_exit("There are no data found for the given ligand"), 400
76+
else:
77+
return BARUtils.success_exit(final_json)
78+
79+
5080
@snps.route("/phenix/<fixed_pdb>/<moving_pdb>")
5181
class Phenix(Resource):
5282
@snps.param("fixed_pdb", _in="path", default="Potri.016G107900.1")

0 commit comments

Comments
 (0)