Collections:
Fetch Sequences from NCBI with Bio.Entrez.efetch()
How to Fetch Sequences from NCBI with the Bio.Entrez.efetch() function?
✍: FYIcenter.com
Bio.Entrez.efetch() function allows you to fetch DNA or protein
sequences from NCBI databases: PubMed, GenBank, GEO, and many others.
It uses the Entrez Web services provided by www.ncbi.nlm.nih.gov.
Here is an example on how to Fetch Sequences in FASTA format from NCBI with the Bio.Entrez.efetch() function.
fyicenter$ python
>>> from Bio import Entrez
>>> from Bio import SeqIO
>>> Entrez.email = "A.N.Other@example.com"
>>>
>>> with Entrez.efetch(
... db="nucleotide", rettype="fasta", retmode="text", id="6273291"
... ) as handle:
... seq_record = SeqIO.read(handle, "fasta")
...
>>> print(seq_record)
ID: AF191665.1
Name: AF191665.1
Description: AF191665.1 Opuntia marenae rpl16 gene; chloroplast gene for
chloroplast product, partial intron sequence
Number of features: 0
Seq('TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAGAAAGAAAAAA...AGA')
You can also fetch the same sequence in GenBank format, which contains more properties.
>>> Entrez.email = "A.N.Other@example.com"
>>> with Entrez.efetch(
... db="nucleotide", rettype="gb", retmode="text", id="6273291"
... ) as handle:
... seq_record = SeqIO.read(handle, "gb")
...
>>> print(seq_record)
ID: AF191665.1
Name: AF191665
Description: Opuntia marenae rpl16 gene; chloroplast gene
for chloroplast product, partial intron sequence
Number of features: 3
/molecule_type=DNA
/topology=linear
/data_file_division=PLN
/date=07-NOV-1999
/accessions=['AF191665']
/sequence_version=1
/keywords=['']
/source=chloroplast Grusonia marenae
/organism=Grusonia marenae
/taxonomy=['Eukaryota', 'Viridiplantae', 'Streptophyta', 'Embryophyta', ...]
/references=[Reference(title='Phylogeny of the subfamily Opuntioideae (Cactaceae)', ...), ...]
Seq('TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAGAAAGAAAAAA...AGA')
>>> print(seq_record.features[0])
type: source
location: [0:902](+)
qualifiers:
Key: db_xref, Value: ['taxon:106980']
Key: mol_type, Value: ['genomic DNA']
Key: note, Value: ['subfamily Opuntioideae; synonym: Marenopuntia marenae, Grusonia marenae']
Key: organelle, Value: ['plastid:chloroplast']
Key: organism, Value: ['Grusonia marenae']
⇒ Search for Related Items in NCBI with Bio.Entrez.elink()
⇐ Retrieve Record Summary with Bio.Entrez.esummary()
2023-08-25, 1094🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1002922 Names: InChIKey: MUCWEYAKCRELMX-UHFFFAOYS A-NSMILES: Cc3cc2c(=O)c(...
Molecule Summary: ID: FYI-1004796 Names: InChIKey: AHOUBRCZNHFOSL-YOEHRIQHS A-NSMILES: Fc4ccc([C@@H]...
Molecule Summary: ID: FYI-1001889 SMILES: CCCCCCCCCCCCCC(=O)NC(CCC (N)=O)C(=O)NC(CC(N)=O)C( =O)NC(CO)C...
Molecule Summary: ID: FYI-1004081 Names: InChIKey: FKOXPSLKCXMDEI-UHFFFAOYS A-NSMILES: O=C4c1ccccc1C...
Molecule Summary: ID: FYI-1001912 SMILES: C#CCOC1C2=CC=CC=C2CCC2=C 1C=CC=C2Received at FYIcenter.com...