how to get gene string from NCBI genbank using Matlab 2010a

1 view (last 30 days)
I want to get gene string from NCBI genbank using Matlab . I have used getgebank() in matlab 2010a.but gettine error.
Data = getgenbank('NC_002695')
??? Error using ==> structfun
Inputs to STRUCTFUN must be scalar structures.
Error in ==> getncbidata>accession2gi at 343
queryDB = structfun(@(x)(str2double(x)),queryDB,'uniform',false);
Error in ==> getncbidata at 179 [giID,db] = accession2gi(accessnum,db,'quick');
Error in ==> getgenbank at 95
gb = getncbidata(accessnum,'fileformat','GenBank','database','nucleotide',varargin{:});
Will anyone please help me to resolve this?

Accepted Answer

Walter Roberson
Walter Roberson on 23 Feb 2017
Edited: Walter Roberson on 23 Feb 2017
I did not have R2010a handy but I tried in R2010b. I found that the XML returned by the query is
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <https://eutils.ncbi.nlm.nih.gov/entrez/eutils/egquery.fcgi?term=NC_002695[Accession] here>.</p>
</body></html>
then it tries to find some information in that, gets an empty result, and then bombs trying to process the empty result.
The URL it is querying is http://eutils.ncbi.nlm.nih.gov/entrez/eutils/egquery.fcgi?term=15829254[Accession] and if you put that into a browser that does get you somewhere useful, after redirection to https://eutils.ncbi.nlm.nih.gov/gquery?term=15829254%5BAccession%5D&retmode=xml . So it appears to be a matter of not handling the redirection.
Checking further, copying urls back and forth between versions, I notice that it is querying an http URL, and what works is querying the https url. When I try the https url on my OS-X system and running that old MATLAB R2010b version, I get a Java exception about it not being able to generate a DH pair, which is a problem in setting up HTTPS communications.
My testing shows that using https to connect works in R2013b but not R2012b; I am not going to bother to install R2013a just to test that version, since the end result is the same, that you need to upgrade because even if you hand-edited the relevant code to use https instead of http, your version of MATLAB would not be able to talk to the database.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!