Skip to content

Commit

Permalink
fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Brown committed Jan 8, 2018
1 parent 1209693 commit eb2d197
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
16 changes: 11 additions & 5 deletions hundo/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,16 @@ rule dereplicate_sequences_by_sample:

rule combine_merged_reads:
input:
expand("tmp/{sample}_dereplicated.fasta", sample=SAMPLES)
fastas = expand("tmp/{sample}_dereplicated.fasta", sample=SAMPLES)
output:
"all-sequences.fasta"
shell:
"cat {input} > {output}"
fasta = "all-sequences.fasta"
run:
import shutil

with open(output.fasta, 'wb') as ofh:
for f in input.fastas:
with open(f, 'rb') as ifh:
shutil.copyfileobj(ifh, ofh, 1024*1024*10)


rule dereplicate_sequences:
Expand Down Expand Up @@ -1937,5 +1942,6 @@ rule report:


onsuccess:
shutil.rmtree("tmp", ignore_errors=True)
if not config["no_temp_declared"]:
shutil.rmtree("tmp", ignore_errors=True)
print("Protocol [%s] completed successfully." % PROTOCOL_VERSION)
2 changes: 1 addition & 1 deletion hundo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.4"
__version__ = "1.1.5"
9 changes: 8 additions & 1 deletion hundo/hundo.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ def run_annotate(
filter_contaminants = os.path.realpath(
filter_contaminants) if filter_contaminants else ""

no_temp_declared = False
for sa in snakemake_args:
if sa == "--nt" or sa == "--notemp":
no_temp_declared = True

cmd = ("snakemake --snakefile {snakefile} --directory {out_dir} "
"--printshellcmds --jobs {jobs} --rerun-incomplete "
"--nolock {conda} {dryrun} "
Expand All @@ -379,7 +384,8 @@ def run_annotate(
"blast_minimum_bitscore={blast_minimum_bitscore} "
"blast_top_fraction={blast_top_fraction} "
"read_identity_requirement={read_identity_requirement} "
"prefilter_file_size={prefilter_file_size} {add_args} "
"prefilter_file_size={prefilter_file_size} "
"no_temp_declared={no_temp_declared} {add_args} "
"{args}").format(
snakefile=get_snakefile(),
out_dir=os.path.realpath(out_dir),
Expand Down Expand Up @@ -410,6 +416,7 @@ def run_annotate(
blast_top_fraction=blast_top_fraction,
read_identity_requirement=read_identity_requirement,
prefilter_file_size=prefilter_file_size,
no_temp_declared=no_temp_declared,
add_args="" if snakemake_args and snakemake_args[
0].startswith("-") else "--",
args=" ".join(snakemake_args))
Expand Down

0 comments on commit eb2d197

Please sign in to comment.