Commit 8d34460d authored by peguerin's avatar peguerin
Browse files

handle empty output {projet}{marker}

parent b276542b
......@@ -14,5 +14,6 @@ rule otu_fasta:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
python3 scripts/OTU_table2fasta.py {input} {output} 2> {log}
if [[ -s {input} ]]; then python3 scripts/OTU_table2fasta.py {input} {output} 2> {log};
else touch {output}; fi;
'''
......@@ -21,12 +21,13 @@ rule otu_table:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
python3 scripts/OTU_contingency_table.py \
if [[ -s {input} ]]; then python3 scripts/OTU_contingency_table.py \
{params.representatives} \
{params.stats} \
{params.swarm} \
{input} \
{params.qual} \
{params.assignment} \
results/06_sample_dereplicate_sequences/{wildcards.projmark}/*.fasta > {output} 2> {log}
results/06_sample_dereplicate_sequences/{wildcards.projmark}/*.fasta > {output} 2> {log};
else touch {output}; fi;
'''
......@@ -23,5 +23,6 @@ rule projetmarker_cluster_sequences:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
swarm -d 1 -f -t {threads} -z -i {params.struct} -s {params.stats} -w {output} -o {params.swarm} < {input} 2> {log}
if [[ -s {input} ]]; then swarm -d 1 -f -t {threads} -z -i {params.struct} -s {params.stats} -w {output} -o {params.swarm} < {input} 2> {log};
else touch {output}; fi;
'''
\ No newline at end of file
......@@ -20,6 +20,7 @@ rule projetmarker_dereplicate_sequences:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
vsearch --derep_fulllength {input} --sizein --sizeout --fasta_width 0 --output {output} > /dev/null 2> {log}
sed -i '1~2 s/$/;/g' {output}
if [[ -s {input} ]]; then vsearch --derep_fulllength {input} --sizein --sizeout --fasta_width 0 --output {output} > /dev/null 2> {log};
sed -i '1~2 s/$/;/g' {output};
else touch {output}; fi;
'''
\ No newline at end of file
......@@ -19,7 +19,7 @@ rule remove_annotations:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
obiannotate --delete-tag=scientific_name_by_db --delete-tag=obiclean_samplecount \
if [[ -s {input} ]]; then obiannotate --delete-tag=scientific_name_by_db --delete-tag=obiclean_samplecount \
--delete-tag=obiclean_count --delete-tag=obiclean_singletoncount \
--delete-tag=obiclean_cluster --delete-tag=obiclean_internalcount \
--delete-tag=obiclean_head --delete-tag=obiclean_headcount \
......@@ -27,5 +27,6 @@ rule remove_annotations:
--delete-tag=seq_length_ori --delete-tag=sminL --delete-tag=sminR \
--delete-tag=reverse_score --delete-tag=reverse_primer --delete-tag=reverse_match --delete-tag=reverse_tag \
--delete-tag=forward_tag --delete-tag=forward_score --delete-tag=forward_primer --delete-tag=forward_match \
--delete-tag=tail_quality {input} > {output} 2> {log}
--delete-tag=tail_quality {input} > {output} 2> {log};
else touch {output}; fi;
'''
......@@ -21,6 +21,7 @@ rule remove_chimera_sequences:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
vsearch --uchime_denovo {input} --uchimeout {output} 2> {log}
bash scripts/assignment.sh {input} > {params.assignment}
if [[ -s {input} ]]; then vsearch --uchime_denovo {input} --uchimeout {output} 2> {log};
bash scripts/assignment.sh {input} > {params.assignment};
else touch {output}; fi;
'''
\ No newline at end of file
......@@ -19,5 +19,6 @@ rule sort_abundance_assigned_sequences:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
obisort -k count -r {input} > {output} 2> {log}
if [[ -s {input} ]]; then obisort -k count -r {input} > {output} 2> {log};
else touch {output}; fi;
'''
\ No newline at end of file
......@@ -20,5 +20,6 @@ rule sort_representatives:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
vsearch --fasta_width 0 --sortbysize {input} --output {output} 2> {log}
if [[ -s {input} ]]; then vsearch --fasta_width 0 --sortbysize {input} --output {output} 2> {log};
else touch {output}; fi;
'''
\ No newline at end of file
......@@ -18,5 +18,6 @@ rule table_assigned_sequences:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
obitab -o {input} > {output} 2> {log}
if [[ -s {input} ]]; then obitab -o {input} > {output} 2> {log};
else touch {output}; fi;
'''
......@@ -23,5 +23,6 @@ rule taxonomic_assignment:
shell:
'''
mkdir -p {params.resFolder}/{wildcards.projmark}
ecotag -d {params.folder}/{params.prefix} -R {params.fasta} -m {params.minIdentity} {input} > {output} 2> {log}
if [[ -s {input} ]]; then ecotag -d {params.folder}/{params.prefix} -R {params.fasta} -m {params.minIdentity} {input} > {output} 2> {log};
else touch {output}; fi;
'''
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment