Skip to content

Commit

Permalink
Patch: Catch bowtie2-build error due to empty FASTA file.
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Jan 21, 2025
1 parent 4098ef6 commit aba7762
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions workflow/rules/metavirs.smk
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def get_contigs_fasta(wildcards):
return i



def get_annotated_contigs(wildcards):
"""
Returns a samples annotated contigs text files.
Expand Down Expand Up @@ -607,7 +606,7 @@ rule metaspades:
# Build an index with assembled contigs
# and align reads against them
bowtie2-build --threads {threads} \\
{{ bowtie2-build --threads {threads} \\
{output.contigs} \\
{wildcards.name}/temp/{wildcards.name}_metaspades
bowtie2 -p {threads} \\
Expand All @@ -622,6 +621,13 @@ rule metaspades:
-o {output.final}
samtools index \\
-@ {threads} {output.final}
}} || {{
# Bowtie failed, maybe due to empty contigs FASTA file
echo "WARNING: An error occurred while running bowtie!"
echo "Please see the check the inputs to bowtie2-build"
echo "and bowtie2 to debug the issue."
touch {output}
}}
# Filter results based on contig length,
# get counts for the number of reads aligning
Expand Down Expand Up @@ -822,7 +828,7 @@ rule megahit:
# Build an index with assembled contigs
# and align reads against them
bowtie2-build --threads {threads} \\
{{ bowtie2-build --threads {threads} \\
{output.contigs} \\
{wildcards.name}/temp/{wildcards.name}_megahit
bowtie2 -p {threads} \\
Expand All @@ -837,6 +843,13 @@ rule megahit:
-o {output.final}
samtools index \\
-@ {threads} {output.final}
}} || {{
# Bowtie failed, maybe due to empty contigs FASTA file
echo "WARNING: An error occurred while running bowtie!"
echo "Please see the check the inputs to bowtie2-build"
echo "and bowtie2 to debug the issue."
touch {output}
}}
# Filter results based on contig length,
# get counts for the number of reads aligning
Expand Down

0 comments on commit aba7762

Please sign in to comment.