Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/bar-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [3.9, 3.10.15, 3.11, 3.12, 3.13]
python-version: [3.10.16, 3.11, 3.12, 3.13]

services:
redis:
Expand Down
1 change: 0 additions & 1 deletion api/models/canola_nssnp.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Optional
from api import db
# from sqlalchemy.ext.declarative import declarative_base


# CanolaBase = declarative_base()
Expand Down
2 changes: 1 addition & 1 deletion api/models/homologs_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class homologs(db.Model):
__bind_key__ = "homologs_db"
__tablename__ = 'homologs'
__tablename__ = "homologs"

homologs_id: db.Mapped[int] = db.mapped_column(db.Integer(), primary_key=True, autoincrement=True)
search_protein_name: db.Mapped[str] = db.mapped_column(db.String(45), nullable=False)
Expand Down
13 changes: 7 additions & 6 deletions api/resources/snps.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
from api.models.canola_nssnp import (
CanolaProteinReference as CanolaProteinReference,
CanolaSnpsToProtein as CanolaSnpsToProtein
CanolaSnpsToProtein as CanolaSnpsToProtein,
)
from api.models.homologs_db import homologs as HomologsDB
from api.utils.bar_utils import BARUtils
Expand Down Expand Up @@ -557,13 +557,14 @@ def get(self, search_species="", search_gene="", target_species=""):
gene_id = escape(search_gene)
target_species = escape(target_species)
supported = ["arabidopsis", "canola"]

if (search_species not in supported) or (target_species not in supported):
return BARUtils.error_exit("Species not supported"), 400
elif (search_species == "arabidopsis" and BARUtils.is_arabidopsis_gene_valid(gene_id)) or (search_species == "canola" and BARUtils.is_canola_gene_valid(gene_id)):
elif (search_species == "arabidopsis" and BARUtils.is_arabidopsis_gene_valid(gene_id)) or (
search_species == "canola" and BARUtils.is_canola_gene_valid(gene_id)
):
results = HomologsDB.query.filter_by(
search_protein_name=gene_id,
search_species_name=search_species,
result_species_name=target_species
search_protein_name=gene_id, search_species_name=search_species, result_species_name=target_species
).all()
if not results:
return BARUtils.error_exit("No homologs found for the given query"), 400
Expand All @@ -575,7 +576,7 @@ def get(self, search_species="", search_gene="", target_species=""):
"result_species_name": target_species,
"result_protein_name": homolog.result_protein_name,
"Percent_id": float(homolog.Percent_id),
"e_score": float(homolog.e_score)
"e_score": float(homolog.e_score),
}
for homolog in results
]
Expand Down
6 changes: 3 additions & 3 deletions api/utils/bar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def is_cannabis_gene_valid(gene):
@staticmethod
def is_canola_gene_valid(gene):
"""This function verifies if canola gene (BnaC07g42830D) is valid
:param gene:
:return:
"""
:param gene:
:return:
"""
if re.search(r"^Bna[AC]\d{2}g\d{5}[A-D]?$", gene, re.I):
return True
else:
Expand Down
Empty file modified api/utils/docking_utils.py
100755 → 100644
Empty file.
7 changes: 3 additions & 4 deletions config/BAR_API.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SQLALCHEMY_BINDS = {
'arachis': 'mysql://root:root@localhost/arachis',
'brassica_rapa': 'mysql://root:root@localhost/brassica_rapa',
'cannabis': 'mysql://root:root@localhost/cannabis',
'canola_nssnp' : 'mysql://root:root@localhost/canola_nssnp',
'dna_damage': 'mysql://root:root@localhost/dna_damage',
'embryo': 'mysql://root:root@localhost/embryo',
'eplant2': 'mysql://root:root@localhost/eplant2',
Expand All @@ -24,6 +25,7 @@ SQLALCHEMY_BINDS = {
'eplant_tomato' : 'mysql://root:root@localhost/eplant_tomato',
'fastpheno' : 'mysql://root:root@localhost/fastpheno',
'germination': 'mysql://root:root@localhost/germination',
'homologs_db' : 'mysql://root:root@localhost/homologs_db',
'kalanchoe': 'mysql://root:root@localhost/kalanchoe',
'klepikova': 'mysql://root:root@localhost/klepikova',
'llama3': 'mysql://root:root@localhost/llama3',
Expand All @@ -40,8 +42,5 @@ SQLALCHEMY_BINDS = {
'striga' : 'mysql://root:root@localhost/striga',
'tomato_nssnp' : 'mysql://root:root@localhost/tomato_nssnp',
'tomato_sequence' : 'mysql://root:root@localhost/tomato_sequence',
'triphysaria' : 'mysql://root:root@localhost/triphysaria',
'canola_nssnp' : 'mysql://root:root@localhost/canola_nssnp',
'homologs_db' : 'mysql://root:root@localhost/homologs_db'

'triphysaria' : 'mysql://root:root@localhost/triphysaria'
}
281 changes: 98 additions & 183 deletions config/databases/canola_nssnp.sql
100755 → 100644

Large diffs are not rendered by default.

180 changes: 63 additions & 117 deletions config/databases/homologs_db.sql
100755 → 100644

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions config/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/arabidopsis_ecotypes.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/arachis.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/brassica_rapa.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/cannabis.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/canola_nssnp.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/dna_damage.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/embryo.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant2.sql
Expand All @@ -23,6 +24,7 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant_soybean.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant_tomato.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/fastpheno.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/germination.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/homologs_db.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/kalanchoe.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/klepikova.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/llama3.sql
Expand All @@ -40,9 +42,6 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/striga.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/tomato_nssnp.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/tomato_sequence.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/triphysaria.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/canola_nssnp.sql
mysql -u $DB_USER -p$DB_PASS < ./config/databases/homologs_db.sql


echo "Data are now loaded. Preparing API config"
echo "Please manually edit config file!"
Expand Down
36 changes: 18 additions & 18 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
aniso8601==10.0.0
async-timeout==5.0.1
attrs==25.1.0
attrs==25.3.0
black==25.1.0
blinker==1.9.0
cachelib==0.9.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
coverage==7.6.10
coverage==7.7.1
Deprecated==1.2.18
flake8==7.1.1
flake8==7.2.0
Flask==3.1.0
Flask-Caching==2.3.0
Flask-Cors==5.0.0
Flask-Limiter==3.10.1
Flask-Caching==2.3.1
flask-cors==5.0.1
Flask-Limiter==3.12
flask-marshmallow==1.3.0
flask-restx==1.3.0
Flask-SQLAlchemy==3.1.1
greenlet==3.1.1
idna==3.10
importlib_resources==6.5.2
iniconfig==2.0.0
iniconfig==2.1.0
itsdangerous==2.2.0
Jinja2==3.1.5
Jinja2==3.1.6
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
limits==4.0.1
limits==4.4.1
markdown-it-py==3.0.0
MarkupSafe==3.0.2
marshmallow==3.26.1
Expand All @@ -36,24 +36,24 @@ mysqlclient==2.2.7
ordered-set==4.1.0
packaging==24.2
pathspec==0.12.1
platformdirs==4.3.6
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.12.1
pyflakes==3.2.0
pycodestyle==2.13.0
pyflakes==3.3.0
Pygments==2.19.1
pyrsistent==0.20.0
pytest==8.3.4
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.1
pytz==2025.2
redis==5.2.1
referencing==0.36.2
requests==2.32.3
rich==13.9.4
rpds-py==0.22.3
setuptools==75.8.0
rpds-py==0.24.0
setuptools==78.1.0
six==1.17.0
SQLAlchemy==2.0.38
typing_extensions==4.12.2
SQLAlchemy==2.0.40
typing_extensions==4.13.0
urllib3==2.3.0
Werkzeug==3.1.3
wheel==0.45.1
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/test_snps.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def test_get_snps(self):
"protein_coding",
"CODING",
"GSBRNA2T00000007001",
0.0066
0.0066,
]
]
],
}
self.assertEqual(response.json, expected)

Expand Down
Loading