@Test public void testUniprotFetchVariationEntry() throws IOException, ExternalDbUnavailableException, InterruptedException, JAXBException { String fetchRes = readFile("uniprot_fetch_gene_ENSG00000106683.xml"); Mockito.when( httpDataManager.fetchData(Mockito.any(), Mockito.any(ParameterNameValue[].class)) ).thenReturn(fetchRes); Uniprot uniprotGene = uniprotDataManager.fetchUniprotEntry("ENSG00000106683"); Assert.assertNotNull(uniprotGene); List<Entry> entryList = uniprotGene.getEntry(); Assert.assertNotNull(entryList); Assert.assertEquals(2, entryList.size()); Entry entry = entryList.get(0); Assert.assertNotNull(entry); Assert.assertEquals("LIMK1_HUMAN", entry.getName().get(0)); Assert.assertEquals("LIM domain kinase 1", entry.getProtein().getRecommendedName().getFullName().getValue()); Assert.assertEquals("LIMK-1", entry.getProtein().getRecommendedName(). getShortName().get(0).getValue()); Assert.assertNull(entry.getProtein().getAllergenName()); Assert.assertEquals(0, entry.getProtein().getSubmittedName().size()); Assert.assertEquals(0, entry.getProtein().getAlternativeName().size()); Assert.assertEquals(0, entry.getProtein().getCdAntigenName().size()); Assert.assertEquals(0, entry.getProtein().getInnName().size()); Assert.assertEquals(0, entry.getProtein().getDomain().size()); Assert.assertNotNull("LIMK1", entry.getGene().get(0)); Assert.assertEquals("LIMK1", entry.getGene().get(0).getName().get(0).getValue()); Assert.assertEquals(EXPECTED_REFERENCE_NUMBER, entry.getReference().size()); Assert.assertEquals(EXPECTED_COMMENT_NUMBER, entry.getComment().size()); Assert.assertNotNull(entry.getComment().get(0)); Assert.assertNotNull(entry.getComment().get(0).getText().get(0)); Assert.assertNotNull(entry.getComment().get(0).getText().get(0)); Assert.assertNotNull(entry.getComment().get(0).getText().get(0).getValue()); Assert.assertTrue(entry.getComment().get(0).getText().get(0).getValue().startsWith("Serine")); Assert.assertTrue("function".equals(entry.getComment().get(0).getType())); Assert.assertEquals(EXPECTED_DBREF_NUMBER, entry.getDbReference().size()); Assert.assertEquals("Swiss-Prot", entry.getDataset()); Assert.assertEquals(EXPECTED_VERSION, entry.getVersion()); Assert.assertTrue("9838BEFBE7006447".equals(entry.getSequence().getChecksum())); Assert.assertEquals(EXPECTED_SEQUENCE_VERSION_1, entry.getSequence().getVersion()); Assert.assertEquals("evidence at protein level", entry.getProteinExistence().getType()); DbReferenceType dbReferenceType = entry.getDbReference().get(0); Assert.assertNotNull(dbReferenceType); Assert.assertEquals("EC", dbReferenceType.getType()); Assert.assertTrue(dbReferenceType.getId().startsWith("2.7.11")); }
public Uniprot fetchUniprotEntry(String geneId) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", geneId), new ParameterNameValue("format", "xml")}; String location = UNIPROT_SERVER + UNIPROT_TOOL + "/?"; String uniprotData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.uniprot"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(uniprotData); Object uniprotObject = unmarshaller.unmarshal(reader); if (uniprotObject instanceof Uniprot) { fetchedUniprotData = (Uniprot) uniprotObject; } return fetchedUniprotData; } catch (JAXBException e) { throw new ExternalDbUnavailableException("Unexpected result format", e); } }
UniprotDataManager { public Uniprot fetchUniprotEntry(String geneId) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", geneId), new ParameterNameValue("format", "xml")}; String location = UNIPROT_SERVER + UNIPROT_TOOL + "/?"; String uniprotData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.uniprot"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(uniprotData); Object uniprotObject = unmarshaller.unmarshal(reader); if (uniprotObject instanceof Uniprot) { fetchedUniprotData = (Uniprot) uniprotObject; } return fetchedUniprotData; } catch (JAXBException e) { throw new ExternalDbUnavailableException("Unexpected result format", e); } } }
UniprotDataManager { public Uniprot fetchUniprotEntry(String geneId) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", geneId), new ParameterNameValue("format", "xml")}; String location = UNIPROT_SERVER + UNIPROT_TOOL + "/?"; String uniprotData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.uniprot"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(uniprotData); Object uniprotObject = unmarshaller.unmarshal(reader); if (uniprotObject instanceof Uniprot) { fetchedUniprotData = (Uniprot) uniprotObject; } return fetchedUniprotData; } catch (JAXBException e) { throw new ExternalDbUnavailableException("Unexpected result format", e); } }  }
UniprotDataManager { public Uniprot fetchUniprotEntry(String geneId) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", geneId), new ParameterNameValue("format", "xml")}; String location = UNIPROT_SERVER + UNIPROT_TOOL + "/?"; String uniprotData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.uniprot"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(uniprotData); Object uniprotObject = unmarshaller.unmarshal(reader); if (uniprotObject instanceof Uniprot) { fetchedUniprotData = (Uniprot) uniprotObject; } return fetchedUniprotData; } catch (JAXBException e) { throw new ExternalDbUnavailableException("Unexpected result format", e); } }  Uniprot fetchUniprotEntry(String geneId); }
UniprotDataManager { public Uniprot fetchUniprotEntry(String geneId) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", geneId), new ParameterNameValue("format", "xml")}; String location = UNIPROT_SERVER + UNIPROT_TOOL + "/?"; String uniprotData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.uniprot"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(uniprotData); Object uniprotObject = unmarshaller.unmarshal(reader); if (uniprotObject instanceof Uniprot) { fetchedUniprotData = (Uniprot) uniprotObject; } return fetchedUniprotData; } catch (JAXBException e) { throw new ExternalDbUnavailableException("Unexpected result format", e); } }  Uniprot fetchUniprotEntry(String geneId);  }