Skip to content

Commit

Permalink
Merge pull request #102 from karel-brinda/arglist
Browse files Browse the repository at this point in the history
Make attotree read the list of input files from a file
  • Loading branch information
karel-brinda authored Mar 6, 2024
2 parents 08c0cfc + f152ce2 commit 7abe08c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
17 changes: 16 additions & 1 deletion workflow/rules/asm.smk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
##


rule asm_list:
rule asm_list_unsorted:
"""
Make an unsorted list of input assemblies
"""
output:
list=fn_asm_list_unsorted(_batch="{batch}"),
input:
fa=w_batch_asms,
run:
dump_file_list(
input.fa,
output.list,
)


rule asm_list_sorted:
"""
Make a list of assemblies as they will appear in the .tar.xz archive
"""
Expand Down
11 changes: 11 additions & 0 deletions workflow/rules/init.smk
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def fn_hist_summary(_batch, _protocol):
# ASM


def fn_asm_list_unsorted(_batch):
return f"{dir_intermediate()}/asm/{_batch}.asm.list_unsorted"


def fn_asm_seq_dir(_batch):
return f"{dir_intermediate()}/asm/{_batch}"

Expand Down Expand Up @@ -235,6 +239,13 @@ def generate_file_list(input_list_fn, output_list_fn, filename_function):
g.write(fn + "\n")


# dump list of files into a file
def dump_file_list(input_files, output_list_fn):
with open(output_list_fn, "w") as g:
for x in input_files:
g.write(x + "\n")


def load_list(fn):
try:
with open(fn) as f:
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/tree.smk
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if not config["trees_required"]:
output:
nw=fn_tree_dirty(_batch="{batch}"),
input:
w_batch_asms,
nw=fn_asm_list_unsorted(_batch="{batch}"),
threads: config["attotree_threads"]
params:
k=config["attotree_kmer_length"],
Expand All @@ -85,6 +85,6 @@ if not config["trees_required"]:
-t {params.t} \\
-k {params.k} \\
-s {params.s} \\
{input} \\
-L {input.nw} \\
| tee {output.nw}
"""

0 comments on commit 7abe08c

Please sign in to comment.