Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix process substitutions #19

Merged
merged 5 commits into from
Apr 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
- name: Test with pytest
- name: Run all tests
run: |
make tests
make test
8 changes: 8 additions & 0 deletions attotree/attotree.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ def attotree(fns, newick_fo, k, s, t, phylogeny_algorithm, fof):
phylip2_fn = os.path.join(d, "distances.phylip")
newick1_fn = os.path.join(d, "tree.nw")
newick2_fo = newick_fo
if fof:
#This is to make the list of file pass to Mash even with
#process substitutions
old_fof_fn = fns[0]
new_fof_fn = os.path.join(d, "fof.txt")
with open(old_fof_fn) as f, open(new_fof_fn, 'w') as g:
g.write(f.read())
fns = [new_fof_fn]
mash_triangle(fns, phylip1_fn, k=k, s=s, t=t, fof=fof)
postprocess_mash_phylip(phylip1_fn, phylip2_fn)
quicktree(phylip2_fn, newick1_fn, algorithm=phylogeny_algorithm)
Expand Down
12 changes: 9 additions & 3 deletions tests/02_simple_tree/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ FASTAS=$(shell tar -tf test_spneumo.tar.xz)
## Compare trees ##
###################

all: tree.default.nw tree.file_list.nw tree.precomputed.newick
diff tree.default.nw tree.precomputed.newick
diff tree.file_list.nw tree.precomputed.newick
all: tree.precomputed.newick tree.default.nw tree.file_list.nw tree.file_list_proc_subst.nw
for x in $^; do \
2>&1 echo Testing "$$x"; \
diff $$x tree.precomputed.newick; \
done

###################################
# Different ways to compute trees #
Expand All @@ -28,6 +30,10 @@ tree.file_list.nw: file_list.txt
../../attotree/attotree.py -L "$<" > "$@.tmp"
mv "$@.tmp" "$@"

tree.file_list_proc_subst.nw: file_list.txt
../../attotree/attotree.py -L <(head -n 99999 "$<") > "$@.tmp"
mv "$@.tmp" "$@"

tree.precomputed.newick: tree.default.nw
cp $< $@

Expand Down
Loading