|
a |
|
b/retrieve_genome_sequence.py |
|
|
1 |
from Bio import Entrez |
|
|
2 |
|
|
|
3 |
def retrieve_genome_sequence(genome_id): |
|
|
4 |
Entrez.email = 'your_email@example.com' # Set your email address here |
|
|
5 |
handle = Entrez.efetch(db='nucleotide', id=genome_id, rettype='fasta', retmode='text') |
|
|
6 |
record = handle.read() |
|
|
7 |
handle.close() |
|
|
8 |
return record |
|
|
9 |
|
|
|
10 |
# Example usage |
|
|
11 |
genome_id = 'NC_045512' # Replace with the actual genome ID |
|
|
12 |
sequence = retrieve_genome_sequence(genome_id) |
|
|
13 |
|
|
|
14 |
# Output the DNA sequence in a markdown code block |
|
|
15 |
print("```") |
|
|
16 |
print(sequence) |
|
|
17 |
print("```") |