This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ncbi fasta files

I have been trying to download a fasta file from NCBI with the code below:

wget https://www.ncbi.nlm.nih.gov/nuccore/NG_049243.1?report=fasta

but what I get is all the html index. I have tried with efetch but as I do not have sudo right on the server to install it. Is there any suggestion to improve the command line so I can get a nice fasta format file.I have also tried with curl but I got the same html index. The above script seems to work with everyone except me.

sequence

Do you need to use an HTTP proxy to access the internet? If so, you'll need to set your $HTTP_PROXY and $HTTPS_PROXY environment variables appropriately: https://askubuntu.com/a/584150

Unluckily, I have not sudo right on this server as it is set up by work. I will have to ask for sudo right or them to set it up.

Try conda for installing Entrez Direct utilities https://anaconda.org/bioconda/entrez-direct which does not require root permissions.

I doubt this code above works for anyone as it is not the path to a file directly. This fasta is small enough for copy/pasting though.

Thanks. But as I stated I have sudo right so I cannot install anything on the server. Although, I will try it with my home computer.

It does not require any root permissions, though the answer of Pierre Lindenbaum below is the easiest way to go.

1 answer

I have tried with efetch but as I do not have sudo right on the server to install it.

if you have wget, you can use the NCBI efetch service.

$ wget -q -O - "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=NG_049243.1&rettype=fasta"
>NG_049243.1 Acinetobacter baumannii C1AC9-24 blaKPC gene for carbapenem-hydrolyzing class A beta-lactamase KPC-10, complete CDS
ATGTCACTGTATCGCCGTCTAGTTCTGCTGTCTTGTCTCTCATGGCCGCTGGCTGGCTTTTCTGCCACCG
CGCTGACCAACCTCGTCGCGGAACCATTCGCTAAACTCGAACAGGACTTTGGCGGCTCCATCGGTGTGTA
CGCGATGGATACCGGCTCAGGCGCAACTGTAAGTTACCGCGCTGAGGAGCGCTTCCCACTGTGCAGCTCA
TTCAAGGGCTTTCTTGCTGCCGCTGTGCTGGCTCGCAGCCAGCAGCAGGCCGGCTTGCTGGACACACCCA
(...)

Fantastic! it did work.Thanks a lot.

Log in to answer this question.