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


Java Structure.addChain方法代码示例

本文整理汇总了Java中org.biojava.nbio.structure.Structure.addChain方法的典型用法代码示例。如果您正苦于以下问题:Java Structure.addChain方法的具体用法?Java Structure.addChain怎么用?Java Structure.addChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.biojava.nbio.structure.Structure的用法示例。


在下文中一共展示了Structure.addChain方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addChainMultiModel

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Adds a chain to the given structure to form a biological assembly,
 * adding the symmetry expanded chains as new models per transformId.
 * @param s
 * @param newChain
 * @param transformId
 */
private void addChainMultiModel(Structure s, Chain newChain, String transformId) {

	// multi-model bioassembly

	if ( modelIndex.size() == 0)
		modelIndex.add("PLACEHOLDER FOR ASYM UNIT");

	int modelCount = modelIndex.indexOf(transformId);
	if ( modelCount == -1)  {
		modelIndex.add(transformId);
		modelCount = modelIndex.indexOf(transformId);
	}

	if (modelCount == 0) {
		s.addChain(newChain);
	} else if (modelCount > s.nrModels()) {
		List<Chain> newModel = new ArrayList<Chain>();
		newModel.add(newChain);
		s.addModel(newModel);
	} else {
		s.addChain(newChain, modelCount-1);
	}

}
 
开发者ID:biojava,项目名称:biojava,代码行数:32,代码来源:BiologicalAssemblyBuilder.java

示例2: testGetNumGroups

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Test getting the number of groups from a structure.
 */
@Test
public void testGetNumGroups() {
	Structure structure = new StructureImpl();
	Chain chain = new ChainImpl();
	Group groupOne = new  AminoAcidImpl();
	Group groupTwo = new HetatomImpl();
	Group groupThree = new NucleotideImpl();
	structure.addChain(chain);
	chain.addGroup(groupOne);
	chain.addGroup(groupTwo);
	chain.addGroup(groupThree);
	assertEquals(3,MmtfUtils.getNumGroups(structure));
}
 
开发者ID:biojava,项目名称:biojava,代码行数:17,代码来源:TestMmtfUtils.java

示例3: testGetStructureInfo

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Test that getting the structure data info works.
 */
@Test
public void testGetStructureInfo() {
	Structure structure = new StructureImpl();
	Chain chain = new ChainImpl();
	chain.setId("A");
	Map<String,Integer> testMap = new HashMap<>();
	testMap.put("A", 0);
	List<Chain> chainList = new ArrayList<>();
	chainList.add(chain);
	Group group = new AminoAcidImpl();
	chain.addGroup(group);
	Atom atomOne = new AtomImpl();
	Atom atomTwo = new AtomImpl();
	List<Atom> atomList = new ArrayList<>();
	atomList.add(atomOne);
	atomList.add(atomTwo);
	new BondImpl(atomOne, atomTwo, 1);
	structure.addChain(chain);
	group.addAtom(atomOne);
	group.addAtom(atomTwo);
	// Get the structure
	MmtfSummaryDataBean mmtfSummaryDataBean = MmtfUtils.getStructureInfo(structure);
	assertEquals(mmtfSummaryDataBean.getAllAtoms(), atomList);
	assertEquals(testMap, mmtfSummaryDataBean.getChainIdToIndexMap());
	assertEquals(chainList, mmtfSummaryDataBean.getAllChains());
	assertEquals(1, mmtfSummaryDataBean.getNumBonds());
}
 
开发者ID:biojava,项目名称:biojava,代码行数:31,代码来源:TestMmtfUtils.java

示例4: testWrite

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Test the writing of Structure objects to a file.
 * @throws IOException 
 */
@Test
public void testWrite() throws IOException {
	Structure structure = new StructureImpl();
	PDBHeader pdbHeader = new PDBHeader();
	pdbHeader.setExperimentalTechnique("X-RAY DIFFRACTION");
	structure.setEntityInfos(new ArrayList<EntityInfo>());
	structure.setPDBHeader(pdbHeader);
	Chain chain = new ChainImpl();
	chain.setId("A");
	chain.setName("A");
	Group group = new AminoAcidImpl(); 
	group.setPDBName("FKF");
	ChemComp chemComp = new ChemComp();
	chemComp.setType("TYPfdl");
	chemComp.setOne_letter_code("A");
	group.setChemComp(chemComp);
	Atom atom = new AtomImpl();
	atom.setName("A");
	atom.setElement(Element.Ag);
	atom.setCoords(new double[] {1.0,2.0,3.0});
	chain.addGroup(group);
	group.addAtom(atom);
	ResidueNumber residueNumber = new ResidueNumber();
	residueNumber.setInsCode('A');
	residueNumber.setSeqNum(100);
	group.setResidueNumber(residueNumber);
	structure.addChain(chain);
	File tempFile = testFolder.newFile("tmpfile");
	MmtfActions.writeToFile(structure, tempFile.toPath());		
}
 
开发者ID:biojava,项目名称:biojava,代码行数:35,代码来源:TestBasicMmtf.java

示例5: setAtoms

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Create and set a new structure from a given atom array.
 * @param atoms
 */
public void setAtoms(Atom[] atoms){
	Structure s = new StructureImpl();
	Chain c = new ChainImpl();
	c.setChainID("A");
	for (Atom a: atoms){
		c.addGroup(a.getGroup());
	}
	s.addChain(c);
	setStructure(s);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:15,代码来源:AbstractAlignmentJmol.java

示例6: fromPDB

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
	String pdb = f.getText();


	if ( pdb.length() < 4) {
		f.setText("!!!");
		return null;
	}

	String chain = c.getText();
	if ( debug )
		System.out.println("file :" + pdb + " " +  chain);
	/// prepare structures

	// load them from the file system

	PDBFileReader reader = new PDBFileReader();

	reader.setPath(".");

	Structure tmp1 = new StructureImpl();

	try {
		Structure structure1 = reader.getStructureById(pdb);

		// no chain has been specified
		// return whole structure
		if (( chain == null) || (chain.length()==0)){
			return structure1;
		}
		if ( debug)
			System.out.println("using chain " + chain +  " for structure " + structure1.getPDBCode());
		Chain c1 = structure1.findChain(chain);
		tmp1.setPDBCode(structure1.getPDBCode());
		tmp1.setPDBHeader(structure1.getPDBHeader());
		tmp1.setPDBCode(structure1.getPDBCode());
		tmp1.addChain(c1);
		System.out.println("ok");

	} catch (IOException e){
		logger.warn(e.getMessage());
		throw new StructureException(e);
	}
	return tmp1;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:46,代码来源:PDBServerPanel.java

示例7: fromPDB

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
	String pdb = f.getText();


	if ( pdb.length() < 4) {
		f.setText("!!!");
		return null;
	}

	String chain = c.getText();
	if ( debug )
		System.out.println("file :" + pdb + " " +  chain);
	/// prepare structures

	// load them from the file system



	String dir = pdbDir.getText();
	PDBFileReader reader = new PDBFileReader(dir);

	if ( debug )
		System.out.println("dir: " + dir);

	Structure tmp1 = new StructureImpl();

	try {
		Structure structure1 = reader.getStructureById(pdb);

		// no chain has been specified
		// return whole structure
		if (( chain == null) || (chain.length()==0)){
			return structure1;
		}
		if ( debug)
			System.out.println("using chain " + chain +  " for structure " + structure1.getPDBCode());
		Chain c1 = structure1.findChain(chain);
		tmp1.setPDBCode(structure1.getPDBCode());
		tmp1.setPDBHeader(structure1.getPDBHeader());
		tmp1.setPDBCode(structure1.getPDBCode());
		tmp1.addChain(c1);
		System.out.println("ok");

	} catch (IOException e){
		logger.warn(e.getMessage());
		throw new StructureException(e);
	}
	return tmp1;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:50,代码来源:PDBDirPanel.java

示例8: addChainFlattened

import org.biojava.nbio.structure.Structure; //导入方法依赖的package包/类
/**
 * Adds a chain to the given structure to form a biological assembly,
 * adding the symmetry-expanded chains as new chains with renamed 
 * chain ids and names (in the form originalAsymId_transformId and originalAuthId_transformId).
 * @param s
 * @param newChain
 * @param transformId
 */
private void addChainFlattened(Structure s, Chain newChain, String transformId) {
	newChain.setId(newChain.getId()+"_"+transformId);
	newChain.setName(newChain.getName()+"_"+transformId);
	s.addChain(newChain);		
}
 
开发者ID:biojava,项目名称:biojava,代码行数:14,代码来源:BiologicalAssemblyBuilder.java


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