|
21 | 21 | package org.biojava.nbio.structure; |
22 | 22 |
|
23 | 23 | import java.io.IOException; |
| 24 | +import java.util.ArrayList; |
| 25 | +import java.util.List; |
24 | 26 |
|
25 | 27 | import org.biojava.nbio.structure.align.util.AtomCache; |
26 | 28 | import org.biojava.nbio.structure.io.FileParsingParameters; |
@@ -138,6 +140,38 @@ public void testLigandBonds() throws StructureException, IOException { |
138 | 140 | assertTrue(areBonded(phosphateP, phosphateO)); |
139 | 141 | } |
140 | 142 |
|
| 143 | + /** |
| 144 | + * Test whether nucleotide bonds are being generated |
| 145 | + * @throws IOException |
| 146 | + * @throws StructureException |
| 147 | + */ |
| 148 | + @Test |
| 149 | + public void testNucleotideBonds() throws IOException, StructureException { |
| 150 | + Structure bio = StructureIO.getStructure("4y60"); |
| 151 | + for( Chain c : bio.getChains()) { |
| 152 | + int groupCounter = 0; |
| 153 | + List<Group> currentGroups = c.getAtomGroups(); |
| 154 | + for ( Group g : currentGroups) { |
| 155 | + if(groupCounter!=0 && groupCounter<currentGroups.size()) { |
| 156 | + List<Atom> atoms = g.getAtoms(); |
| 157 | + for ( Atom a : atoms) { |
| 158 | + if ( a.getName().equals("P")){ |
| 159 | + // Check to see if one of the phosphate atoms has bonding to something |
| 160 | + // outside of the group. |
| 161 | + List<Integer> indexList = new ArrayList<>(); |
| 162 | + for (Bond b : a.getBonds()){ |
| 163 | + indexList.add(atoms.indexOf(b.getOther(a))); |
| 164 | + } |
| 165 | + assertTrue(indexList.contains(-1)); |
| 166 | + } |
| 167 | + } |
| 168 | + } |
| 169 | + groupCounter++; |
| 170 | + } |
| 171 | + |
| 172 | + } |
| 173 | + } |
| 174 | + |
141 | 175 | private boolean areBonded(Atom a, Atom b) { |
142 | 176 | for (Bond bond : a.getBonds()) { |
143 | 177 | if (bond.getOther(a) == b) { |
|
0 commit comments