Click name ↑ to return to homepage
pip install biopython
nano get_genes.py
In the file, add this:
#!/usr/bin/python
from Bio import SeqIO
# define the function
# it needs a certain object as input
def get_genes(seq_record):
for feature in seq_record.features:
if feature.type == "gene":
print(feature.qualifiers.get("gene"))
# the `get` part is used to access the dictionary value (gene name) given the key ("gene")
# make an object by providing the filename and file type
genome_record = SeqIO.read("chloro.gbk", "genbank")
# run the function
get_genes(genome_record)
python get_genes.py