Skip to content

Commit b3d2d81

Browse files
authored
Merge pull request #34 from scwatts/fix-gh-actions
Fix GitHub Actions
2 parents 1810607 + f0ce688 commit b3d2d81

11 files changed

Lines changed: 32 additions & 24 deletions

File tree

.github/workflows/build.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ jobs:
4747
uses: actions/checkout@v3
4848
- name: Setup conda
4949
id: setup_conda
50-
uses: conda-incubator/setup-miniconda@v2
50+
uses: conda-incubator/setup-miniconda@v3
5151
with:
52-
python-version: 3.9
53-
miniforge-variant: Mambaforge-pypy3
5452
channels: umccr,bioconda,conda-forge,defaults
5553
channel-priority: true
54+
python-version: 3.9
5655
- name: Prepare env
5756
id: prepare_env
5857
run: |
59-
mamba install boa anaconda-client bump2version
58+
conda install bump2version conda-build anaconda-client
6059
# When on development branch (inferred from bump_version value), append '-dev' to package name and set
6160
# commit-specific version
6261
- name: Set package name and version
@@ -69,7 +68,7 @@ jobs:
6968
--no-commit
7069
- name: Build and upload conda package
7170
run: |
72-
conda mambabuild \
71+
conda build \
7372
--token "${{ secrets.ANACONDA_TOKEN }}" \
7473
conda/bactabolize/
7574

.github/workflows/lint.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ jobs:
99
shell: bash -l {0}
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: conda-incubator/setup-miniconda@v2
12+
- uses: conda-incubator/setup-miniconda@v3
1313
with:
14-
python-version: 3.9
15-
miniforge-variant: Mambaforge-pypy3
1614
environment-file: requirements-dev.yaml
1715
- name: execute_precommit_hooks
1816
run: |

.github/workflows/test.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ jobs:
99
shell: bash -l {0}
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: conda-incubator/setup-miniconda@v2
12+
- uses: conda-incubator/setup-miniconda@v3
1313
with:
14-
python-version: 3.9
15-
miniforge-variant: Mambaforge-pypy3
1614
environment-file: requirements-dev.yaml
1715
- name: prepare_environment
1816
run: |

.mdlrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rules "~MD024"
1+
rules "~MD024,~MD036"
22
style "#{File.dirname(__FILE__)}/.mdl_style.rb"

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[MESSAGE CONTROL]
2-
disable=logging-fstring-interpolation,duplicate-code,missing-module-docstring,use-dict-literal,use-list-literal,invalid-name,too-many-locals,too-few-public-methods,unspecified-encoding,missing-function-docstring,consider-using-f-string,missing-class-docstring,subprocess-run-check,too-many-arguments
2+
disable=logging-fstring-interpolation,duplicate-code,missing-module-docstring,use-dict-literal,use-list-literal,invalid-name,too-many-locals,too-few-public-methods,unspecified-encoding,missing-function-docstring,consider-using-f-string,missing-class-docstring,subprocess-run-check,too-many-arguments,import-error
33

44
[FORMAT]
55
max-line-length=120

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
A high-throughput genome-scale metabolic reconstruction and growth simulation pipeline.
44

55
## How to run
6+
67
**Install and quick start [here](https://github.com/kelwyres/Bactabolize/wiki/1.-Quick-start)**
78

89
**Visit the [wiki](https://github.com/kelwyres/Bactabolize/wiki) to find out more!**
910

1011
## Description
12+
1113
Bactabolize is designed for rapid generation of strain-specific metabolic reconstructions from bacterial genome data
1214
using the approach described in [Norsigian et al. Nature Protocols
1315
2020](https://www.nature.com/articles/s41596-019-0254-3). It leverages the [COBRApy
@@ -29,8 +31,7 @@ can be performed under a variety of growth conditions and mediums.
2931
Bactabolize is freely available under a [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
3032
Please cite the following papers if you make use of Bactabolize:
3133

32-
* Vezina B. / Watts S.C. et al. 'Bactabolize: A tool for high-throughput generation of bacterial strain-specific metabolic models'. eLife (2023).
33-
[https://doi.org/10.7554/eLife.87406.3](https://doi.org/10.7554/eLife.87406.3)
34+
* Vezina B. / Watts S.C. et al. 'Bactabolize: A tool for high-throughput generation of bacterial strain-specific
35+
metabolic models'. eLife (2023). [https://doi.org/10.7554/eLife.87406.3](https://doi.org/10.7554/eLife.87406.3)
3436
* Ebrahim, A., Lerman, J.A., Palsson, B.O. et al. 'COBRApy: COnstraints-Based Reconstruction and Analysis for Python'. BMC
3537
Syst Biol 7, 74 (2013). <https://doi.org/10.1186/1752-0509-7-74>
36-

bactabolize/alignment.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __str__(self):
3838

3939

4040
def run_blastp(query_fp, subject_fp):
41+
# pylint: disable=no-else-return
4142
# Create a database
4243
create_blast_database(subject_fp, 'prot')
4344
# Run alignment
@@ -51,6 +52,7 @@ def run_blastp(query_fp, subject_fp):
5152

5253

5354
def run_blastn(query_fp, subject_fp):
55+
# pylint: disable=no-else-return
5456
# Create database
5557
create_blast_database(subject_fp, 'nucl')
5658
# Run alignment

bactabolize/annotate.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def run(assembly_fp, output_fp):
3333
elif assembly_filetype == 'fasta':
3434
assembly_genbank_fp = None
3535
assembly_fasta_fp = assembly_fp
36+
else:
37+
assert False
3638
print('========================================')
3739
prodigal_data = run_prodigal(assembly_fasta_fp)
3840
prodigal_orfs = parse_prodigal_output(prodigal_data)
@@ -114,6 +116,7 @@ def get_qual_note(partial_str):
114116

115117

116118
def match_existing_orfs_updated_annotations(new_fp, existing_fp, overlap_min=0.80):
119+
# pylint: disable=too-many-branches
117120
# Get features and create list of start and end objects for each
118121
features_new = collect_all_features(new_fp)
119122
features_existing = collect_all_features(existing_fp)
@@ -126,17 +129,17 @@ def match_existing_orfs_updated_annotations(new_fp, existing_fp, overlap_min=0.8
126129
# Find overlaps
127130
positions = contig_positions_new[contig] + contig_positions_existing[contig]
128131
features_matched = discover_overlaps(positions, overlap_min)
129-
132+
130133
# Discover those not matched using location comparison
131134
features_matched_new = [f[0] for f in features_matched]
132135
features_matched_existing = [f[1] for f in features_matched]
133-
136+
134137
# Find unmatched features by comparing locations
135138
new_unmatched = []
136139
for feature in features_new[contig]:
137140
if not any(f.location == feature.location for f in features_matched_new):
138141
new_unmatched.append(feature)
139-
142+
140143
existing_unmatched = []
141144
for feature in features_existing[contig]:
142145
if not any(f.location == feature.location for f in features_matched_existing):
@@ -151,7 +154,7 @@ def match_existing_orfs_updated_annotations(new_fp, existing_fp, overlap_min=0.8
151154
continue
152155
feature_new.qualifiers[qual] = feature_existing.qualifiers[qual]
153156
features_updated.append(feature_new)
154-
157+
155158
# Add existing ORFs that had no match
156159
features_updated.extend(new_unmatched)
157160
features_updated.extend(existing_unmatched)
@@ -163,7 +166,7 @@ def match_existing_orfs_updated_annotations(new_fp, existing_fp, overlap_min=0.8
163166
print(f'\t{len(existing_unmatched)} existing features unmatched')
164167
print(f'\t{len(new_unmatched)} re-annotated features unmatched')
165168
print(f'\t{len(features_updated)} total features')
166-
169+
167170
# Update new genbank with new feature set
168171
update_genbank_annotations(new_fp, contig_features_updated)
169172

@@ -214,7 +217,7 @@ def discover_overlaps(positions, overlap_min):
214217
continue
215218
# Check if this pair is already matched by comparing locations
216219
already_matched = any(
217-
fn.location == feature_new.location and fe.location == feature_existing.location
220+
fn.location == feature_new.location and fe.location == feature_existing.location
218221
for fn, fe in features_matched
219222
)
220223
if already_matched:

bactabolize/draft_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ def run(config):
5656
original_genes.append(gene.id)
5757
model_draft.notes['Original_Genes'] = original_genes
5858

59-
# Same gene dictionary of reference model and genome annotations to csv
59+
# Same gene dictionary of reference model and genome annotations to csv
6060
gene_dict_fp = config.output_fp.parent / f'{config.output_fp.stem}_gene_dictionary.csv'
6161
with open(gene_dict_fp, 'w') as csv_file:
6262
writer = csv.writer(csv_file)
6363
for key, value in isolate_orthologs.items():
6464
writer.writerow([key, value])
65-
65+
6666
# Mutate a copy of the model and rename genes
6767
cobra.manipulation.modify.rename_genes(model_draft, isolate_orthologs)
6868

bactabolize/model_fba.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def run(config):
2121
model = cobra.io.load_json_model(fh)
2222
elif config.model_fp.suffix == '.xml':
2323
model = read_sbml_model(fh)
24+
else:
25+
assert False
26+
2427
if config.fba_spec_fp:
2528
spec = parse_spec(config.fba_spec_fp)
2629
elif config.fba_spec_name:

0 commit comments

Comments
 (0)