Skip to content

Commit 80081aa

Browse files
authored
Merge pull request #34 from microbial-pangenomes-lab/fork
Avoid troubles with python 3.14+
2 parents c47b293 + 9afeb5f commit 80081aa

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

panfeed/__main__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import logging.handlers
88
from functools import partial
99
import itertools
10+
import multiprocessing
1011
from multiprocessing import Process, Queue
1112

1213
from .__init__ import __version__
@@ -296,13 +297,15 @@ def main():
296297
compress=args.compress)
297298

298299
if args.cores > 2:
300+
ctx = multiprocessing.get_context('fork')
301+
299302
# thanks to @SamStudio8 for the inspiration
300303
read_q = Queue(maxsize = qlimit * args.cores)
301304
write_q = Queue(maxsize = qlimit)
302305

303306
processes = []
304307

305-
reader_process = Process(
308+
reader_process = ctx.Process(
306309
target=reader,
307310
args=(
308311
iter_i,
@@ -312,7 +315,7 @@ def main():
312315
)
313316
processes.append(reader_process)
314317

315-
writer_process = Process(
318+
writer_process = ctx.Process(
316319
target=writer,
317320
args=(
318321
func_w,
@@ -323,7 +326,7 @@ def main():
323326
processes.append(writer_process)
324327

325328
for i in range(args.cores - 2):
326-
p = Process(
329+
p = ctx.Process(
327330
target=worker,
328331
args=(
329332
iter_o,

tests/test_files.tar.gz

438 KB
Binary file not shown.

tests/unit_test.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
11
#!/bin/bash
22
argumentarray=()
3+
4+
green="\033[1;32m"
5+
red="\033[1;31m"
6+
reset="\033[0m"
7+
8+
die () {
9+
echo -e $red"############"$reset
10+
echo -e $red$1$reset
11+
echo -e $red"Test failed!"$reset
12+
echo -e $red"############"$reset
13+
exit 1
14+
}
315
##############single argument changes
416
#basic
5-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --output test_files/comp_data/panfeed_out/basic &> test_files/comp_data/logs/basic.log
17+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --output test_files/comp_data/panfeed_out/basic &> test_files/comp_data/logs/basic.log || die "Basic run failed"
618
argumentarray+=("basic")
19+
#cores
20+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --cores 4 --output test_files/comp_data/panfeed_out/cores &> test_files/comp_data/logs/cores.log || die "Multiple cores run failed"
21+
argumentarray+=("cores")
722
#no k-mers logged
8-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --output test_files/comp_data/panfeed_out/nolog &> test_files/comp_data/logs/nolog.log
23+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --output test_files/comp_data/panfeed_out/nolog &> test_files/comp_data/logs/nolog.log || die "No k-mers logged run failed"
924
argumentarray+=("nolog")
1025
#upstream
11-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 0 --output test_files/comp_data/panfeed_out/upstream &> test_files/comp_data/logs/upstream.log
26+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 0 --output test_files/comp_data/panfeed_out/upstream &> test_files/comp_data/logs/upstream.log || die "Upstream run failed"
1227
argumentarray+=("upstream")
1328
#downstream
14-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 0 --downstream 100 --output test_files/comp_data/panfeed_out/downstream &> test_files/comp_data/logs/downstream.log
29+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 0 --downstream 100 --output test_files/comp_data/panfeed_out/downstream &> test_files/comp_data/logs/downstream.log || die "Downstream run failed"
1530
argumentarray+=("downstream")
1631
#up-/downstream
17-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 100 --output test_files/comp_data/panfeed_out/updownstream &> test_files/comp_data/logs/updownstream.log
32+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 100 --output test_files/comp_data/panfeed_out/updownstream &> test_files/comp_data/logs/updownstream.log || die "Up-/downstream run failed"
1833
argumentarray+=("updownstream")
1934
#up-/downstream
20-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 100 --downstream-start-codon --output test_files/comp_data/panfeed_out/downstart &> test_files/comp_data/logs/downstart.log
35+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --upstream 100 --downstream 100 --downstream-start-codon --output test_files/comp_data/panfeed_out/downstart &> test_files/comp_data/logs/downstart.log || die "Downstream start codon run failed"
2136
argumentarray+=("downstart")
2237
#non-canonical
23-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --non-canonical --output test_files/comp_data/panfeed_out/noncanonical &> test_files/comp_data/logs/noncanonical.log
24-
argumentarray+=("noncanonical")
38+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --non-canonical --output test_files/comp_data/panfeed_out/noncanonical &> test_files/comp_data/logs/noncanonical.log || die "Non-canonical run failed"
39+
argumentarray+=("noncanonical")
2540
#no filter
26-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --no-filter --output test_files/comp_data/panfeed_out/nofilter &> test_files/comp_data/logs/nofilter.log
41+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --no-filter --output test_files/comp_data/panfeed_out/nofilter &> test_files/comp_data/logs/nofilter.log || die "No filter run failed"
2742
argumentarray+=("nofilter")
2843
#high maf
29-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --maf 0.1 --output test_files/comp_data/panfeed_out/highmaf &> test_files/comp_data/logs/highmaf.log
44+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --maf 0.1 --output test_files/comp_data/panfeed_out/highmaf &> test_files/comp_data/logs/highmaf.log || die "High MAF run failed"
3045
argumentarray+=("highmaf")
3146
#consider missing
32-
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --consider-missing --output test_files/comp_data/panfeed_out/considermissing &> test_files/comp_data/logs/considermissing.log
47+
python ../panfeed-runner.py --gff test_files/gffs/ --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --consider-missing --output test_files/comp_data/panfeed_out/considermissing &> test_files/comp_data/logs/considermissing.log || die "Consider missing run failed"
3348
argumentarray+=("considermissing")
3449
#fileoffiles
35-
python ../panfeed-runner.py --gff test_files/input_gffs.txt --fasta test_files/input_fastas.txt --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --output test_files/comp_data/panfeed_out/fileoffiles &> test_files/comp_data/logs/fileoffiles.log
50+
python ../panfeed-runner.py --gff test_files/input_gffs.txt --fasta test_files/input_fastas.txt --presence-absence test_files/gene_presence_absence.csv --targets test_files/stroi.txt --output test_files/comp_data/panfeed_out/fileoffiles &> test_files/comp_data/logs/fileoffiles.log || die "File of files run failed"
3651
argumentarray+=("fileoffiles")
3752
##############multiple argument changes
3853
##############compare output files

0 commit comments

Comments
 (0)