Skip to content

Commit

Permalink
create nonexistant outbase parent directories if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
willdumm committed Aug 26, 2024
1 parent ee0bc22 commit 357cc61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gctree/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import random
import ete3
import itertools
from pathlib import Path


def test(args):
Expand Down Expand Up @@ -164,6 +165,9 @@ def isotype_add(forest):
isotype_names=args.isotype_names,
)

# Make parent directory of output file base string if it doesn't exist
Path(args.outbase).parent.mkdir(parents=True, exist_ok=True)

if len(args.infiles) == 2:
forest = bp.CollapsedForest(
pp.parse_outfile(args.infiles[0], args.infiles[1], args.root)
Expand Down
2 changes: 1 addition & 1 deletion tests/smalltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wget -O $substitutions https://bitbucket.org/kleinstein/shazam/raw/ba4b30fc6791e

# testing backward compatibility:

gctree infer tests/small_outfile tests/abundances.csv --outbase tests/smalltest_output/gctree.infer --root GL --frame 1 --verbose --idlabel --idmapfile tests/idmap.txt --isotype_mapfile tests/isotypemap.txt --mutability HS5F_Mutability.csv --substitution HS5F_Substitution.csv --ranking_coeffs 1 1 0 --use_old_mut_parsimony --branching_process_ranking_coeff 0
gctree infer tests/small_outfile tests/abundances.csv --outbase tests/smalltest_output/nonexistant_dir/gctree.infer --root GL --frame 1 --verbose --idlabel --idmapfile tests/idmap.txt --isotype_mapfile tests/isotypemap.txt --mutability HS5F_Mutability.csv --substitution HS5F_Substitution.csv --ranking_coeffs 1 1 0 --use_old_mut_parsimony --branching_process_ranking_coeff 0

gctree infer tests/smalltest_output/gctree.infer.inference.parsimony_forest.p --outbase tests/smalltest_output/gctree.infer --root GL --frame 1 --verbose --idlabel --idmapfile tests/idmap.txt --isotype_mapfile tests/isotypemap.txt --mutability HS5F_Mutability.csv --substitution HS5F_Substitution.csv --ranking_coeffs 1 -1 0 --use_old_mut_parsimony

Expand Down

0 comments on commit 357cc61

Please sign in to comment.