/** apply a number of rules to fix the name of the structure if it did not get set during loading. * * @param s * @param file * @return */ private Structure fixStructureName(Structure s, String file) { if ( s.getName() != null && (! s.getName().equals(""))) return s; s.setName(s.getPDBCode()); if ( s.getName() == null || s.getName().equals("")){ File f = new File(file); s.setName(f.getName()); } return s; }
reduced.setName(fileURL); return reduced;
private Structure getStructure(StructureIdentifier name) throws StructureException{ UserConfiguration config = WebStartMain.getWebStartConfig(); AtomCache cache = new AtomCache(config); Structure s = null; try { s = cache.getStructure(name); s.setName(name.getIdentifier()); } catch (Exception e){ e.printStackTrace(); } return s; } }
try { s = cache.getStructure(domainID); s.setName(domainID); } catch (Exception e){ e.printStackTrace();
n.setName(getName());
/** create an artifical Structure object that contains the two * structures superimposed onto each other. Each structure is in a separate model. * Model 1 is structure 1 and Model 2 is structure 2. * * @param s1 the first structure. its coordinates will not be changed * @param s2 the second structure, it will be cloned and the cloned coordinates will be rotated according to the alignment results. * @return composite structure containing the 2 aligned structures as a models 1 and 2 */ public Structure getAlignedStructure(Structure s1, Structure s2){ // do not change the original coords .. Structure s3 = s2.clone(); currentRotMatrix.print(3,3); Calc.rotate(s3, currentRotMatrix); Calc.shift( s3, currentTranMatrix); Structure newpdb = new StructureImpl(); newpdb.setPDBCode("Java"); newpdb.setName("Aligned with BioJava"); newpdb.addModel(s1.getChains(0)); newpdb.addModel(s3.getChains(0)); return newpdb; }
/** * Remove all models from a Structure and keep only the first * * @param s * original Structure * @return a structure that contains only the first model * @since 3.0.5 */ public static Structure removeModels(Structure s) { if (s.nrModels() == 1) return s; Structure n = new StructureImpl(); // go through whole substructure and clone ... // copy structure data n.setPDBCode(s.getPDBCode()); n.setName(s.getName()); // TODO: do deep copying of data! n.setPDBHeader(s.getPDBHeader()); n.setDBRefs(s.getDBRefs()); n.setSites(s.getSites()); n.setChains(s.getModel(0)); return n; }
newS.setPDBCode(s.getPDBCode()); newS.setPDBHeader(s.getPDBHeader()); newS.setName(s.getName()); newS.setSSBonds(s.getSSBonds()); newS.setDBRefs(s.getDBRefs());
newS.setName(this.toString()); newS.setDBRefs(s.getDBRefs()); newS.setBiologicalAssembly(s.isBiologicalAssembly());