public void setChain(Chain c){ chainLength = c.getAtomLength(); coordManager.setLength(chainLength); }
/** * Count how many groups are contained within a structure object. * * @param s * the structure object * @return the number of groups in the structure */ public static final int getNrGroups(Structure s) { int nrGroups = 0; List<Chain> chains = s.getChains(0); for (Chain c : chains) { nrGroups += c.getAtomLength(); } return nrGroups; }
/** * Convert a Chain object to PDB representation * * @param chain * @return */ public static String toPDB(Chain chain){ StringBuffer w = new StringBuffer(); int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); toPDB(g,w); } return w.toString(); }
/** * Converts a Chain into a List of {@link AtomSite} objects * @param c the chain * @param model the model number for the output AtomSites * @param chainName the chain identifier (author id) for the output AtomSites * @param chainId the internal chain identifier (asym id) for the output AtomSites * @return */ public static List<AtomSite> convertChainToAtomSites(Chain c, int model, String chainName, String chainId) { List<AtomSite> list = new ArrayList<>(); if (c.getEntityInfo()==null) { logger.warn("No Compound (entity) found for chain {}: entity_id will be set to 0, label_seq_id will be the same as auth_seq_id", c.getName()); } for ( int h=0; h<c.getAtomLength();h++){ Group g= c.getAtomGroup(h); list.addAll(convertGroupToAtomSites(g, model, chainName, chainId)); } return list; }
/** recursive method to determine if there is a next group. Helper * method for hasNext(). * @see #hasNext */ private boolean hasSubGroup(int tmp_model,int tmp_chain,int tmp_group) { if (tmp_model >= structure.nrModels()) { return false; } List<Chain> model = structure.getModel(tmp_model); if (tmp_chain >= model.size()) { if(fixed_model) return false; return hasSubGroup(tmp_model + 1, 0, 0); } Chain chain = model.get(tmp_chain); // start search at beginning of next chain. return tmp_group < chain.getAtomLength() || hasSubGroup(tmp_model, tmp_chain + 1, 0); }
/** recursive method to retrieve the next group. Helper * method for gext(). * @see #next */ private Group getNextGroup(int tmp_model,int tmp_chain,int tmp_group) throws NoSuchElementException { if ( tmp_model >= structure.nrModels()){ throw new NoSuchElementException("arrived at end of structure!"); } List<Chain> model = structure.getModel(tmp_model); if ( tmp_chain >= model.size() ){ if(fixed_model) throw new NoSuchElementException("arrived at end of model!"); return getNextGroup(tmp_model+1,0,0); } Chain chain = model.get(tmp_chain); if (tmp_group >= chain.getAtomLength()){ // start search at beginning of next chain. return getNextGroup(tmp_model,tmp_chain+1,0); } else { current_model_pos = tmp_model; current_chain_pos = tmp_chain; current_group_pos = tmp_group; return chain.getAtomGroup(current_group_pos); } }
str.append(" length ATOM: ").append(cha.getAtomLength()); str.append(" aminos: ").append(agr.size()); str.append(" hetatms: ").append(hgr.size());
int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){
groupnr<chain.getAtomLength() ;groupnr++){ Group gr = chain.getAtomGroup(groupnr);