Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Biopython
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Accessing online databases === Through the Bio.Entrez module, users of Biopython can download biological data from NCBI databases. Each of the functions provided by the [[Entrez]] search engine is available through functions in this module, including searching for and downloading records. <syntaxhighlight lang="pycon"> >>> # This script downloads genomes from the NCBI Nucleotide database and saves them in a FASTA file. >>> from Bio import Entrez >>> from Bio import SeqIO >>> output_file = open("all_records.fasta", "w") >>> Entrez.email = "my_email@example.com" >>> records_to_download = ["FO834906.1", "FO203501.1"] >>> for record_id in records_to_download: ... handle = Entrez.efetch(db="nucleotide", id=record_id, rettype="gb") ... seqRecord = SeqIO.read(handle, format="gb") ... handle.close() ... output_file.write(seqRecord.format("fasta")) </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)