From 3049472c49a876370f7ce16d2421227843a98c69 Mon Sep 17 00:00:00 2001 From: ctbus Date: Thu, 19 Oct 2023 09:58:48 -0400 Subject: [PATCH] Filter on viral contig length --- sbx_virus_id.smk | 2 +- scripts/filter_virsorter_contigs.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sbx_virus_id.smk b/sbx_virus_id.smk index 8ca3ee7..ca4f8d4 100755 --- a/sbx_virus_id.smk +++ b/sbx_virus_id.smk @@ -228,7 +228,7 @@ rule virsorter: "envs/virsorter_env.yml" shell: """ - virsorter run -w {params.out_dir} -i {input.contigs} -j {threads} all + virsorter run -w {params.out_dir} -i {input.contigs} --min-length 1000 -j {threads} all """ diff --git a/scripts/filter_virsorter_contigs.py b/scripts/filter_virsorter_contigs.py index e69de29..89e28f7 100755 --- a/scripts/filter_virsorter_contigs.py +++ b/scripts/filter_virsorter_contigs.py @@ -0,0 +1,6 @@ +from sunbeamlib.parse import parse_fasta, write_fasta + +# This does nothing but I'm leaving it in case we want to add custom filtering here later +with open(snakemake.input.contigs) as f_contigs, open(snakemake.output[0], "w") as f_out: + for header_str, seq_str in parse_fasta(f_contigs): + write_fasta((header_str, seq_str), f_out) \ No newline at end of file