@Test public void test1() { RCSBDescription description = RCSBDescriptionFactory.get(openStream("describeMol/1w0p.xml")); assertEquals("1W0P", description.getPdbId()); List<RCSBPolymer> polymers = description.getPolymers(); assertEquals(1, polymers.size()); RCSBPolymer polymer = polymers.get(0); assertEquals("protein", polymer.getType()); assertEquals(1, polymer.getIndex().intValue()); assertEquals("SIALIDASE", polymer.getDescription()); assertEquals("3.2.1.18", polymer.getEnzClass()); assertEquals(781, polymer.getLength().intValue()); assertEquals(85675.5, polymer.getWeight(), 0); List<Character> chains = polymer.getChains(); assertEquals(1, chains.size()); assertEquals('A', (char) chains.get(0)); List<String> synonyms = polymer.getSynonyms(); assertEquals(2, synonyms.size()); assertEquals("NEURAMINIDASE", synonyms.get(0)); assertEquals("NANASE", synonyms.get(1)); RCSBTaxonomy tax = polymer.getTaxonomy(); assertEquals(666, tax.getId()); assertEquals("Vibrio cholerae", tax.getName()); RCSBMacromolecule mol = polymer.getMolecule(); assertEquals("Sialidase", mol.getName()); List<String> accessions = mol.getAccessions(); assertEquals(4, accessions.size()); assertEquals("A5F7A4", accessions.get(0)); assertEquals("C3M1H8", accessions.get(1)); assertEquals("P37060", accessions.get(2)); assertEquals("Q9KR59", accessions.get(3)); }
public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; } }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  static RCSBDescription get(InputStream stream); static RCSBDescription get(String pdbId); static void printError(Exception e); }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  static RCSBDescription get(InputStream stream); static RCSBDescription get(String pdbId); static void printError(Exception e);  }