Entering edit mode
8.1 years ago
burcakotlu
▴
40
Deal all,
Formerly, I was getting assembly of an rsID properly with the following code, but it doesn't work anymore. Before assembly was not null but this time it is always null.
URI uri = null;
uri=newURIBuilder().setScheme("https").setHost("www.ncbi.nlm.nih.gov").setPath("/entrez/eutils/efetch.fcgi").setParameter( "db", "snp").setParameter( "id", commaSeparatedRsIdList).setParameter("retmode", "xml").build();
RequestConfigdefaultRequestConfig=RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).setConnectionRequestTimeout( 60000).setStaleConnectionCheckEnabled( true).build();
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig( defaultRequestConfig).build();
HttpPost post = new HttpPost( uri);
post.addHeader( "Content-Type", "application/xml");
CloseableHttpResponse response = httpclient.execute( post);
HttpEntity entity = response.getEntity();
if( response.getEntity() != null){
InputStream is = entity.getContent();
reader = xmlInputFactory.createXMLEventReader( is);
}
while( reader.hasNext()){
XMLEvent evt = reader.peek();
if( !evt.isStartElement()){
reader.nextEvent();
continue;
}
StartElement start = evt.asStartElement();
String localName = start.getName().getLocalPart();
if( !localName.toLowerCase().equals( Commons.RS)){
reader.nextEvent();
continue;
}
try{
rs = unmarshaller.unmarshal( reader, Rs.class).getValue();
for( Assembly as : rs.getAssembly()){
String groupLabel = as.getGroupLabel();
if( groupLabel != null){
for( Component comp : as.getComponent()){
for( MapLoc maploc : comp.getMapLoc()){
if( maploc.getPhysMapInt() != null){
rsInformation = new RsInformation();
// Set groupName
rsInformation.setGroupLabel( groupLabel);
// starts 31st August 2014
// forward or reverse
rsInformation.setOrient( Orient.convertStringtoEnum( maploc.getOrient()));
// ends 31st August 2014
// set rsId
rsInformation.setRsId( rs.getRsId());
// Set the last successful rsID
lastSuccessfullRsID = rs.getRsId();
// set chromosome name
// This chrName is without "chr"
// ex: 2, X, Y, 17
rsInformation.setChrNameWithoutChr( comp.getChromosome());
// set rsId start position
// eutil efetch returns 0-based
// coordinates
rsInformation.setZeroBasedStart( maploc.getPhysMapInt());
// set rsId observed Alleles
rsInformation.setSlashSeparatedObservedAlleles( rs.getSequence().getObserved());
numberofBasesInTheSNPAtMost = getTheNumberofBasesIntheObservedAlleles( rs.getSequence().getObserved());
// set rsId end position
// eutil efetch returns 0-based
// coordinates
rsInformation.setZeroBasedEnd( maploc.getPhysMapInt() + numberofBasesInTheSNPAtMost - 1);
rsInformationList.add( rsInformation);
}// End of if maploc.getPhysMapInt() is not
// null
}// End of for each Maploc
}// End of for Component
}// End of IF groupLabel startsWith "GRCh38"
else{
ncbiEutilStatistics.setNumberofRsIDsDoesNotMapToAnyAssembly( ncbiEutilStatistics.getNumberofRsIDsDoesNotMapToAnyAssembly() + 1);
// Declare rsIDs that does not map to any assembly
if( GlanetRunner.shouldLog())logger.info( "rsId does not map to any assembly Count: " + ncbiEutilStatistics.getNumberofRsIDsDoesNotMapToAnyAssembly() + " --- rs" + rs.getRsId() + " in the given list doesn't map to any assembly. Since It's assembly group label is null");
}
}// End of for Assembly
Thanks in advance, Burçak Otlu
check the *.xsd/schema file returned by the NCBI and the file you used are the same. Check the namespaces. Recompile your java classes.