本文整理汇总了Java中org.rcsb.mmtf.encoder.AdapterToStructureData类的典型用法代码示例。如果您正苦于以下问题:Java AdapterToStructureData类的具体用法?Java AdapterToStructureData怎么用?Java AdapterToStructureData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AdapterToStructureData类属于org.rcsb.mmtf.encoder包,在下文中一共展示了AdapterToStructureData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInterGroupBonds
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
/**
* Adds bonds between groups to the reduced data structure.
* @param full full representation of structure
* @param reduced reduced representation of structure
* @param atomMap maps original atom indices to atom indices in the reduced structures
*/
private static void addInterGroupBonds(StructureDataInterface full, AdapterToStructureData reduced, Map<Integer, Integer> atomMap) {
for (int i = 0; i < full.getInterGroupBondOrders().length; i++) {
int bondIndOne = full.getInterGroupBondIndices()[i*2];
int bondIndTwo = full.getInterGroupBondIndices()[i*2+1];
int bondOrder = full.getInterGroupBondOrders()[i];
// some atoms may not exist in the reduced structure.
// check the atom map to see if both atoms of a bond still exist.
Integer indexOne = atomMap.get(bondIndOne);
if (indexOne != null) {
Integer indexTwo = atomMap.get(bondIndTwo);
if (indexTwo != null) {
reduced.setInterGroupBond(indexOne, indexTwo, bondOrder);
}
}
}
}
示例2: testRoundTrip
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
/**
* Test that we can round trip a simple structure.
* @throws IOException an error reading the file
* @throws StructureException an error parsing the structure
*/
@Test
public void testRoundTrip() throws IOException, StructureException {
AtomCache cache = new AtomCache();
cache.setUseMmCif(true);
ChemCompGroupFactory.setChemCompProvider(new DownloadChemCompProvider());
StructureIO.setAtomCache(cache);
Structure structure = StructureIO.getStructure("4CUP");
AdapterToStructureData writerToEncoder = new AdapterToStructureData();
new MmtfStructureWriter(structure, writerToEncoder);
MmtfStructureReader mmtfStructureReader = new MmtfStructureReader();
new StructureDataToAdapter(writerToEncoder, mmtfStructureReader);
assertTrue(checkIfAtomsSame(structure,mmtfStructureReader.getStructure()));
}
示例3: writeToFile
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
/**
* Write a Structure object to a file.
* @param structure the Structure to write
* @param path the file to write
* @throws IOException
*/
public static void writeToFile(Structure structure, Path path) throws IOException {
// Set up this writer
AdapterToStructureData writerToEncoder = new AdapterToStructureData();
// Get the writer - this is what people implement
new MmtfStructureWriter(structure, writerToEncoder);
// Now write this data to file
WriterUtils.writeDataToFile(writerToEncoder, path);
}
示例4: writeToOutputStream
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
/**
* Write a Structure object to an {@link OutputStream}
* @param structure the Structure to write
* @param outputStream the {@link OutputStream} to write to
* @throws IOException an error transferring the byte[]
*/
public static void writeToOutputStream(Structure structure, OutputStream outputStream) throws IOException{
// Set up this writer
AdapterToStructureData writerToEncoder = new AdapterToStructureData();
// Get the writer - this is what people implement
new MmtfStructureWriter(structure, writerToEncoder);
// Now write this data to file
byte[] outputBytes = WriterUtils.getDataAsByteArr(writerToEncoder);
outputStream.write(outputBytes,0,outputBytes.length);
}
示例5: convertToStructDataInt
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
/**
* Get a {@link StructureDataInterface} from a Biojava {@link Structure}.
* @param structure the input structure to covnert
* @return the {@link StructureDataInterface} of the Biojava {@link Structure}
*/
public static StructureDataInterface convertToStructDataInt(Structure structure) {
AdapterToStructureData writerToEncoder = new AdapterToStructureData();
new MmtfStructureWriter(structure, writerToEncoder);
return writerToEncoder;
}
示例6: encodeStructure
import org.rcsb.mmtf.encoder.AdapterToStructureData; //导入依赖的package包/类
private static MmtfStructure encodeStructure(Structure structure) {
AdapterToStructureData inflatorToGet = new AdapterToStructureData();
new MmtfStructureWriter(structure, inflatorToGet);
MmtfStructure mmtfStructure = new GenericEncoder(inflatorToGet).getMmtfEncodedStructure();
return mmtfStructure;
}