genetics/cmd/seq2fasta.py

17 lines
611 B
Python
Raw Normal View History

2024-11-07 11:10:09 +00:00
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
# Sekwencja do zapisania
2024-11-12 18:09:29 +00:00
sequence_str = "GTAGGTGAACCTGCGGAAGGATCATTACAGTATTCTTTNGCCAGCGCTTAACTGCGCGGCGAAAAACCTTACACACAGTGTCTTTTTGATACAGAACTCTTGCTTTGGTTTGGCCTAGAGATAGG"
2024-11-07 11:10:09 +00:00
# Tworzenie obiektu SeqRecord, który przechowuje sekwencję i opis
2024-11-12 18:09:29 +00:00
seq_record = SeqRecord(Seq(sequence_str), id="Sample_3", description="Próbka 3")
2024-11-07 11:10:09 +00:00
# Zapis do pliku FASTA
with open("../data/sequence.fasta", "w") as output_handle:
SeqIO.write(seq_record, output_handle, "fasta")
print("Sekwencja zapisana do pliku 'sequence.fasta' w formacie FASTA.")