Skip to content

Commit b631bbf

Browse files
authored
Merge pull request BioAnalyticResource#263 from asherpasha/dev
Minor changes
2 parents fb15cf3 + 3a81792 commit b631bbf

File tree

12 files changed

+198
-339
lines changed

12 files changed

+198
-339
lines changed

.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-24.04
1414
strategy:
1515
matrix:
16-
python-version: [3.9, 3.10.15, 3.11, 3.12, 3.13]
16+
python-version: [3.10.16, 3.11, 3.12, 3.13]
1717

1818
services:
1919
redis:

api/models/canola_nssnp.py

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Optional
22
from api import db
3-
# from sqlalchemy.ext.declarative import declarative_base
43

54

65
# CanolaBase = declarative_base()

api/models/homologs_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class homologs(db.Model):
55
__bind_key__ = "homologs_db"
6-
__tablename__ = 'homologs'
6+
__tablename__ = "homologs"
77

88
homologs_id: db.Mapped[int] = db.mapped_column(db.Integer(), primary_key=True, autoincrement=True)
99
search_protein_name: db.Mapped[str] = db.mapped_column(db.String(45), nullable=False)

api/resources/snps.py

100755100644
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
)
2020
from api.models.canola_nssnp import (
2121
CanolaProteinReference as CanolaProteinReference,
22-
CanolaSnpsToProtein as CanolaSnpsToProtein
22+
CanolaSnpsToProtein as CanolaSnpsToProtein,
2323
)
2424
from api.models.homologs_db import homologs as HomologsDB
2525
from api.utils.bar_utils import BARUtils
@@ -557,13 +557,14 @@ def get(self, search_species="", search_gene="", target_species=""):
557557
gene_id = escape(search_gene)
558558
target_species = escape(target_species)
559559
supported = ["arabidopsis", "canola"]
560+
560561
if (search_species not in supported) or (target_species not in supported):
561562
return BARUtils.error_exit("Species not supported"), 400
562-
elif (search_species == "arabidopsis" and BARUtils.is_arabidopsis_gene_valid(gene_id)) or (search_species == "canola" and BARUtils.is_canola_gene_valid(gene_id)):
563+
elif (search_species == "arabidopsis" and BARUtils.is_arabidopsis_gene_valid(gene_id)) or (
564+
search_species == "canola" and BARUtils.is_canola_gene_valid(gene_id)
565+
):
563566
results = HomologsDB.query.filter_by(
564-
search_protein_name=gene_id,
565-
search_species_name=search_species,
566-
result_species_name=target_species
567+
search_protein_name=gene_id, search_species_name=search_species, result_species_name=target_species
567568
).all()
568569
if not results:
569570
return BARUtils.error_exit("No homologs found for the given query"), 400
@@ -575,7 +576,7 @@ def get(self, search_species="", search_gene="", target_species=""):
575576
"result_species_name": target_species,
576577
"result_protein_name": homolog.result_protein_name,
577578
"Percent_id": float(homolog.Percent_id),
578-
"e_score": float(homolog.e_score)
579+
"e_score": float(homolog.e_score),
579580
}
580581
for homolog in results
581582
]

api/utils/bar_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def is_cannabis_gene_valid(gene):
8686
@staticmethod
8787
def is_canola_gene_valid(gene):
8888
"""This function verifies if canola gene (BnaC07g42830D) is valid
89-
:param gene:
90-
:return:
91-
"""
89+
:param gene:
90+
:return:
91+
"""
9292
if re.search(r"^Bna[AC]\d{2}g\d{5}[A-D]?$", gene, re.I):
9393
return True
9494
else:

api/utils/docking_utils.py

100755100644
File mode changed.

config/BAR_API.cfg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SQLALCHEMY_BINDS = {
1515
'arachis': 'mysql://root:root@localhost/arachis',
1616
'brassica_rapa': 'mysql://root:root@localhost/brassica_rapa',
1717
'cannabis': 'mysql://root:root@localhost/cannabis',
18+
'canola_nssnp' : 'mysql://root:root@localhost/canola_nssnp',
1819
'dna_damage': 'mysql://root:root@localhost/dna_damage',
1920
'embryo': 'mysql://root:root@localhost/embryo',
2021
'eplant2': 'mysql://root:root@localhost/eplant2',
@@ -24,6 +25,7 @@ SQLALCHEMY_BINDS = {
2425
'eplant_tomato' : 'mysql://root:root@localhost/eplant_tomato',
2526
'fastpheno' : 'mysql://root:root@localhost/fastpheno',
2627
'germination': 'mysql://root:root@localhost/germination',
28+
'homologs_db' : 'mysql://root:root@localhost/homologs_db',
2729
'kalanchoe': 'mysql://root:root@localhost/kalanchoe',
2830
'klepikova': 'mysql://root:root@localhost/klepikova',
2931
'llama3': 'mysql://root:root@localhost/llama3',
@@ -40,8 +42,5 @@ SQLALCHEMY_BINDS = {
4042
'striga' : 'mysql://root:root@localhost/striga',
4143
'tomato_nssnp' : 'mysql://root:root@localhost/tomato_nssnp',
4244
'tomato_sequence' : 'mysql://root:root@localhost/tomato_sequence',
43-
'triphysaria' : 'mysql://root:root@localhost/triphysaria',
44-
'canola_nssnp' : 'mysql://root:root@localhost/canola_nssnp',
45-
'homologs_db' : 'mysql://root:root@localhost/homologs_db'
46-
45+
'triphysaria' : 'mysql://root:root@localhost/triphysaria'
4746
}

config/databases/canola_nssnp.sql

100755100644
Lines changed: 98 additions & 183 deletions
Large diffs are not rendered by default.

config/databases/homologs_db.sql

100755100644
Lines changed: 63 additions & 117 deletions
Large diffs are not rendered by default.

config/init.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/arabidopsis_ecotypes.sql
1414
mysql -u $DB_USER -p$DB_PASS < ./config/databases/arachis.sql
1515
mysql -u $DB_USER -p$DB_PASS < ./config/databases/brassica_rapa.sql
1616
mysql -u $DB_USER -p$DB_PASS < ./config/databases/cannabis.sql
17+
mysql -u $DB_USER -p$DB_PASS < ./config/databases/canola_nssnp.sql
1718
mysql -u $DB_USER -p$DB_PASS < ./config/databases/dna_damage.sql
1819
mysql -u $DB_USER -p$DB_PASS < ./config/databases/embryo.sql
1920
mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant2.sql
@@ -23,6 +24,7 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant_soybean.sql
2324
mysql -u $DB_USER -p$DB_PASS < ./config/databases/eplant_tomato.sql
2425
mysql -u $DB_USER -p$DB_PASS < ./config/databases/fastpheno.sql
2526
mysql -u $DB_USER -p$DB_PASS < ./config/databases/germination.sql
27+
mysql -u $DB_USER -p$DB_PASS < ./config/databases/homologs_db.sql
2628
mysql -u $DB_USER -p$DB_PASS < ./config/databases/kalanchoe.sql
2729
mysql -u $DB_USER -p$DB_PASS < ./config/databases/klepikova.sql
2830
mysql -u $DB_USER -p$DB_PASS < ./config/databases/llama3.sql
@@ -40,9 +42,6 @@ mysql -u $DB_USER -p$DB_PASS < ./config/databases/striga.sql
4042
mysql -u $DB_USER -p$DB_PASS < ./config/databases/tomato_nssnp.sql
4143
mysql -u $DB_USER -p$DB_PASS < ./config/databases/tomato_sequence.sql
4244
mysql -u $DB_USER -p$DB_PASS < ./config/databases/triphysaria.sql
43-
mysql -u $DB_USER -p$DB_PASS < ./config/databases/canola_nssnp.sql
44-
mysql -u $DB_USER -p$DB_PASS < ./config/databases/homologs_db.sql
45-
4645

4746
echo "Data are now loaded. Preparing API config"
4847
echo "Please manually edit config file!"

0 commit comments

Comments
 (0)