/** * Translates a Structure object, given a Vector3d (i.e. the vecmath library * double-precision 3-d vector) * * @param structure * @param v */ public static final void translate (Structure structure, Vector3d v) { for (int n=0; n<structure.nrModels();n++) { for (Chain c : structure.getChains(n)) { translate(c, v); } } }
newS.setPDBCode(s.getPDBCode()); newS.setPDBHeader(s.getPDBHeader()); newS.setName(this.toString()); newS.setDBRefs(s.getDBRefs()); newS.setBiologicalAssembly(s.isBiologicalAssembly()); newS.getPDBHeader().setDescription( "sub-range " + ranges + " of " + newS.getPDBCode() + " " + s.getPDBHeader().getDescription()); newS.setEntityInfos(new ArrayList<>()); newS.setSSBonds(s.getSSBonds()); newS.setSites(s.getSites()); newS.setStructureIdentifier(this); for( int modelNr=0;modelNr<s.nrModels();modelNr++) { newS.addModel(new ArrayList<Chain>()); newS.setEntityInfos(s.getEntityInfos()); newS.setSSBonds(s.getSSBonds()); newS.setSites(s.getSites()); newS.setModel(modelNr, s.getModel(modelNr)); } else { polyChain = s.getPolyChains(modelNr).get(0); chainName = polyChain.getName(); if(pdbresnum1 != null)
newS.setPDBCode(s.getPDBCode()); newS.setPDBHeader(s.getPDBHeader()); newS.setName(s.getName()); newS.setSSBonds(s.getSSBonds()); newS.setDBRefs(s.getDBRefs()); newS.setSites(s.getSites()); newS.setBiologicalAssembly(s.isBiologicalAssembly()); newS.setEntityInfos(s.getEntityInfos()); newS.setSSBonds(s.getSSBonds()); newS.setSites(s.getSites()); List<Chain> model0 = s.getModel(0); for (Chain c : model0) { newS.addChain(c); c = s.getChainByPDB(chainId); } catch (StructureException e) { logger.warn(e.getMessage() + ". Chain id " + chainId + " did not match, trying upper case Chain id."); c = s.getChainByPDB(chainId.toUpperCase()); newS.addChain(c); for (EntityInfo comp : s.getEntityInfos()) { if (comp.getChainIds() != null && comp.getChainIds().contains(c.getChainID())) { newS.getPDBHeader().setDescription( "Chain " + c.getChainID() + " of " + s.getPDBCode() + " " + comp.getDescription());
/** * 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; }
/** 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; }
System.out.println("using chain " + chain + " for structure " + structure1.getPDBCode()); Chain c1 = structure1.findChain(chain); tmp1.setPDBCode(structure1.getPDBCode()); tmp1.setPDBHeader(structure1.getPDBHeader()); tmp1.setPDBCode(structure1.getPDBCode()); tmp1.addChain(c1); System.out.println("ok");
public AlternativeAlignmentFrame(Structure s1, Structure s2) { super(); panel = new JPanel(); panel.setPreferredSize(new Dimension(800,400)); this.getContentPane().add(panel); structure1 = s1; structure2 = s2; String pdb1 = s1.getPDBCode(); String pdb2 = s2.getPDBCode(); String t = "Alternative Alignments"; Object[] args = {pdb1,pdb2}; String title = MessageFormat.format(t,args); this.setTitle(title); }
/** 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; }
int numBonds = mmtfSummaryDataBean.getNumBonds(); List<Chain> allChains = mmtfSummaryDataBean.getAllChains(); mmtfDecoderInterface.initStructure(numBonds, allAtoms.size(), MmtfUtils.getNumGroups(structure), allChains.size(), structure.nrModels(), structure.getPDBCode()); PDBHeader pdbHeader = structure.getPDBHeader(); PDBCrystallographicInfo xtalInfo = pdbHeader.getCrystallographicInfo(); mmtfDecoderInterface.setHeaderInfo(pdbHeader.getRfree(), pdbHeader.getRwork(), pdbHeader.getResolution(), pdbHeader.getTitle(), MmtfUtils.dateToIsoString(pdbHeader.getDepDate()), storeEntityInformation(allChains, structure.getEntityInfos()); for (int modelIndex=0; modelIndex<structure.nrModels(); modelIndex++) { List<Chain> modelChains = structure.getChains(modelIndex);
/** * Identify a set of modifications in a structure. * @param structure query {@link Structure}. * @param potentialModifications query {@link ProteinModification}s. */ public void identify(final Structure structure, final Set<ProteinModification> potentialModifications) { if (structure==null) { throw new IllegalArgumentException("Null structure."); } identify(structure.getChains(), potentialModifications); }
String pdb1 = structure1.getPDBCode(); String pdb2 = structure2.getPDBCode(); Atom shift2 = alig.getShift(); Structure s3 = structure2.clone(); List<Chain> chains1 = structure1.getChains(); n.addModel(chains1); List<Chain> chains3 = s3.getChains(); n.addModel(chains3);
n.setPDBCode(getPDBCode()); n.setName(getName()); n.setPDBHeader(pdbHeader); n.setDBRefs(this.getDBRefs()); n.setSites(getSites()); n.addModel(cloned_model); for (String asymId:entityInfo.getChainIds()) { for (int modelNr=0;modelNr<n.nrModels();modelNr++) { Chain newChain = n.getChain(asymId,modelNr); if (newChain==null) { n.setEntityInfos(newEntityInfoList);
/** * Check that protein sequences match between PDB and Genome Return a list of * maps that are confirmed (i.e. AA sequence matches between transcript and PDB) * Note: Only part of the sequence usually matches (PDB chains shorter than the * transcript) */ List<IdMapperEntry> checkSequencePdbGenome(Structure pdbStruct, String trId) { String pdbId = pdbStruct.getPDBCode(); if (debug) System.err.println("\nChecking '" + trId + "'\t<->\t'" + pdbStruct.getPDBCode() + "'"); List<IdMapperEntry> idmapsOri = idMapper.getByPdbId(pdbId); List<IdMapperEntry> idmapsNew = new ArrayList<>(); // Compare each chain in the PDB structure for (Chain chain : pdbStruct.getChains()) idmapsNew.addAll(checkSequencePdbGenome(pdbStruct, chain, trId, idmapsOri)); // Show all confirmed mappings if (debug) { for (IdMapperEntry ime : idmapsNew) Gpr.debug(ime); } return idmapsNew; }
PDBHeader header = structure.getPDBHeader(); header.toPDB(str); if (!structure.getSites().isEmpty()) { str.append("REMARK 800 ").append(newline); str.append("REMARK 800 SITE ").append(newline); for (Site site : structure.getSites()) { site.remark800toPDB(str); for (DBRef dbref : structure.getDBRefs()){ dbref.toPDB(str); str.append(newline); List<SSBondImpl> ssbonds = SSBondImpl.getSsBondListFromBondList(structure.getSSBonds()); for (SSBondImpl ssbond : ssbonds){ ssbond.toPDB(str); for (Site site : structure.getSites()) { try { site.toPDB(str); int nrModels = structure.nrModels() ; if ( structure.isNmr()) { str.append("EXPDTA NMR, "+ nrModels+" STRUCTURES"+newline) ; List<Chain> polyChains = structure.getPolyChains(m); List<Chain> nonPolyChains = structure.getNonPolyChains(m); List<Chain> waterChains = structure.getWaterChains(m);
s.setPDBHeader(orig.getPDBHeader()); for ( Chain c : orig.getChains()){ c1.setName(c.getName()); c1.setEntityInfo(c.getEntityInfo()); s.addChain(c1);
@Override public void newExptl(Exptl exptl) { PDBHeader pdbHeader = structure.getPDBHeader(); String method = exptl.getMethod(); pdbHeader.setExperimentalTechnique(method); }
@Override public void newDatabasePDBrevRecord(DatabasePdbrevRecord record) { PDBHeader header = structure.getPDBHeader(); if ( header == null) { header = new PDBHeader(); structure.setPDBHeader(header); } List<DatabasePdbrevRecord> revRecords = header.getRevisionRecords(); if ( revRecords == null) { revRecords = new ArrayList<DatabasePdbrevRecord>(); header.setRevisionRecords(revRecords); } revRecords.add(record); }
public void setStructure(Structure s) { if ( jmolPanel == null ){ System.err.println("please install Jmol first"); return; } setTitle(s.getPDBCode()); // actually this is very simple // just convert the structure to a PDB file String pdb = s.toPDB(); //System.out.println(s.isNmr()); //System.out.println(pdb); // Jmol could also read the file directly from your file system //viewer.openFile("/Path/To/PDB/1tim.pdb"); //System.out.println(pdb); jmolPanel.openStringInline(pdb); // send the PDB file to Jmol. // there are also other ways to interact with Jmol, e.g make it directly // access the biojava structure object, but they require more // code. See the SPICE code repository for how to do this. }
rrs = ResidueRangeAndLength.parseMultiple(domain.getRanges(), map); for (Chain chain : fullStructure.getNonPolyChains()) { if (!structure.hasPdbChain(chain.getName())) { continue; // we can't do anything with a chain our domain if (! structure.hasNonPolyChain(chain.getId())) { newChain = new ChainImpl(); newChain.setId(chain.getId()); newChain.setName(chain.getName()); newChain.setEntityInfo(chain.getEntityInfo()); structure.addChain(newChain); } else { newChain = structure.getNonPolyChain(chain.getId()); structure.getPDBHeader().setDescription(header.toString());
/** * Return true if the PDB structure passes the filter criteria I.e.: Resolution * less or equal to desire one and species matches */ boolean filterPdb(Structure pdbStruct) { // Within resolution limits? => Process double res = pdbStruct.getPDBHeader().getResolution(); if (res > pdbResolution) { if (debug) Gpr.debug("PDB resolution is " + res + ", ignoring file"); return false; } // Match organism (any chain) boolean ok = false; for (Chain chain : pdbStruct.getChains()) ok |= filterPdbChain(chain); return ok; }