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


Java StructureImpl类代码示例

本文整理汇总了Java中org.biojava.nbio.structure.StructureImpl的典型用法代码示例。如果您正苦于以下问题:Java StructureImpl类的具体用法?Java StructureImpl怎么用?Java StructureImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAlignedStructure

import org.biojava.nbio.structure.StructureImpl; //导入依赖的package包/类
/**
 * Get an artificial Structure containing a different model for every
 * input structure, so that the alignment result can be viewed in Jmol.
 * The Atoms have to be rotated beforehand.
 *
 * @param atomArrays an array of Atoms for every aligned structure
 * @return a structure object containing a set of models,
 * 			one for each input array of Atoms.
 * @throws StructureException
 */
public static final Structure getAlignedStructure(List<Atom[]> atomArrays)
		throws StructureException {

	Structure s = new StructureImpl();
	for (int i=0; i<atomArrays.size(); i++){
		List<Chain> model = AlignmentTools.getAlignedModel(atomArrays.get(i));
		s.addModel(model);
	}
	return s;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:21,代码来源:MultipleAlignmentTools.java

示例2: documentStart

import org.biojava.nbio.structure.StructureImpl; //导入依赖的package包/类
/** 
 * Start the parsing
 */
@Override
public void documentStart() {
	structure = new StructureImpl();

	currentChain        = null;
	currentGroup 		= null;
	currentNmrModelNumber 	= null;
	//atomCount     		= 0;

	allModels     = new ArrayList<List<Chain>>();
	currentModel  = new ArrayList<Chain>();
	entities      = new ArrayList<Entity>();
	entityPolys   = new ArrayList<>();
	strucRefs     = new ArrayList<StructRef>();
	seqResChains  = new ArrayList<Chain>();
	entityChains  = new ArrayList<Chain>();
	structAsyms   = new ArrayList<StructAsym>();

	asymId2entityId = new HashMap<String,String>();
	asymId2authorId = new HashMap<>();
	structOpers   = new ArrayList<PdbxStructOperList>();
	strucAssemblies = new ArrayList<PdbxStructAssembly>();
	strucAssemblyGens = new ArrayList<PdbxStructAssemblyGen>();
	entitySrcGens = new ArrayList<EntitySrcGen>();
	entitySrcNats = new ArrayList<EntitySrcNat>();
	entitySrcSyns = new ArrayList<EntitySrcSyn>();
	structConn = new ArrayList<StructConn>();
	structNcsOper = new ArrayList<StructNcsOper>();
	sequenceDifs = new ArrayList<StructRefSeqDif>();
	structSiteGens = new ArrayList<StructSiteGen>();
}
 
开发者ID:biojava,项目名称:biojava,代码行数:35,代码来源:SimpleMMcifConsumer.java

示例3: MmtfStructureReader

import org.biojava.nbio.structure.StructureImpl; //导入依赖的package包/类
/**
 * Instantiates a new bio java structure decoder.
 */
public MmtfStructureReader() {
	structure = new StructureImpl();
	modelNumber = 0;
	entityInfoList = new ArrayList<>();
	chainList = new ArrayList<>();
	chainMap = new ArrayList<>();
	transformList = new ArrayList<>();
	chainSequenceMap = new HashMap<>();
}
 
开发者ID:biojava,项目名称:biojava,代码行数:13,代码来源:MmtfStructureReader.java

示例4: testGetNumGroups

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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

示例5: testGetStructureInfo

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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

示例6: testWrite

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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

示例7: setAtoms

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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

示例8: divideStructure

import org.biojava.nbio.structure.StructureImpl; //导入依赖的package包/类
/**
 * Method that converts the symmetric units of a structure into different
 * structures, so that they can be individually visualized.
 *
 * @param symmetry
 *            CeSymmResult
 * @throws StructureException
 * @result List of structures, by repeat index sequentially
 * 
 */
public static List<Structure> divideStructure(CeSymmResult symmetry)
		throws StructureException {

	if (!symmetry.isRefined())
		throw new IllegalArgumentException("The symmetry result "
				+ "is not refined, repeats cannot be defined");

	int order = symmetry.getMultipleAlignment().size();
	Atom[] atoms = symmetry.getAtoms();
	Set<Group> allGroups = StructureTools.getAllGroupsFromSubset(atoms, GroupType.HETATM);
	List<StructureIdentifier> repeatsId = symmetry.getRepeatsID();
	List<Structure> repeats = new ArrayList<Structure>(order);

	// Create new structure containing the repeat atoms
	for (int i = 0; i < order; i++) {

		Structure s = new StructureImpl();
		s.setStructureIdentifier(repeatsId.get(i));

		Block align = symmetry.getMultipleAlignment().getBlock(0);

		// Get the start and end of the repeat
		// Repeats are always sequential blocks
		int res1 = align.getStartResidue(i);
		int res2 = align.getFinalResidue(i);
		
		// All atoms from the repeat, used for ligand search
		// AA have an average of 8.45 atoms, so guess capacity with that
		List<Atom> repeat = new ArrayList<>(Math.max(9*(res2-res1+1),9));
		// speedy chain lookup
		Chain prevChain = null;
		for(int k=res1;k<=res2; k++) {
			Group g = atoms[k].getGroup();
			prevChain = StructureTools.addGroupToStructure(s, g, 0, prevChain,true);
			repeat.addAll(g.getAtoms());
		}

		
		List<Group> ligands = StructureTools.getLigandsByProximity(
				allGroups,
				repeat.toArray(new Atom[repeat.size()]),
				StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF);
		
		logger.warn("Adding {} ligands to {}",ligands.size(), symmetry.getMultipleAlignment().getStructureIdentifier(i));
		for( Group ligand : ligands) {
			prevChain = StructureTools.addGroupToStructure(s, ligand, 0, prevChain,true);
		}

		repeats.add(s);
	}
	return repeats;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:63,代码来源:SymmetryTools.java

示例9: fromPDB

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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

示例10: fromPDB

import org.biojava.nbio.structure.StructureImpl; //导入依赖的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


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