This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Having problem in getting rsIDs in a given gene interval using NCBI etuils!

Dear all,

For my tool, I was calling ncbi eutils for getting rsIDs in a given gene interval.

Here is my example post: http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=snp&term=20000000%3A20000500%5BBase+Position%5D+AND+1%5BCHR%5D+AND+txid9606&usehistory=y

Here is the corresponding response:

HttpResponseProxy{HTTP/1.1 403 Forbidden [Date: Fri, 18 Nov 2016 07:14:39 GMT, Server: Apache, Referrer-Policy: origin-when-cross-origin, Accept-Ranges: bytes, Vary: Accept-Encoding, X-UA-Compatible: IE=Edge, X-XSS-Protection: 1; mode=block, Keep-Alive: timeout=1, max=10, Connection: Keep-Alive, Content-Type: text/html] org.apache.http.client.entity.GzipDecompressingEntity@4b00e89d}

I was parsing the resulting response with the code below; however this code doesn't work anymore. What has changed in ncbi eutils? Any idea?

if(response.getEntity() != null){
                InputStream is = entity.getContent();
                readerSearch = xmlInputFactory.createXMLEventReader( is);
}

while(readerSearch.hasNext()){
    XMLEvent evtSearch = readerSearch.peek();
if( !evtSearch.isStartElement()){
    readerSearch.nextEvent();
    continue;
}

StartElement startSearch = evtSearch.asStartElement();
String localNameSearch = startSearch.getName().getLocalPart();

if( !localNameSearch.equals("eSearchResult")){
    readerSearch.nextEvent();
    continue;
}

ESearchResult eSearchResult = unmarshaller.unmarshal(readerSearch, ESearchResult.class).getValue();
IdList idList =(IdList)eSearchResult.getCountOrRetMaxOrRetStartOrQueryKeyOrWebEnvOrIdListOrTranslationSetOrTranslationStackOrQueryTranslationOrERROR().get(5);

for(Id id : idList.getId()){
    rsIdList.add(Integer.parseInt( id.getvalue()));
}

}

I will really appreciate any help. Thanks in advance, Burçak Otlu

ncbi eutils getting rsids in a

Dear Pierre,

Thank you for your answer. Now response is "OK" instead of "FORBIDDED".

I'm trying to get the assembly of a certain rs but although it shows itselft as <assembly dbsnpbuild="147" genomebuild="38.2" grouplabel="GRCh38.p2" current="true" reference="true"> on the webpage, it is null when it called from java code.

Here is my post: https://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=snp&id=776587116&retmode=xml

Here is the related code:

.... for( Assembly as : rs.getAssembly()){ String groupLabel = as.getGroupLabel(); .....

Why could it be?

Thanks in advance, Burçak Otlu

Upvote! 0 gravatar for burcakotlu 3 minutes ago by burcakotlu • 30 Turkey Dear Pierre,

Thank you for your answer. Now response is "OK" instead of "FORBIDDED".

I'm trying to get the assembly of a certain rs but although it shows itselft as <assembly dbsnpbuild="147" genomebuild="38.2" grouplabel="GRCh38.p2" current="true" reference="true"> on the webpage, it is null when it called from java code.

Here is my post: https://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=snp&id=776587116&retmode=xml

Here is the related code:

 .... 
for( Assembly as : rs.getAssembly())
{ String groupLabel = as.getGroupLabel();
 .....

Why could it be?

Thanks in advance, Burçak Otlu

this is not an answer but a comment, please use "ADD COMMENT" not "SUBMIT ANSWER".

Now response is "OK" instead of "FORBIDDED".

so you can now validate my answer, and please, don't ask a 2nd question here.

Dear Pierre, How can I delete my last two posts? So that I can ask a separete question. Burçak

1 answer

  • Use the https:// protocol instead of http://.
  • Check you're not working behing a http(s) proxy

Log in to answer this question.