biocore / deblur

Deblur is a greedy deconvolution algorithm based on known read error profiles.
BSD 3-Clause "New" or "Revised" License
91 stars 41 forks source link

Fixed stand-alone version of multiple-seq-alignment #218

Open litwinowicz opened 2 years ago

litwinowicz commented 2 years ago

Deblur throws the following error:

AttributeError: 'str' object has no attribute 'to_fasta'

when running

deblur multiple-seq-alignment

This error stems from the multiple_sequence_alignment returning string containing the path to created .msa file and not the Sequence object. Two changes have been made to fix this issue: 1) optional output_fp argument has been added to multiple_sequence_alignment. To avoid breaking the existing code, if output_fp is not provided, then behavior does not change. If output_fp is provided, then msa_fp gets assigned to output_fp, resulting in the creation of multiple sequence alignment file in a path specified by output_fp. 2) In the multiple_seq_alignment function additional argument output_fp=output_fp is passed to multiple_sequence_alignment; since this already results in the creation of the requested msa file, the problematic code:

    with open(output_fp, 'w') as f:
        f.write(alignment.to_fasta())

can be removed.