/** * @return A SubstructureIdentifier without ranges (e.g. including all residues) */ @Override public SubstructureIdentifier toCanonical() { return new SubstructureIdentifier(null, new ArrayList<ResidueRange>()); }
@Override public String toString() { return getIdentifier(); }
private boolean initFromPDB(String suffix) { mySource = Source.PDB; SubstructureIdentifier si = new SubstructureIdentifier(suffix); base = si; // Safe to realize immediately pdbId = si.getPdbId(); // Set chainName if unique Set<String> chains = getChainNames(si); if(chains.size() == 1) { this.chainName = chains.iterator().next(); } else if(chains.size() > 1) { this.chainName = "."; } else { this.chainName = null; } return true; } private boolean initFromURL(String suffix) {
List<ResidueRange> ranges = new ArrayList<ResidueRange>(); for(String domainRange : domainRanges) { SubstructureIdentifier strucId = new SubstructureIdentifier(domainRange); if(pdbId == null) { pdbId = strucId.getPdbId(); } else if(!pdbId.equals(strucId.getPdbId())) { ranges.addAll(strucId.getResidueRanges());
newS.setName(this.toString()); newS.setDBRefs(s.getDBRefs()); newS.setBiologicalAssembly(s.isBiologicalAssembly()); if(getResidueRanges().isEmpty()) { } else { for( ResidueRange range: getResidueRanges()) { } catch(NumberFormatException e3) { throw new StructureException(String.format("Unrecognized chain %s in %s",chainName,getIdentifier())); copyLigandsByProximity(s,newS, StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF, modelNr, modelNr);
@Override public Structure reduce(Structure input) throws StructureException { return canonical.reduce(input); }
.get(templateIndex); SubstructureIdentifier canon = tName.toCanonical(); String tPdbId = canon.getPdbId(); String tChain = null; for(ResidueRange range : canon.getResidueRanges()) { tChain = range.getChainName(); break;
/** {@inheritDoc} */ @Deprecated @Override public List<ResidueRange> getResidueRanges() { return toCanonical().getResidueRanges(); } /** {@inheritDoc} */
public String getPdbId() { return canonical.getPdbId(); }
@Override public Structure loadStructure(AtomCache cache) throws StructureException, IOException { return canonical.loadStructure(cache); } }
/** * Supplements the reduced structure with ligands from the full structure based on * a distance cutoff. Ligand groups are moved (destructively) from full to reduced * if they fall within the cutoff of any atom in the reduced structure. * The {@link StructureTools#DEFAULT_LIGAND_PROXIMITY_CUTOFF default cutoff} * is used. * @param full Structure containing all ligands * @param reduced Structure with a subset of the polymer groups from full * @see StructureTools#getLigandsByProximity(java.util.Collection, Atom[], double) */ protected static void copyLigandsByProximity(Structure full, Structure reduced) { // Normal case where all models should be copied from full to reduced assert full.nrModels() >= reduced.nrModels(); for(int model = 0; model< reduced.nrModels(); model++) { copyLigandsByProximity(full, reduced, StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF, model, model); } } /**
@Override public Structure reduce(Structure input) throws StructureException { return toCanonical().reduce(input); } /**
private static Set<String> getChainNames(SubstructureIdentifier si) { Set<String> chains = new TreeSet<String>(); List<ResidueRange> ranges = si.getResidueRanges(); for(ResidueRange range : ranges) { String chainName = range.getChainName(); if(chainName != null) { chains.add(chainName); } } return chains; }
/** * Get the PDB ID for this name, if any. * * Equivalent to {@link SubstructureIdentifier#getPdbId() * toCanonical().getPdbId()} * @return The upper-case PDB Name, or null if not applicable * @throws StructureException Wraps errors which occur when converting to canonical form */ public String getPdbId() throws StructureException { if( pdbId == null) { pdbId = toCanonical().getPdbId(); } return pdbId; }
@Override public SubstructureIdentifier toCanonical() throws StructureException { return new SubstructureIdentifier(pdbCode, new ArrayList<ResidueRange>()); }
/** * Return the symmetric repeats as structure identifiers, if the result is * symmetric and it was refined, return null otherwise. * * @return List of StructureIdentifiers or null if not defined * @throws StructureException */ public List<StructureIdentifier> getRepeatsID() throws StructureException { if (!isRefined()) return null; List<StructureIdentifier> repeats = new ArrayList<StructureIdentifier>( numRepeats); String pdbId = structureId.toCanonical().getPdbId(); Block align = multipleAlignment.getBlocks().get(0); for (int su = 0; su < numRepeats; su++) { // Get the start and end residues of the repeat ResidueNumber res1 = atoms[align.getStartResidue(su)].getGroup() .getResidueNumber(); ResidueNumber res2 = atoms[align.getFinalResidue(su)].getGroup() .getResidueNumber(); ResidueRange range = new ResidueRange(res1.getChainName(), res1, res2); StructureIdentifier id = new SubstructureIdentifier(pdbId, Arrays.asList(range)); repeats.add(id); } return repeats; }
@Override public Structure reduce(Structure input) throws StructureException { return toCanonical().reduce(input); }
/** * Returns the chains this domain is defined over; contains more than 1 element only if this domains is a multi-chain domain. */ public Set<String> getChains() { Set<String> chains = new HashSet<String>(); List<ResidueRange> rrs = toCanonical().getResidueRanges(); for (ResidueRange rr : rrs) chains.add(rr.getChainName()); return chains; }
/** * Loads the complete structure based on {@link #getPdbId()}. * * @param AtomCache A source of structures * @return A Structure containing at least the atoms identified by this, * or null if no PDB ID is set * @throws StructureException For errors loading and parsing the structure * @throws IOException Errors reading the structure from disk */ @Override public Structure loadStructure(AtomCache cache) throws IOException, StructureException { String pdb = getPdbId(); if(pdb == null) return null; return cache.getStructureForPdbId(pdb); }
/** {@inheritDoc} */ @Override public String getIdentifier() { //1. StructureIdentifier if(getStructureIdentifier() != null) { return getStructureIdentifier().getIdentifier(); } //2. Name if(getName() != null) { return getName(); } //3. PDBCode + ranges return toCanonical().getIdentifier(); }