/** * 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>(symmOrder); String pdbId = structureId.toCanonical().getPdbId(); Block align = multipleAlignment.getBlocks().get(0); for (int su = 0; su < symmOrder; 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.getChainId(), res1, res2); StructureIdentifier id = new SubstructureIdentifier(pdbId, Arrays.asList(range)); repeats.add(id); } return repeats; }
/** * Get the structure corresponding to the given {@link StructureIdentifier}. Equivalent to calling * {@link StructureIdentifier#loadStructure(AtomCache)} followed by {@link * StructureIdentifier#reduce(Structure)}. * * <p>Note that this method should not be used in StructureIdentifier implementations to avoid * circular calls. * * @param strucId * @return * @throws IOException * @throws StructureException */ public Structure getStructure(StructureIdentifier strucId) throws IOException, StructureException { Structure s = strucId.loadStructure(this); Structure r = strucId.reduce(s); r.setStructureIdentifier(strucId); return r; // if (name.length() < 4) { // throw new IllegalArgumentException("Can't interpret IDs that are shorter than 4 // characters!"); // } // // Structure n = null; // // boolean useChainNr = false; // boolean useDomainInfo = false; // String range = null; // int chainNr = -1; // // // StructureName structureName = new StructureName(name); // // String pdbId = null; // String chainId = null; // // if (name.length() == 4) { // // pdbId = name; // Structure s; // if (useMmCif) { // s = loadStructureFromCifByPdbId(pdbId); // } else { // s = loadStructureFromPdbByPdbId(pdbId); // } // return s; // } else if (structureName.isScopName()) { // // // return based on SCOP domain ID // return getStructureFromSCOPDomain(name); // } else if (structureName.isCathID()) { // return getStructureForCathDomain(structureName, CathFactory.getCathDatabase()); // } else if (name.length() == 6) { // // name is PDB.CHAINID style (e.g. 4hhb.A) // // pdbId = name.substring(0, 4); // if (name.substring(4, 5).equals(CHAIN_SPLIT_SYMBOL)) { // chainId = name.substring(5, 6); // } else if (name.substring(4, 5).equals(CHAIN_NR_SYMBOL)) { // // useChainNr = true; // chainNr = Integer.parseInt(name.substring(5, 6)); // } // // } else if (name.startsWith("file:/") || name.startsWith("http:/")) { // // this is a URL // // URL url = new URL(name); // return getStructureFromURL(url); // // // } else if (structureName.isPDPDomain()) { // // // this is a PDP domain definition // // return getPDPStructure(name); // // } else if (name.startsWith(BIOL_ASSEMBLY_IDENTIFIER)) { // // return getBioAssembly(name); // // } else if (name.length() > 6 && !name.startsWith(PDP_DOMAIN_IDENTIFIER) // && (name.contains(CHAIN_NR_SYMBOL) || name.contains(UNDERSCORE)) // && !(name.startsWith("file:/") || name.startsWith("http:/")) // // ) { // // // this is a name + range // // pdbId = name.substring(0, 4); // // this ID has domain split information... // useDomainInfo = true; // range = name.substring(5); // // } // // // System.out.println("got: >" + name + "< " + pdbId + " " + chainId + " useChainNr:" + // useChainNr + " " // // +chainNr + " useDomainInfo:" + useDomainInfo + " " + range); // // if (pdbId == null) { // // return null; // } // // while (checkLoading(pdbId)) { // // waiting for loading to be finished... // // try { // Thread.sleep(100); // } catch (InterruptedException e) { // logger.error(e.getMessage()); // } // // } // // // long start = System.currentTimeMillis(); // // Structure s; // if (useMmCif) { // s = loadStructureFromCifByPdbId(pdbId); // } else { // s = loadStructureFromPdbByPdbId(pdbId); // } // // // long end = System.currentTimeMillis(); // // System.out.println("time to load " + pdbId + " " + (end-start) + "\t size :" + // // StructureTools.getNrAtoms(s) + "\t cached: " + cache.size()); // // if (chainId == null && chainNr < 0 && range == null) { // // we only want the 1st model in this case // n = StructureTools.getReducedStructure(s, -1); // } else { // // if (useChainNr) { // // System.out.println("using ChainNr"); // n = StructureTools.getReducedStructure(s, chainNr); // } else if (useDomainInfo) { // // System.out.println("calling getSubRanges"); // n = StructureTools.getSubRanges(s, range); // } else { // // System.out.println("reducing Chain Id " + chainId); // n = StructureTools.getReducedStructure(s, chainId); // } // } // // // // n.setName(name); // return n; }