/** * 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 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); } }
boolean foundPair = false; for (int k = sequence.length()-1; k >= j + 3 && !foundPair; k--) { Group g1 = c.getAtomGroup(j); Group g2 = c.getAtomGroup(k); type1 = BASE_MAP.get(g1.getPDBName()); type2 = BASE_MAP.get(g2.getPDBName());
int index2 = complement.length() - complement.indexOf(match) - 1; for (int k = 0; k < match.length(); k++) { Group g1 = c.getAtomGroup(index1+k); Group g2 = chains.get(j).getAtomGroup(index2-k); Integer type1 = BASE_MAP.get(g1.getPDBName()); Integer type2 = BASE_MAP.get(g2.getPDBName());
for (int k = c2.getAtomSequence().length() - 1; k >= 0 && !foundPair; k--) { if (canonical && !BasePairParameters.match(sequence.charAt(m), sequence2.charAt(k), useRNA)) continue; Group g1 = c.getAtomGroup(m); Group g2 = c2.getAtomGroup(k); type1 = BASE_MAP.get(g1.getPDBName()); type2 = BASE_MAP.get(g2.getPDBName());
for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h);
for (Chain c: model) { String molecPdbName = c.getAtomGroup(0).getPDBName();
return null; Group std1 = s1.getChain("A").getAtomGroup(0); Group std2 = s2.getChain("A").getAtomGroup(0);
groupnr<chain.getAtomLength() ;groupnr++){ Group gr = chain.getAtomGroup(groupnr); xw.openTag("group"); xw.attribute("name",gr.getPDBName());