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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Python CI

on:
push:
branches: [ master, main, dev-master, dev-refactored, refactor-phylo ]
branches: [ main, dev]
pull_request:
branches: [ master, main, dev-master, dev-refactored, refactor-phylo ]
branches: [ main, dev]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -56,4 +56,4 @@ jobs:

- name: Notify failure
if: failure()
run: echo "Build failed"
run: echo "Build failed"
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'

- name: Cache pip
uses: actions/cache@v4
Expand Down
7 changes: 3 additions & 4 deletions OrthoEvol/Cookies/cookie_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
import yaml
from cookiecutter.hooks import run_script
from cookiecutter.main import cookiecutter
from pkg_resources import resource_filename

# OrthoEvol
from OrthoEvol import Cookies
from OrthoEvol.Manager.config import yml
from OrthoEvol.resources import package_resource_path
from OrthoEvol.Tools.logit import LogIt


class CookBook(object):
"""Class of cookiecutter related functions."""

_config_file = resource_filename(yml.__name__, "cookie_recipes.yml")
_config_file = package_resource_path(yml, "cookie_recipes.yml")

def __init__(self, config_file=_config_file, **new_recipes):
"""Access paths to the various cookiecutter templates.
Expand All @@ -28,7 +27,7 @@ def __init__(self, config_file=_config_file, **new_recipes):

New Recipes can also be added...
"""
self.CookieJar = Path(resource_filename(Cookies.__name__, ''))
self.CookieJar = package_resource_path(Cookies)
self.repo_cookie = self.CookieJar / Path('new_repository')
self.user_cookie = self.CookieJar / Path('new_user')
self.project_cookie = self.CookieJar / Path('new_project')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-r prod.txt

# Testing
pytest==3.0.7
pytest==9.1.1
WebTest==2.0.27
factory-boy==2.8.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
# Everything needed in production

# Flask
Flask==2.2.5
MarkupSafe==1.0
Flask==3.1.3
MarkupSafe==3.0.3
Werkzeug==3.1.5
Jinja2==3.1.6

itsdangerous==0.24
click>=5.0
itsdangerous==2.2.0
click==8.4.2

# Database
Flask-SQLAlchemy==2.2
psycopg2==2.7.1
SQLAlchemy==1.2.19
Flask-SQLAlchemy==3.1.1
psycopg2-binary==2.9.12
SQLAlchemy==2.0.51

# Migrations
Flask-Migrate==2.0.3
Flask-Migrate==4.1.0

# Forms
Flask-WTF==0.14.2
WTForms==2.1
Flask-WTF==1.3.0
WTForms==3.2.2

# Deployment
gunicorn>=19.1.1

# Assets
Flask-Assets==0.12
Flask-Assets==2.1.0
cssmin>=0.2.0
jsmin>=2.0.11

# Admin
Flask-User==0.6.11

# Auth
Flask-Login==0.4.0
Flask-Bcrypt==0.7.1
Flask-Login==0.6.3
Flask-Bcrypt==1.0.1

# Caching
Flask-Caching>=1.0.0

# Debug toolbar
Flask-DebugToolbar==0.10.1
Flask-DebugToolbar==0.16.0
14 changes: 9 additions & 5 deletions OrthoEvol/Manager/biosql/biosql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Standard Library
import os
import subprocess as sp
import pkg_resources
from pathlib import Path
# BioPython
from BioSQL import BioSeqDatabase
Expand All @@ -12,6 +11,7 @@
from OrthoEvol.Manager.management import ProjectManagement
from OrthoEvol.Manager.biosql.biosql_repo import sql
from OrthoEvol.Manager.biosql.biosql_repo import scripts as sql_scripts
from OrthoEvol.resources import package_resource_path


class BaseBioSQL(object):
Expand Down Expand Up @@ -46,9 +46,13 @@ def __init__(self, database_name, template_name="", project=None, project_path=N
self.biosql_proc = self.biosql_utils.system_cmd

# Load relative and absolute paths to scripts in the BioSQL module
self.scripts = pkg_resources.resource_filename(sql_scripts.__name__, "")
self.ncbi_taxon_script = pkg_resources.resource_filename(sql_scripts.__name__, "load_ncbi_taxonomy.pl")
self.itis_taxon_script = pkg_resources.resource_filename(sql_scripts.__name__, "load_itis_taxonomy.pl")
self.scripts = package_resource_path(sql_scripts)
self.ncbi_taxon_script = package_resource_path(
sql_scripts, "load_ncbi_taxonomy.pl"
)
self.itis_taxon_script = package_resource_path(
sql_scripts, "load_itis_taxonomy.pl"
)
if database_name:
self.database_name = Path(database_name)

Expand Down Expand Up @@ -132,7 +136,7 @@ def load_sqlite_schema(self):
"""
# Build the command
if not self.template_abs_path.is_file():
schema_file = pkg_resources.resource_filename(sql.__name__, self.schema_file)
schema_file = package_resource_path(sql, self.schema_file)
schema_cmd = self.schema_cmd % str(self.template_abs_path)
# Run the bash command
self.configure_new_database(schema_cmd, schema_file)
Expand Down
3 changes: 1 addition & 2 deletions OrthoEvol/Manager/config/templates/upload_rr_pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def _dispatch_config(config_file):
"from OrthoEvol.Manager.management import ProjectManagement\n" \
"from OrthoEvol.Manager.database_dispatcher import DatabaseDispatcher\n" \
"from OrthoEvol.Manager.config import yml\n" \
"from pkg_resources import resource_filename\n" \
"import yaml\n" \
"pm_config_file = \"%%s\"\n" \
"with open(pm_config_file, \'r\') as f:\n" \
Expand Down Expand Up @@ -87,4 +86,4 @@ def _dispatch_config(config_file):

# Dispatch PBS jobs
disp, conf = _dispatch_config(config_file)
dd.dispatch(strategies=list(disp.keys()),dispatcher=disp, configuration=conf)
dd.dispatch(strategies=list(disp.keys()),dispatcher=disp, configuration=conf)
24 changes: 12 additions & 12 deletions OrthoEvol/Manager/data_management.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Standard Library
import pkg_resources
import yaml
import yaml
# OrthoEvol
from OrthoEvol.Manager.management import ProjectManagement
from OrthoEvol.Manager import config
from OrthoEvol.Manager.management import ProjectManagement
from OrthoEvol.Manager.config import yml
from OrthoEvol.Manager.database_management import BaseDatabaseManagement
from OrthoEvol.Orthologs.Align import MultipleSequenceAlignment as MSA
from OrthoEvol.Orthologs.Blast.blast import OrthoBlastN
from OrthoEvol.Orthologs.Blast.comparative_genetics import BaseComparativeGenetics
from OrthoEvol.Orthologs.GenBank.genbank import GenBank
from OrthoEvol.Orthologs.GenBank.genbank import GenBank
from OrthoEvol.resources import package_resource_path


#import configparser
Expand Down Expand Up @@ -43,13 +43,13 @@ def __init__(self, config_file=None, pipeline=None, new=False, start=False, **kw
self.GenBank_config = self.Alignment_config = None
# Alignment configuration
self.Guidance_config = self.Clustalo_config = self.Pal2Nal_config = None
self.pm = self.bl = self.gb = self.al = self.db = None
if pipeline == 'Ortho_CDS_1':
if new is True:
config_file = pkg_resources.resource_filename(config.yaml.__name__, 'pipeline.yml')
else:
config_file = pkg_resources.resource_filename(
config.yaml.__name__, 'config_template_existing.yml')
self.pm = self.bl = self.gb = self.al = self.db = None
if pipeline == 'Ortho_CDS_1':
if new is True:
config_file = package_resource_path(yml, 'pipeline.yml')
else:
config_file = package_resource_path(
yml, 'initialize_old.yml')
if config_file is not None:
if start is True:
self.configure(config_file)
Expand Down
4 changes: 2 additions & 2 deletions OrthoEvol/Manager/database_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from collections import OrderedDict
from importlib import import_module
from pathlib import Path
from pkg_resources import resource_filename
import subprocess as sp
# OrthoEvol
from OrthoEvol import OrthoEvolDeprecationWarning
Expand All @@ -19,6 +18,7 @@
from OrthoEvol.Manager.management import ProjectManagement
from OrthoEvol.Orthologs.Blast.comparative_genetics import BaseComparativeGenetics
from OrthoEvol.Manager.config import templates
from OrthoEvol.resources import package_resource_path


class BaseDatabaseManagement(object):
Expand Down Expand Up @@ -752,7 +752,7 @@ def NCBI_refseq_release(self, configure_flag=None, archive_flag=None, delete_fla
db_path = self.database_path / Path('NCBI') / Path('refseq') / Path('release') / Path(collection_subset)

# Read the upload script
upload_script = resource_filename(templates.__name__, 'upload_rr_pbs.py')
upload_script = package_resource_path(templates, 'upload_rr_pbs.py')
with open(upload_script, 'r') as upload_script:
temp_script = upload_script.read()
rand_str = random.sample(string.ascii_letters + string.digits, 5)
Expand Down
18 changes: 9 additions & 9 deletions OrthoEvol/Manager/management.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Directory management tools for the package."""
# Standard Library
import os
from pathlib import Path
import pkg_resources
# OrthoEvol
from OrthoEvol import Cookies, Orthologs, Manager, Tools
from OrthoEvol.Cookies import Oven
from OrthoEvol.Tools.logit import LogIt
from pathlib import Path
# OrthoEvol
from OrthoEvol import Cookies, Orthologs, Manager, Tools
from OrthoEvol.Cookies import Oven
from OrthoEvol.resources import package_resource_path
from OrthoEvol.Tools.logit import LogIt


class Management(object):
Expand Down Expand Up @@ -37,19 +37,19 @@ def __init__(self, repo=None, home=os.getcwd(), new_repo=False, **kwargs):
self.Kitchen = Oven(repo=self.repo, output_dir=self.file_home)
self.Pantry = self.Kitchen.Recipes
# Manager Module:
self.Manager = Path(pkg_resources.resource_filename(Manager.__name__, ''))
self.Manager = package_resource_path(Manager)
self.BioSQL = self.Manager / Path('BioSQL')
self.SQLite3 = self.BioSQL / Path('sqlite')
self.MySQL = self.BioSQL / Path('mysql')
self.config = self.Manager / Path('config')
# Orthologs Module:
self.Orthologs = Path(pkg_resources.resource_filename(Orthologs.__name__, ''))
self.Orthologs = package_resource_path(Orthologs)
self.Align = self.Orthologs / Path('Align')
self.Blast = self.Orthologs / Path('Blast')
self.GenBank = self.Orthologs / Path('GenBank')
self.Phylogenetics = self.Orthologs / Path('Phylogenetics')
# Tools Module:
self.Tools = Path(pkg_resources.resource_filename(Tools.__name__, ''))
self.Tools = package_resource_path(Tools)
self.ftp = self.Tools / Path('ftp')
self.logit = self.Tools / Path('logit')
self.mpi = self.Tools / Path('mpi')
Expand Down
16 changes: 8 additions & 8 deletions OrthoEvol/Manager/webster.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Standard Library
import re
import textwrap as twrap
from pathlib import Path
from pkg_resources import resource_filename
# OrthoEvol
from OrthoEvol.Manager.config import references
from pathlib import Path
# OrthoEvol
from OrthoEvol.Manager.config import references
from OrthoEvol.resources import package_resource_path



Expand Down Expand Up @@ -39,16 +39,16 @@ class Webster(object):
Unreliable Alignment Regions Accounting for the Uncertainty of Multiple Parameters. Nucleic Acids
Research, 2015 Jul 1; 43 (Web Server issue): W7-W14.; doi: 10.1093/nar/gkq443""",
"link": "https://www.ncbi.nlm.nih.gov/pubmed/18229673",
"path": resource_filename(
references.__name__, "GUIDANCE2_Accurate_Detection_of_Unreliable_Alignment_Regions_Accounting_for_"
"path": package_resource_path(
references, "GUIDANCE2_Accurate_Detection_of_Unreliable_Alignment_Regions_Accounting_for_"
"the_Uncertainty_of_Multiple_Parameters.pdf")
},
"reference_2": {
"citation": u"""Landan, G., and D. Graur. (2008). Local Reliability Measures from Sets of Co-optimal
Multiple Sequence Alignments. Pac Symp Biocomput 13:15-24""",
"link": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4489236/",
"path": resource_filename(
references.__name__, "Local_Reliability_Measures_from_Sets_of_Co-optimal_Multiple_Sequence_"
"path": package_resource_path(
references, "Local_Reliability_Measures_from_Sets_of_Co-optimal_Multiple_Sequence_"
"Alignments.pdf")
}
},
Expand Down
4 changes: 2 additions & 2 deletions OrthoEvol/Orthologs/Blast/comparative_genetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import time
import copy
import random
import pkg_resources
from pathlib import Path
# OrthoEvol
from OrthoEvol.Manager.config import data
from OrthoEvol.Manager.management import ProjectManagement
from OrthoEvol.utilities import FullUtilities
from OrthoEvol.Tools.logit import LogIt
from OrthoEvol.resources import package_resource_path
# Other
import pandas as pd
from ete3 import NCBITaxa
Expand Down Expand Up @@ -125,7 +125,7 @@ def __init__(self, project=None, project_path=os.getcwd(), acc_file=None,
self.taxon_path = self.project_index / Path(self.taxon_file)
# Handle the master accession file (could be before or after blast)
if kwargs["copy_from_package"]:
shutil.copy(pkg_resources.resource_filename(data.__name__, self.acc_file),
shutil.copy(package_resource_path(data, self.acc_file),
str(self.project_index))
else:
shutil.copy(self.acc_file, str(self.project_index))
Expand Down
10 changes: 5 additions & 5 deletions OrthoEvol/Orthologs/Phylogenetics/PAML/codeml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import os
from pathlib import Path
from shutil import copy
import pkg_resources
# BioPython
# BioPython
from Bio.Phylo.PAML import codeml
# OrthoEvol
from OrthoEvol.Manager.config import paml_control_files
from OrthoEvol.Manager.config import paml_control_files
from OrthoEvol.resources import package_resource_path


class CodemlRun(object):
Expand Down Expand Up @@ -39,8 +39,8 @@ def __init__(self, P2N_alignment, iqtree_newick, control_file='codeml-8-11-2017.
# Set up genes control file name and get the OrthoEvol control file path
self.gene = str(iqtree_newick).replace('_iqtree.nwk', '')
self.control_file = self.paml_path / Path(self.gene + '.ctl')
self.control_template = pkg_resources.resource_filename(
paml_control_files.__name__, control_file)
self.control_template = package_resource_path(
paml_control_files, control_file)
print(self.control_template)

# Set up CODEML input files
Expand Down
2 changes: 1 addition & 1 deletion OrthoEvol/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Tutorial
=============
OrthoEvolution has been built with Python 3.9 (and up) as a multi-faceted package and pipeline
OrthoEvolution has been built with Python 3.11 (and up) as a multi-faceted package and pipeline
framework for comparative genetics in order to infer orthologous genes.

Currently, this python package is comprised of 5 major modules:
Expand Down
Loading
Loading