pip install biopython python from Bio import SeqIO import matplotlib.pyplot as plt record = SeqIO.read("sequence.fasta", "fasta") nucleotide_counts = {"A": 0, "T": 0, "C": 0, "G": 0} for nucleotide in record.seq: if nucleotide in nucleotide_counts: nucleotide_counts[nucleotide] += 1 nucleotides = list(nucleotide_counts.keys()) counts = list(nucleotide_counts.values()) plt.bar(nucleotides, counts) plt.title("Nucleotide Frequency") plt.xlabel("Nucleotides") plt.ylabel("Counts") plt.show() python biochart.py


上一篇:
下一篇:
切换中文