当前位置: 首页>>代码示例>>Java>>正文


Java AdapterToStructureData类代码示例

本文整理汇总了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);
			}
		}
	}
}
 
开发者ID:rcsb,项目名称:mmtf-java,代码行数:26,代码来源:ReducedEncoder.java

示例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()));
}
 
开发者ID:biojava,项目名称:biojava,代码行数:21,代码来源:TestMmtfRoundTrip.java

示例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);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:15,代码来源:MmtfActions.java

示例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);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:16,代码来源:MmtfActions.java

示例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;
}
 
开发者ID:biojava,项目名称:biojava-spark,代码行数:11,代码来源:BiojavaSparkUtils.java

示例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;
}
 
开发者ID:biojava,项目名称:biojava-spark,代码行数:7,代码来源:MapperUtils.java


注:本文中的org.rcsb.mmtf.encoder.AdapterToStructureData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。