Skip to content

Instantly share code, notes, and snippets.

@elowy01
Last active August 24, 2022 09:54
Show Gist options
  • Save elowy01/67f38461ff8bf80c58304f2c543934c1 to your computer and use it in GitHub Desktop.
Save elowy01/67f38461ff8bf80c58304f2c543934c1 to your computer and use it in GitHub Desktop.
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
record = SeqRecord(
Seq("MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF"),
id="YP_025292.1",
name="HokC",
description="toxic membrane protein, small",
)
print(record)
"""Write list of SeqRecord objects to file"""
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
rec1 = SeqRecord(
seq=MutableSeq("ACCTTTGGGGGGGM"),
id="ex1",
name="ex1",
description="ex1",
)
rec2 = SeqRecord(
seq=MutableSeq("ACCTTTGGGGAAAGM"),
id="ex2",
name="ex2",
description="ex2",
)
records= [rec1, rec2]
SeqIO.write(records, "out.fa", "fasta")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment