From f3fc9c3f9bcb0b7e96960a7ab622755fe83135ea Mon Sep 17 00:00:00 2001 From: Vitaliy Mysak Date: Fri, 15 Sep 2023 08:54:09 -0700 Subject: [PATCH] deduplicate fields names of blast outputs --- util/wrappers.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/util/wrappers.py b/util/wrappers.py index beaf39d..09c3362 100644 --- a/util/wrappers.py +++ b/util/wrappers.py @@ -1,8 +1,11 @@ +import dataclasses import subprocess import tempfile from Bio import SeqIO, AlignIO +from util.blastrow import BlastRow + def mafft(sequences): ''' Call mafft on a set of sequences and return the resulting alignment. @@ -22,12 +25,7 @@ def mafft(sequences): def blast(alignment_file, input_file, output_file): fileformat = "10" # .csv format - fields = ["qseqid", "sseqid", "sgi", "qlen", "slen", "length", - "qstart", "qend", "sstart", "send", - "evalue", "bitscore", "pident", "nident", - "sstrand", "stitle", - "btop", - ] + fields = [field.name for field in dataclasses.fields(BlastRow)] outfmt = fileformat + ' ' + ' '.join(fields) with open(output_file, "w") as output, \