Skip to content

Commit

Permalink
Fix writing in referenceless_contig_stitcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Jan 2, 2025
1 parent eeccb44 commit 9ec9792
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions micall/utils/referenceless_contig_stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from fractions import Fraction
from Bio import SeqIO, Seq
from Bio.SeqRecord import SeqRecord
from micall.utils.contig_stitcher_context import StitcherContext

from micall.utils.contig_stitcher_contigs import Contig
from micall.utils.find_maximum_overlap import find_maximum_overlap
Expand Down Expand Up @@ -144,10 +145,13 @@ def stitch_consensus(contigs: Iterable[Contig]) -> Iterable[Contig]:


def write_contigs(output_fasta: TextIO, contigs: Iterable[Contig]):
records = (SeqRecord(Seq.Seq(contig.seq),
name=contig.unique_name)
for contig in contigs)
SeqIO.write(records, output_fasta, "fasta")
with StitcherContext.fresh():
records = (SeqRecord(Seq.Seq(contig.seq),
description='',
id=contig.unique_name,
name=contig.unique_name)
for contig in contigs)
SeqIO.write(records, output_fasta, "fasta")


def read_contigs(input_fasta: TextIO) -> Iterable[Contig]:
Expand Down

0 comments on commit 9ec9792

Please sign in to comment.