How to scan NCBI database using Biopython and save information as a fasta file?

How to scan NCBI database using Biopython and save information as a fasta file?

1

Hello, I am attempting to use Entrez to search the keyword “covid” in the nucleotide database and write the top 5 sequence records to a fasta file.

I completed the code for question 1, but I am having trouble with saving the sequences in a fasta file. Any advice would be much appreciated, thank you.

enter image description here


entrez


ncbi


biopython

• 58 views

Is the image above your own code or simply a screen grab from somewhere (it is always best to actually post code by pasting and using 101010 button to format).

If this is your code then you are retrieving data as XML and not fasta. So change to (retmode="fasta") and that should get you fasta sequence. Following is Entrezdirect equivalent:

$ efetch -db nuccore -id NM_001283041 -format fasta | head -5
>NM_001283041.3 Homo sapiens ubiquitin specific peptidase 25 (USP25), transcript variant 1, mRNA
ATTCCGGGCGGCCGCTCCCTCCGTCCCCTCTCTCCCTTCCCCAAAGCAGCCCGCGGACCGGCAGCAAAGG
AACGTGCGAACGCGTGACGCCGCCCGACTGGCTCGCGCTCTCCCGTGCCCCGGCGTCCTCCGCCCGCTCA
TGGCCCGGGCCGCCGCGGACGAGCGGCGCTGAGGCGGGCCGCGTGGAGACGTGAGGCGGCCGCCGTGGCC


Login
before adding your answer.

Traffic: 2192 users visited in the last hour

Read more here: Source link