Java Code Examples for org.biojava.nbio.structure.Structure#getChainByIndex()
The following examples show how to use
org.biojava.nbio.structure.Structure#getChainByIndex() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestShortLines.java From biojava with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testLINK() throws IOException { Structure s; PDBFileParser pdbPars = new PDBFileParser(); FileParsingParameters params = pdbPars.getFileParsingParameters(); params.setCreateAtomBonds(true); StringBuilder sb = new StringBuilder(); sb.append("ATOM 2412 C21 2EG A 7 0.888 44.973 72.238 1.00 29.17 C \n"); sb.append("ATOM 2413 C22 2EG B 19 0.888 44.973 72.238 1.00 29.17 C \n"); //sb.append("LINK C21 2EG A 7 C22 2EG B 19 1555 1555 1.56 "); sb.append("LINK C21 2EG A 7 C22 2EG B 19\n"); String shortLine = sb.toString(); // Parse short try(InputStream is = new ByteArrayInputStream(shortLine.getBytes())) { s = pdbPars.parsePDBFile(is); } // Should be a bond present in the Atoms. Chain c = s.getChainByIndex(0, 0); Group g = c.getAtomGroups().get(0); Atom a = g.getAtom(0); assertEquals(1, a.getBonds().size()); }
Example 2
Source File: TestDifficultMmCIFFiles.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testResidueNumbers() throws IOException, StructureException { AtomCache cache = new AtomCache(); cache.setUseMmCif(true); Structure s = cache.getStructure("2PTC"); Chain c = s.getChainByIndex(0); System.out.println(c); assertEquals("Wrong first chain",c.getName(),"E"); Group res = c.getAtomGroup(0); ResidueNumber resNum = res.getResidueNumber(); assertEquals("Groups have wrong chain in resnum",resNum.getChainName(),"E"); }
Example 3
Source File: TestSeqResParsing.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void test11GS() throws IOException, StructureException{ String pdbID = "11GS"; Structure s; AtomCache cache = new AtomCache(); cache.getFileParsingParams().setAlignSeqRes(true); StructureIO.setAtomCache(cache); s = StructureIO.getStructure(pdbID); assertNotNull(s); assertTrue(s.getChains().size() > 0); Chain c = s.getChainByIndex(0); assertTrue(c.getSeqResGroups().size() > 2); Group first = c.getSeqResGroup(0); Group second = c.getSeqResGroup(1); Group third = c.getSeqResGroup(2); assertTrue(first instanceof AminoAcid); assertTrue(second instanceof AminoAcid); assertTrue(third instanceof AminoAcid); AminoAcid aafirst = (AminoAcid) first; AminoAcid aasecond = (AminoAcid)second; AminoAcid aathird = (AminoAcid) third; assertEquals(AminoAcid.SEQRESRECORD, aafirst.getRecordType()); assertEquals(AminoAcid.SEQRESRECORD, aasecond.getRecordType()); assertEquals(AminoAcid.ATOMRECORD, aathird.getRecordType()); }