Skip to content

Commit

Permalink
Robust low coverage (#37)
Browse files Browse the repository at this point in the history
* Handle low-coverage samples

* Fix duplicated sample ID
  • Loading branch information
dfornika authored Aug 29, 2023
1 parent 3eb07cd commit 4a26067
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bin/check_for_empty_assembly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

import argparse
import os

def main(args):
input_num_bytes = os.path.getsize(args.assembly)
if input_num_bytes == 0:
with open(args.assembly, 'w') as f:
f.write('>1\nN\n')

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--assembly', help='Input assembly to check', required=True)
args = parser.parse_args()
main(args)
1 change: 1 addition & 0 deletions modules/long_read_qc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ process bandage {
tag { sample_id + ' / ' + assembly_mode }

executor 'local'
errorStrategy 'ignore'

publishDir params.versioned_outdir ? "${params.outdir}/${sample_id}/${params.pipeline_short_name}-v${params.minor_version}-output" : "${params.outdir}/${sample_id}", pattern: "${sample_id}_${assembler}_${assembly_mode}_bandage.png", mode: 'copy'

Expand Down
3 changes: 3 additions & 0 deletions modules/quast.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ process quast {
printf -- " value: null\\n" >> ${sample_id}_${assembler}_${assembly_mode}_quast_provenance.yml
printf -- " - parameter: --fast\\n" >> ${sample_id}_${assembler}_${assembly_mode}_quast_provenance.yml
printf -- " value: null\\n" >> ${sample_id}_${assembler}_${assembly_mode}_quast_provenance.yml
printf -- " - parameter: --min-contig\\n" >> ${sample_id}_${assembler}_${assembly_mode}_quast_provenance.yml
printf -- " value: 0\\n" >> ${sample_id}_${assembler}_${assembly_mode}_quast_provenance.yml
quast \
--threads ${task.cpus} \
--space-efficient \
--fast \
--min-contig 0 \
--output-dir ${sample_id} \
${assembly}
Expand Down
1 change: 1 addition & 0 deletions modules/unicycler.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ process unicycler {
${long_reads} \
-o ${sample_id}_assembly
check_for_empty_assembly.py --assembly ${sample_id}_assembly/assembly.fasta
sed 's/^>/>${sample_id}_/' ${sample_id}_assembly/assembly.fasta > ${sample_id}_unicycler_${assembly_mode}.fa
cp ${sample_id}_assembly/assembly.gfa ${sample_id}_unicycler_${assembly_mode}.gfa
cp ${sample_id}_assembly/unicycler.log ${sample_id}_unicycler_${assembly_mode}.log
Expand Down

0 comments on commit 4a26067

Please sign in to comment.