Skip to content

Commit 1811bdd

Browse files
committed
Merge branch 'release/0.18.4'
2 parents 2df3009 + 4a8a5e9 commit 1811bdd

6 files changed

Lines changed: 192 additions & 153 deletions

File tree

.rtd-environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ dependencies:
2222
- pandas >=1.3, <3
2323
- pybedtools >=0.9.0
2424
- pysam >=0.16
25-
- python >=3.9, <3.12 # Motifsampler & setuptools break from py3.12
25+
- python >=3.9
2626
- python-xxhash
2727
- qnorm >=0.8.1
28-
- scikit-learn >=0.23.2 # https://scikit-learn.org/stable/install.html#installing-the-latest-release
28+
- scikit-learn >=0.23.2, <1.7 # v1.7 deprecated n_alphas
2929
- scipy >=1.5 # https://docs.scipy.org/doc/scipy/dev/toolchain.html#numpy
3030
- seaborn >=0.10.1
3131
- statsmodels

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
99

1010

1111

12+
## [0.18.4] - 2026-06-19
13+
14+
### Fixed
15+
16+
- `gimme motif2factors` now works with orthofinder 3.1.5
17+
18+
19+
1220
## [0.18.3] - 2026-06-09
1321

1422
### Added
@@ -533,6 +541,7 @@ manage your genomes.
533541

534542

535543
[Unreleased]: https://github.com/vanheeringen-lab/gimmemotifs/compare/master...develop
544+
[0.18.4]: https://github.com/vanheeringen-lab/gimmemotifs/compare/0.18.3...0.18.4
536545
[0.18.3]: https://github.com/vanheeringen-lab/gimmemotifs/compare/0.18.2...0.18.3
537546
[0.18.2]: https://github.com/vanheeringen-lab/gimmemotifs/compare/0.18.1...0.18.2
538547
[0.18.1]: https://github.com/vanheeringen-lab/gimmemotifs/compare/0.18.0...0.18.1

gimmemotifs/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.18.3"
1+
__version__ = "0.18.4"

gimmemotifs/orthologs.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ def motif2factor_from_orthologs(
112112

113113
# run orthofinder on our primary genes
114114
logger.info("Running orthofinder to find orthologs.")
115-
orthofinder_result = _orthofinder(f"{tmpdir}/prim_genes", threads)
115+
orthofinder_results_dir = _orthofinder(f"{tmpdir}/prim_genes", threads)
116116

117117
# now parse the output of orthofinder
118118
logger.info("Storing everything in a database.")
119119
orthogroup_db = f"{tmpdir}/orthologs.sqlite"
120-
load_orthogroups_in_db(orthogroup_db, all_genomes, orthofinder_result)
120+
load_orthogroups_in_db(orthogroup_db, all_genomes, orthofinder_results_dir)
121121

122122
# get all motifs and related factors from motif database
123123
motifs = read_motifs(database)
@@ -173,10 +173,12 @@ def _orthofinder(peptide_folder, threads):
173173
logger.debug(f"""stdout of orthofinder:\n {result.stdout.decode("utf-8")}""")
174174
logger.debug(f"""stderr of orthofinder:\n {result.stderr.decode("utf-8")}""")
175175

176-
orthofinder_result = re.search(
177-
"Results:\n (.*)", result.stdout.decode("utf-8")
176+
# [^/]+: match anything except forward slashes (including the present ANSI codes)
177+
# (.+)/: match anything until the last forward slash before a newline
178+
orthofinder_results_dir = re.search(
179+
"Results directory:[^/]+(.+)/", result.stdout.decode("utf-8")
178180
).group(1)
179-
return orthofinder_result
181+
return orthofinder_results_dir
180182

181183

182184
def _prepare_genomes_with_annot(genome, genome_dir, outdir):
@@ -354,7 +356,7 @@ def annot2primpep(genome, outdir):
354356
f.write("\n")
355357

356358

357-
def load_orthogroups_in_db(db, genomes, orthofinder_result):
359+
def load_orthogroups_in_db(db, genomes, orthofinder_results_dir):
358360
"""
359361
Save the results of orthofinder (tsv file) in a relational database
360362
(SQLite). This makes it possible to easily switch between genes and
@@ -363,15 +365,16 @@ def load_orthogroups_in_db(db, genomes, orthofinder_result):
363365
We create three tables; genes, orthogroups, and assemblies.
364366
"""
365367
orthogroups = pd.read_table(
366-
f"{orthofinder_result}/Phylogenetic_Hierarchical_Orthogroups/N0.tsv"
368+
f"{orthofinder_results_dir}/Orthogroups/Orthogroups.tsv"
367369
)
368370
unassigned = pd.read_table(
369-
f"{orthofinder_result}/Orthogroups/Orthogroups_UnassignedGenes.tsv"
371+
f"{orthofinder_results_dir}/Orthogroups/Orthogroups_UnassignedGenes.tsv"
370372
)
371373

372-
# remove old db if it exists (TODO: shouldnt be necessary?)
374+
# remove old db if it exists
373375
if os.path.exists(db):
374376
os.remove(db)
377+
375378
conn = sqlite3.connect(db)
376379
conn.execute(
377380
"""
@@ -412,7 +415,7 @@ def load_orthogroups_in_db(db, genomes, orthofinder_result):
412415

413416
# fill up our database
414417
# all orthogroups
415-
for orthogroup in orthogroups["HOG"]: # <-- all Hierarchical OrthoGroups
418+
for orthogroup in orthogroups["Orthogroup"]: # <-- all Hierarchical OrthoGroups
416419
conn.execute(f"INSERT INTO orthogroups VALUES(NULL, '{orthogroup}')")
417420
conn.execute("INSERT INTO orthogroups VALUES(NULL, 'UNASSIGNED')")
418421

@@ -423,7 +426,7 @@ def load_orthogroups_in_db(db, genomes, orthofinder_result):
423426
# all genes per species
424427
for assembly in genomes:
425428
for orthogroup, genes in zip(
426-
orthogroups["HOG"], orthogroups[f"{assembly}.pep"]
429+
orthogroups["Orthogroup"], orthogroups[f"{assembly}.pep"]
427430
):
428431
if isinstance(genes, float) and np.isnan(genes):
429432
continue

requirements.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ dependencies:
2626
- statsmodels
2727
- tqdm >=4.46.1
2828
- xdg
29-
- xgboost >=1.0.2 # optional: xgboost regression predictor for MOAP. 1 GB
3029

31-
# motif discovery tools
30+
# gimme maelstrom (optional)
31+
- xgboost >=1.0.2 # xgboost regression predictor for MOAP. 1 GB
32+
33+
# gimme motif2factors (optional)
34+
- gffread >=0.12.7
35+
- orthofinder >=3.1.5 # requires python >=3.11
36+
37+
# gimme motifs (optional)
3238
- gcc # optional: necessary to install motif discovery tools
3339
# AMD # installed from source
3440
# BioProspector # installed from source

0 commit comments

Comments
 (0)