當前位置: 首頁>>代碼示例>>Java>>正文


Java Group類代碼示例

本文整理匯總了Java中org.biojava.nbio.structure.Group的典型用法代碼示例。如果您正苦於以下問題:Java Group類的具體用法?Java Group怎麽用?Java Group使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Group類屬於org.biojava.nbio.structure包,在下文中一共展示了Group類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCaAtoms

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Gets the C-alpha {@link Atom} for the given input {@link Segment}.
 * @param segment the input {@link Segment} object
 * @return the C-alpha array of {@link Atom} objects
 */
public static Atom[] getCaAtoms(Segment segment) {
	Point3d[] points = segment.getCoordinates();
	Chain chain = new ChainImpl();
	chain.setId(CHAIN_NAME);	
	chain.setName(CHAIN_NAME);
	Atom[] atoms = new Atom[points.length];
	for (int i = 0, j = 0; i < points.length; i++) {
		if (points[i] != null) {
			atoms[j] = new AtomImpl();
			atoms[j].setName(CA_NAME);
			Group group = new AminoAcidImpl();
			group.setPDBName("GLU");
			group.addAtom(atoms[j]);
			group.setChain(chain);
			group.setResidueNumber(new ResidueNumber(CHAIN_NAME, j, '\0'));
			atoms[j].setX(points[i].x);
			atoms[j].setY(points[i].y);
			atoms[j].setZ(points[i].z);
			j++;
		}
	}
	return atoms;
}
 
開發者ID:biojava,項目名稱:biojava-spark,代碼行數:29,代碼來源:BiojavaSparkUtils.java

示例2: ResidueIdentifier

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
public ResidueIdentifier(Group g) {

		Chain c = g.getChain();
		if (c==null) {
			logger.warn("Chain is not available for group {}. Contact comparison will not work for this residue",g.toString());
			this.seqResIndex = -1;
		} else {
			EntityInfo comp = c.getEntityInfo();
			if (comp==null) {
				logger.warn("Compound is not available for group {}. Contact comparison will not work for this residue",g.toString());
				this.seqResIndex = -1;
			} else {
				this.seqResIndex = comp.getAlignedResIndex(g, c);
			}

		}
	}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:18,代碼來源:ResidueIdentifier.java

示例3: getAllNonHAtomArray

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Returns and array of all non-Hydrogen atoms in the given molecule, including all
 * main chain HETATOM groups. Non main-chain HETATOM groups with fewer than minSizeHetAtomToInclude
 * non-Hydrogen atoms are not included.
 * @param m
 * @param minSizeHetAtomToInclude HETATOM groups (non main-chain) with fewer number of
 * non-Hydrogen atoms are not included
 * @return
 */
private static final Atom[] getAllNonHAtomArray(Atom[] m, int minSizeHetAtomToInclude) {
	List<Atom> atoms = new ArrayList<Atom>();

	for (Atom a:m){

		if (a.getElement()==Element.H) continue;

		Group g = a.getGroup();
		if (g.getType().equals(GroupType.HETATM) &&
			!isInChain(g) &&
			getSizeNoH(g)<minSizeHetAtomToInclude) {
			continue;
		}

		atoms.add(a);

	}
	return atoms.toArray(new Atom[atoms.size()]);
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:29,代碼來源:StructureInterface.java

示例4: SecStrucState

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
public SecStrucState(Group g, String ass, SecStrucType t) {
	super(g, ass, t);

	phi = 360;
	psi = 360;
	omega = 360;

	accept1 = new HBond();
	accept2 = new HBond();
	donor1 = new HBond();
	donor2 = new HBond();

	bridge1 = null;
	bridge2 = null;

	turn = new char[3];
	turn[0] = ' ';
	turn[1] = ' ';
	turn[2] = ' ';

	bend = false;
	kappa = 360;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:24,代碼來源:SecStrucState.java

示例5: getSecStrucInfo

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Obtain the List of secondary structure information (SecStrucInfo) of a
 * Structure.
 *
 * @param s
 *            Structure with SS assignments
 * @return List of SecStrucInfo objects
 */
public static List<SecStrucInfo> getSecStrucInfo(Structure s) {

	List<SecStrucInfo> listSSI = new ArrayList<SecStrucInfo>();
	GroupIterator iter = new GroupIterator(s);

	while (iter.hasNext()) {
		Group g = iter.next();
		if (g.hasAminoAtoms()) {
			Object p = g.getProperty(Group.SEC_STRUC);
			if (!(p == null)) {
				SecStrucInfo ss = (SecStrucInfo) p;
				listSSI.add(ss);
			}
		}
	}

	return listSSI;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:27,代碼來源:SecStrucTools.java

示例6: setStrBuf

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/** set the Atoms for a particular residue position.
 * Requires that atom.getParent returns the correct group!
 * take care during cloning of atoms. Best to use StructureTools.cloneCaAtoms();
 *
 * @param strBuf
 * @param i
 * @param ca
 * @param j
 */
private void setStrBuf(Atom[] strBuf, int i, Atom[] ca, int j) {
	// TODO Auto-generated method stub
	//TODO
	Group parent = ca[j].getGroup();
	int pos = 0;
	String atomName = ca[j].getName();

	Atom a = null;

		a= parent.getAtom(atomName);
		if ( a != null){
			strBuf[i]=a;
		} else {
			// 	probably a GLY and no CB was found...
			//e.printStackTrace();
		}
	strBuf[i+pos] = a;
	pos++;



}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:32,代碼來源:CECalculator.java

示例7: getAtoms

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Copies the first length atoms from the input array
 * @param ca The array to copy
 * @param length the number of atoms to copy
 * @param clone If true, preform a deep copy, cloning the underlying Groups
 * @return An array with the first length items of ca, possibly cloning the Atoms.
 * @throws StructureException
 */
private Atom[] getAtoms(Atom[] ca,  int length, boolean clone) throws StructureException{

	List<Atom> atoms = new ArrayList<Atom>();
	for ( int i = 0 ; i < length ; i++){

		Atom a;
		if ( clone ){
			Group g = (Group)ca[i].getGroup().clone();
			a = g.getAtom(ca[i].getName());
		}
		else {
			a = ca[i];
		}
		atoms.add(a);
	}
	return atoms.toArray(new Atom[atoms.size()]);
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:26,代碼來源:CECalculator.java

示例8: convertGroupToAtomSites

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Converts a Group into a List of {@link AtomSite} objects
 * @param g
 * @param model
 * @param chainId
 * @param internalChainId
 * @return
 */
private static List<AtomSite> convertGroupToAtomSites(Group g, int model, String chainId, String internalChainId) {

	List<AtomSite> list = new ArrayList<AtomSite>();

	int groupsize  = g.size();

	for ( int atompos = 0 ; atompos < groupsize; atompos++) {
		Atom a = null ;

		a = g.getAtom(atompos);
		if ( a == null)
			continue ;

		list.add(convertAtomToAtomSite(a, model, chainId, internalChainId));

	}
	if ( g.hasAltLoc()){
		for (Group alt : g.getAltLocs() ) {
			list.addAll(convertGroupToAtomSites(alt, model, chainId, internalChainId));
		}
	}
	return list;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:32,代碼來源:MMCIFFileTools.java

示例9: removeSeqResHeterogeneity

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * The method will return a new reference to a Chain with any consecutive groups
 * having same residue numbers removed.
 * This is necessary to solve the microheterogeneity issue in entries like 3u7t (see github issue #160)
 * @param c
 * @return
 */
private static Chain removeSeqResHeterogeneity(Chain c) {

	Chain trimmedChain = new ChainImpl();

	ResidueNumber lastResNum = null;

	for (Group g:c.getAtomGroups()) {

		// note we have to deep copy this, otherwise they stay linked and would get altered in addGroup(g)
		ResidueNumber currentResNum = new ResidueNumber(
				g.getResidueNumber().getChainName(),
				g.getResidueNumber().getSeqNum(),
				g.getResidueNumber().getInsCode());

		if (lastResNum == null || !lastResNum.equals(currentResNum) ) {
			trimmedChain.addGroup(g);
		} else {
			logger.debug("Removing seqres group because it seems to be repeated in entity_poly_seq, most likely has hetero='y': "+g);
		}

		lastResNum = currentResNum;

	}
	return trimmedChain;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:33,代碼來源:SimpleMMcifConsumer.java

示例10: getNewGroup

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/** initiate new resNum, either Hetatom, Nucleotide, or AminoAcid */
private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) {

	Group g =  ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3);
	if ( g != null && !g.getChemComp().isEmpty())
		return g;


	Group group;
	if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){
		group = new HetatomImpl();

	} else if(StructureTools.isNucleotide(aminoCode3))  {
		// it is a nucleotide
		NucleotideImpl nu = new NucleotideImpl();
		group = nu;

	} else {
		AminoAcidImpl aa = new AminoAcidImpl() ;
		aa.setAminoType(aminoCode1);
		group = aa ;
	}

	//		System.out.println("new resNum type: "+ resNum.getType() );
	return  group ;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:27,代碼來源:PDBFileParser.java

示例11: setSecStruc

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
private void setSecStruc(){

		setSecElement(helixList, SecStrucInfo.PDB_AUTHOR_ASSIGNMENT,
				SecStrucType.helix4);
		setSecElement(strandList, SecStrucInfo.PDB_AUTHOR_ASSIGNMENT,
				SecStrucType.extended);
		setSecElement(turnList, SecStrucInfo.PDB_AUTHOR_ASSIGNMENT,
				SecStrucType.turn);

		//Now insert random coil to the Groups that did not have SS information
		GroupIterator gi = new GroupIterator(structure);
		while (gi.hasNext()){
			Group g = gi.next();
			if (g.hasAminoAtoms()){
				if (g.getProperty(Group.SEC_STRUC) == null){
					SecStrucInfo ss = new SecStrucInfo(g,
							SecStrucInfo.PDB_AUTHOR_ASSIGNMENT,
							SecStrucType.coil);
					g.setProperty(Group.SEC_STRUC, ss);
				}
			}
		}

	}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:25,代碼來源:PDBFileParser.java

示例12: addSeqRes

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Add the missing groups to the SeqResGroups.
 * @param modelChain the chain to add the information for
 * @param sequence the sequence of the construct
 */
public static void addSeqRes(Chain modelChain, String sequence) {
	List<Group> seqResGroups = modelChain.getSeqResGroups();
	GroupType chainType = getChainType(modelChain.getAtomGroups());
	for(int i=0; i<sequence.length(); i++){
		char singleLetterCode = sequence.charAt(i);
		Group group = null;
		if(seqResGroups.size()<=i){
		}
		else{
			group=seqResGroups.get(i);
		}
		if(group!=null){
			continue;
		}
		group = getSeqResGroup(modelChain, singleLetterCode, chainType);
		addGroupAtId(seqResGroups, group, i);
		seqResGroups.set(i, group);
	}
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:25,代碼來源:MmtfUtils.java

示例13: alignNucleotideChains

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
private void alignNucleotideChains(Chain seqRes, Chain atomRes) {

		if ( atomRes.getAtomGroups(GroupType.NUCLEOTIDE).size() < 1) {
			logger.debug("ATOM chain {} does not contain nucleotides, ignoring...", atomRes.getId());

			return;
		}
		logger.debug("Alignment for chain {}", atomRes.getId() );

		List<Group> seqResGroups = seqRes.getAtomGroups();
		boolean noMatchFound = alignNucleotideGroups(seqResGroups,atomRes.getAtomGroups());
		if ( ! noMatchFound){
			atomRes.setSeqResGroups(seqResGroups);
		}

	}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:17,代碼來源:SeqRes2AtomAligner.java

示例14: printPDBConnections

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/** 
 * Prints the connections in PDB style
 *
 * Rewritten since 5.0 to use {@link Bond}s
 * Will produce strictly one CONECT record per bond (won't group several bonds in one line)
 */
private String printPDBConnections(){

	StringBuilder str = new StringBuilder();

	for (Chain c:structure.getChains()) {
		for (Group g:c.getAtomGroups()) {
			for (Atom a:g.getAtoms()) {
				if (a.getBonds()!=null) {
					for (Bond b:a.getBonds()) {				//7890123456789012345678901234567890123456789012345678901234567890		
						str.append(String.format("CONECT%5d%5d                                                                "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial()));
					}
				}
			}
		}
	}
	
	return str.toString();
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:25,代碼來源:FileConvert.java

示例15: makeDummyCA

import org.biojava.nbio.structure.Group; //導入依賴的package包/類
/**
 * Makes dummy CA atoms at 1A intervals. Only the x coordinate increments
 * by one at each consecutive Atom.
 */
private Atom[] makeDummyCA(int len) {
	Atom[] ca1;
	Chain chain1 = new ChainImpl();
	ca1 = new Atom[len];
	for(int i=0;i<len;i++) {
		ca1[i] = new AtomImpl();
		ca1[i].setName("CA");
		ca1[i].setCoords(new double[] { i, 0, 0 });
		Group aa = new AminoAcidImpl();
		aa.setPDBName("GLY");
		aa.setResidueNumber( ResidueNumber.fromString(i+""));
		aa.addAtom(ca1[i]);
		chain1.addGroup(aa);
	}
	return ca1;
}
 
開發者ID:biojava,項目名稱:biojava,代碼行數:21,代碼來源:TestMultipleAlignmentScorer.java


注:本文中的org.biojava.nbio.structure.Group類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。