use of org.rcsb.mmtf.api.StructureDataInterface in project mmtf-spark by sbl-sdsc.
the class MmtfReaderTest method test2.
@Test
public void test2() throws IOException {
Path p = Paths.get("./src/main/resources/files/test");
JavaPairRDD<String, StructureDataInterface> pdb = MmtfReader.readMmtfFiles(p.toString(), sc);
assertTrue(pdb.count() == 1);
pdb = pdb.flatMapToPair(new StructureToPolymerChains());
assertTrue(pdb.count() == 8);
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mmtf-spark by sbl-sdsc.
the class StructureToBioJavaTest method test.
@Test
public void test() throws IOException {
List<String> pdbIds = Arrays.asList("1STP", "4HHB", "1JLP", "5X6H", "5L2G", "2MK1");
JavaPairRDD<String, StructureDataInterface> pdb = MmtfReader.downloadFullMmtfFiles(pdbIds, sc).cache();
// 1STP: 1 L-protein chain:
// 4HHB: 4 polymer chains
// 1JLP: 1 L-protein chains with non-polymer capping group (NH2)
// 5X6H: 1 L-protein and 1 DNA chain
// 5L2G: 2 DNA chains
// 2MK1: 0 polymer chains
// --------------------
// tot : 10 polymer chains
JavaDoubleRDD chainCounts = pdb.mapValues(new StructureToBioJava()).values().mapToDouble(v -> v.getPolyChains().size());
assertEquals(10, Math.round(chainCounts.sum()));
// extract polymer chains and count chains again
chainCounts = pdb.flatMapToPair(new StructureToPolymerChains()).mapValues(new StructureToBioJava()).values().mapToDouble(v -> v.getChains().size());
assertEquals(10, Math.round(chainCounts.sum()));
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mmtf-spark by sbl-sdsc.
the class ColumnarStructureTest method testGetxCoords.
@Test
public void testGetxCoords() {
StructureDataInterface s = pdb.values().first();
ColumnarStructure cs = new ColumnarStructure(s, true);
assertEquals(26.260, cs.getxCoords()[20], 0.001);
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mmtf-spark by sbl-sdsc.
the class ColumnarStructureTest method testGetChainIds.
@Test
public void testGetChainIds() {
StructureDataInterface s = pdb.values().first();
ColumnarStructure cs = new ColumnarStructure(s, true);
assertEquals("A", cs.getChainIds()[100]);
// BTN
assertEquals("B", cs.getChainIds()[901]);
// HOH
assertEquals("C", cs.getChainIds()[917]);
}
use of org.rcsb.mmtf.api.StructureDataInterface in project mmtf-spark by sbl-sdsc.
the class ColumnarStructureTest method testGetGroupNumbers.
@Test
public void testGetGroupNumbers() {
StructureDataInterface s = pdb.values().first();
ColumnarStructure cs = new ColumnarStructure(s, true);
assertEquals("130", cs.getGroupNumbers()[877]);
}
Aggregations