Skip to content

Commit

Permalink
fix: fallback when plasmids file exists but is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cpauvert committed May 19, 2023
1 parent 189e77d commit a22e0e4
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions workflow/rules/quality_check.smk
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ rule get_contig_list:
"results/quality_check/{isolate}/{isolate}.genome.fa",
output:
"results/quality_check/{isolate}/{isolate}.genome.tsv",
log:
"logs/quality_check/{isolate}_get_contig_list.log",
threads: 1
shell:
"""
grep '>' {input} | sed 's/>//' |\
awk '{{OFS="\t"; print $0,$0,"contig","linear","-"}}' > {output}
(grep '>' {input} | sed 's/>//' |\
awk '{{OFS="\t"; print $0,$0,"contig","linear","-"}}' > {output}) \
|| (cat /dev/null > {output})
"""


Expand All @@ -51,11 +54,14 @@ rule get_plasmid_list:
"results/plasmid_reconstruction/{isolate}/assembly_graph.cycs.fasta",
output:
"results/plasmid_reconstruction/{isolate}/{isolate}.plasmids.tsv",
log:
"logs/quality_check/{isolate}_get_plasmid_list.log",
threads: 1
shell:
"""
grep '>' {input} | sed 's/>//' |\
awk '{{OFS="\t"; print $0,$0,"plasmid","circular","-"}}' > {output}
(grep '>' {input} | sed 's/>//' |\
awk '{{OFS="\t"; print $0,$0,"plasmid","circular","-"}}' > {output}) \
|| (cat /dev/null > {output})
"""


Expand All @@ -65,6 +71,8 @@ rule combine_genome_plasmids:
"results/plasmid_reconstruction/{isolate}/assembly_graph.cycs.fasta",
output:
"results/quality_check/{isolate}/{isolate}.combined.fa",
log:
"logs/quality_check/{isolate}_combine_genome_plasmids.log",
threads: 1
shell:
"cat {input} > {output}"
Expand All @@ -76,6 +84,8 @@ use rule combine_genome_plasmids as create_replicon_list with:
"results/plasmid_reconstruction/{isolate}/{isolate}.plasmids.tsv",
output:
"results/quality_check/{isolate}/{isolate}.combined.tsv",
log:
"logs/quality_check/{isolate}_create_replicon_list.log",


rule checkM_for_quality:
Expand Down

0 comments on commit a22e0e4

Please sign in to comment.