python
from Bio import Entrez
def download_sequence(accession_number):
handle = Entrez.efetch(db="nucleotide", id=accession_number, rettype="gb", retmode="text")
record = handle.read()
handle.close()
return record
sequence_data = download_sequence(accession_number)
print(sequence_data)
python
from Bio import SeqIO
def parse_fasta(file_path):
records = SeqIO.parse(file_path, "fasta")
sequences = []
for record in records:
sequences.append(str(record.seq))
return sequences
sequences = parse_fasta(file_path)
print(sequences)
python
from Bio.Seq import Seq
sequence = Seq("ATGCTGACGTCAGTAC")
reverse_complement = sequence.reverse_complement()
print(reverse_complement)
shell
pip install biopython
- Biopython Tutorial and Cookbook: http://biopython.org/DIST/docs/tutorial/Tutorial.html
- Biopython Documentation: http://biopython.org/DIST/docs/api/
- NCBI Entrez Programming Utilities: https://www.ncbi.nlm.nih.gov/books/NBK25501/