- Set a higher timout using the 'weboptions' function.
- Obtain the data in a txt file using the 'websave' function with the weboptions defined.
- Now read the data from the txt file using 'getbankread' function.
webread error(ncbi)
3 views (last 30 days)
Show older comments
im trying to get some information from ncbi website using this code:
HepatitisC = getgenbank('NC_004102');
HepatitisC = HepatitisC.Sequence;
Hepatitisc_length = length(HepatitisC);
first_300_bases = seqdisp(HepatitisC(1:300));
figure
ntdensity(HepatitisC)
bases = basecount(HepatitisC);
figure
basecount(HepatitisC,'chart','pie');
title('Distribution of Nucleotide Bases for Hepatitis C Virus');
figure
dimers = dimercount(HepatitisC,'chart','bar');
title('Hepatitis C Dimer Histogram');
seqshoworfs(HepatitisC);
orfs = seqshoworfs(HepatitisC,'AlternativeStartCodons',true);
AND I RECIVE THIS ERROR:
Error using webread (line 122)
The connection to URL
'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=nuccore&term=NC_004102%5BAccession%5D' timed out after 5
seconds. Set options.Timeout to a higher value.
Error in getncbidata>accession2gi (line 315)
searchXML = webread(searchurl);
Error in getncbidata (line 181)
[giID,db] = accession2gi(accessnum,db,'quick');
Error in getgenbank (line 76)
[varargout{1:nargout}] = getncbidata(accessnum,'fileformat','GenBank','database','nucleotide',varargin{:});
Error in Hepatitis (line 1)
HepatitisC = getgenbank('NC_004102');
im new to matlab and i dont know how to solve this.
thanks
0 Comments
Answers (1)
Rahul
on 25 Jun 2025
I understand that you face the mentioned error of 'webread' while trying to obtain the data using 'getgenbank'. You can consider the following options to read the data correctlty:
Here is an example:
wo = weboptions("Timeout", 10);
websave("output.txt", "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=950361812&rettype=gb&retmode=text&seq_start=6022&seq_stop=17213", wo);
data = genbankread("output.txt");
In recent MATLAB versions this issue has been resolved and just accessing data using 'getgenbank('NC_004102')' does not give the error.
The following MathWorks documentations can be referred:
Thanks.
0 Comments
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!