From 2b904c197cf1acf3a5b91a64dd099822ba77ae22 Mon Sep 17 00:00:00 2001 From: gregdenay Date: Thu, 25 Jul 2024 10:33:32 +0200 Subject: [PATCH] attempt fix blast report --- workflow/envs/blast.yaml | 2 +- workflow/rules/blast.smk | 1 - workflow/scripts/blast_stats.py | 16 ++++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/workflow/envs/blast.yaml b/workflow/envs/blast.yaml index 093c60c..ade741e 100644 --- a/workflow/envs/blast.yaml +++ b/workflow/envs/blast.yaml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - blast=2.16.0 + - blast=2.12.0 diff --git a/workflow/rules/blast.smk b/workflow/rules/blast.smk index abddfa7..73aa221 100644 --- a/workflow/rules/blast.smk +++ b/workflow/rules/blast.smk @@ -155,7 +155,6 @@ rule blast_otus: -qcov_hsp_perc {params.qcov} $masking \ -outfmt '6 qseqid sseqid evalue pident bitscore sacc staxid length mismatch gaps stitle' \ -num_threads {threads} \ - -mt_mode 1 \ 2> {log} sed -i '1 i\query\tsubject\tevalue\tidentity\tbitscore\tsubject_acc\tsubject_taxid\talignment_length\tmismatch\tgaps\tsubject_name' {output.report} diff --git a/workflow/scripts/blast_stats.py b/workflow/scripts/blast_stats.py index bd7f3f2..7cb1d98 100644 --- a/workflow/scripts/blast_stats.py +++ b/workflow/scripts/blast_stats.py @@ -55,7 +55,7 @@ def main(otus_in, blast_in, filtered_in, lca_in, report_out, bit_diff, sample): if not os.path.isfile(blast_in) or os.stat(blast_in).st_size == 0: with open(report_out, "a") as fo: fo.write("\t".join([ - sample, + str(sample), "-", "-", "0", @@ -82,8 +82,8 @@ def main(otus_in, blast_in, filtered_in, lca_in, report_out, bit_diff, sample): if bhits == 0: with open(report_out, "a") as fo: fo.write("\t".join([ - sample, - otu, + str(sample), + str(otu), str(size), "0", "0", @@ -106,18 +106,18 @@ def main(otus_in, blast_in, filtered_in, lca_in, report_out, bit_diff, sample): with open(report_out, "a") as fo: fo.write("\t".join([ - sample, - otu, + str(sample), + str(otu), str(size), str(bhits), str(bit_best), str(bit_low), str(bit_thr), str(shits), - cons["Consensus"].values[0], - cons["Rank"].values[0], + str(cons["Consensus"].values[0]), + str(cons["Rank"].values[0]), str(cons["Taxid"].values[0]), - cons["Disambiguation"].values[0], + str(cons["Disambiguation"].values[0]), f"../{blast_in}", f"../{filtered_in}" ])+"\n")