@Override public void newExptl(Exptl exptl) { PDBHeader pdbHeader = structure.getPDBHeader(); String method = exptl.getMethod(); pdbHeader.setExperimentalTechnique(method); }
@Override public void newSymmetry(Symmetry symmetry) { String spaceGroup = symmetry.getSpace_group_name_H_M(); SpaceGroup sg = SymoplibParser.getSpaceGroup(spaceGroup); if (sg==null) { logger.warn("Space group '"+spaceGroup+"' not recognised as a standard space group"); structure.getPDBHeader().getCrystallographicInfo().setNonStandardSg(true); } else { structure.getPDBHeader().getCrystallographicInfo().setSpaceGroup(sg); structure.getPDBHeader().getCrystallographicInfo().setNonStandardSg(false); } }
@Override public void newDatabasePDBremark(DatabasePDBremark remark) { //System.out.println(remark); String id = remark.getId(); if (id.equals("2")){ //this remark field contains the resolution information: String line = remark.getText(); int i = line.indexOf("ANGSTROM"); if ( i > 5) { // line contains ANGSTROM info... String resolution = line.substring(i-5,i).trim(); // convert string to float float res = 99 ; try { res = Float.parseFloat(resolution); } catch (NumberFormatException e) { logger.info("could not parse resolution from line and ignoring it " + line); return ; } // support for old style header PDBHeader pdbHeader = structure.getPDBHeader(); pdbHeader.setResolution(res); } } }
public String toMMCIF() { StringBuilder str = new StringBuilder(); str.append(SimpleMMcifParser.MMCIF_TOP_HEADER+"BioJava_mmCIF_file"+newline); if (structure.getPDBHeader()!=null && structure.getPDBHeader().getCrystallographicInfo()!=null && structure.getPDBHeader().getCrystallographicInfo().getSpaceGroup()!=null && structure.getPDBHeader().getCrystallographicInfo().getCrystalCell()!=null) { str.append(MMCIFFileTools.toMMCIF("_cell", MMCIFFileTools.convertCrystalCellToCell(structure.getPDBHeader().getCrystallographicInfo().getCrystalCell()))); str.append(MMCIFFileTools.toMMCIF("_symmetry", MMCIFFileTools.convertSpaceGroupToSymmetry(structure.getPDBHeader().getCrystallographicInfo().getSpaceGroup()))); } str.append(getAtomSiteHeader()); List<AtomSite> list = MMCIFFileTools.convertStructureToAtomSites(structure); str.append(MMCIFFileTools.toMMCIF(list,AtomSite.class)); return str.toString(); }
@Override public void newAuditAuthor(AuditAuthor aa){ String name = aa.getName(); StringBuffer famName = new StringBuffer(); StringBuffer initials = new StringBuffer(); boolean afterComma = false; for ( char c: name.toCharArray()) { if ( c == ' ') continue; if ( c == ','){ afterComma = true; continue; } if ( afterComma) initials.append(c); else famName.append(c); } StringBuffer newaa = new StringBuffer(); newaa.append(initials); newaa.append(famName); PDBHeader header = structure.getPDBHeader(); String auth = header.getAuthors(); if (auth == null) { header.setAuthors(newaa.toString()); }else { auth += "," + newaa.toString(); header.setAuthors(auth); } }
@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 newAtomSites(AtomSites atomSites) { try { Matrix4d m = new Matrix4d( Double.parseDouble(atomSites.getFract_transf_matrix11()), Double.parseDouble(atomSites.getFract_transf_matrix12()), Double.parseDouble(atomSites.getFract_transf_matrix13()), Double.parseDouble(atomSites.getFract_transf_vector1()), Double.parseDouble(atomSites.getFract_transf_matrix21()), Double.parseDouble(atomSites.getFract_transf_matrix22()), Double.parseDouble(atomSites.getFract_transf_matrix23()), Double.parseDouble(atomSites.getFract_transf_vector2()), Double.parseDouble(atomSites.getFract_transf_matrix31()), Double.parseDouble(atomSites.getFract_transf_matrix32()), Double.parseDouble(atomSites.getFract_transf_matrix33()), Double.parseDouble(atomSites.getFract_transf_vector3()), 0,0,0,1); parsedScaleMatrix = m; } catch (NumberFormatException e) { logger.warn("Some values in _atom_sites.fract_transf_matrix or _atom_sites.fract_transf_vector could not be parsed as numbers. Can't check whether coordinate frame convention is correct! Error: {}", e.getMessage()); structure.getPDBHeader().getCrystallographicInfo().setNonStandardCoordFrameConvention(false); // in this case parsedScaleMatrix stays null and can't be used in documentEnd() } }
@Override protected void initCoords() { try { if (multAln == null) { if (structure != null) setStructure(structure); else { logger.error("Could not find anything to display!"); return; } } Structure artificial = MultipleAlignmentTools.toMultimodelStructure(multAln, transformedAtoms); setStructure(artificial); logger.info(artificial.getPDBHeader().getTitle()); } catch (StructureException e) { e.printStackTrace(); } }
if (asymUnit.getPDBHeader() == null || asymUnit.getPDBHeader().getBioAssemblies()==null) { logger.info("No bioassembly information found for {}, returning asymmetric unit as the only biological assembly", pdbId); assemblies.add(asymUnit); for (int bioAssemblyId : asymUnit.getPDBHeader().getBioAssemblies().keySet()) { List<BiologicalAssemblyTransformation> transformations = asymUnit.getPDBHeader().getBioAssemblies().get(bioAssemblyId).getTransforms();
@Override public void newPdbxDatabaseStatus(PdbxDatabaseStatus status) { // the deposition date field is only available in mmCIF 5.0 if (status.getRecvd_initial_deposition_date() == null) { // skip this method for older mmCIF versions return; } SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.US); PDBHeader header = structure.getPDBHeader(); if (header == null) { header = new PDBHeader(); } try { Date depositionDate = dateFormat.parse(status.getRecvd_initial_deposition_date()); header.setDepDate(depositionDate); } catch (ParseException e){ logger.warn("Could not parse date string '{}', deposition date will be unavailable", status.getRecvd_initial_deposition_date()); } structure.setPDBHeader(header); }
@Override public void newPdbxAuditRevisionHistory(PdbxAuditRevisionHistory history) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.US); PDBHeader header = structure.getPDBHeader(); if ( header == null) { header = new PDBHeader(); } // first entry in revision history is the release date if (history.getOrdinal().equals("1")){ try { Date releaseDate = dateFormat.parse(history.getRevision_date()); header.setRelDate(releaseDate); } catch (ParseException e){ logger.warn("Could not parse date string '{}', release date will be unavailable", history.getRevision_date()); } } else { // all other dates are revision dates; // since this method may be called multiple times, // the last revision date will "stick" try { Date revisionDate = dateFormat.parse(history.getRevision_date()); header.setModDate(revisionDate); } catch (ParseException e){ logger.warn("Could not parse date string '{}', revision date will be unavailable", history.getRevision_date()); } } structure.setPDBHeader(header); }
PDBHeader header = structure.getPDBHeader();
@Override public void newStructKeywords(StructKeywords kw){ PDBHeader header = structure.getPDBHeader(); if ( header == null) header = new PDBHeader(); header.setDescription(kw.getPdbx_keywords()); header.setClassification(kw.getPdbx_keywords()); }
Chain c1 = structure1.findChain(chain); tmp1.setPDBCode(structure1.getPDBCode()); tmp1.setPDBHeader(structure1.getPDBHeader()); tmp1.setPDBCode(structure1.getPDBCode()); tmp1.addChain(c1);
/** * 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; }
@Override public void newCell(Cell cell) { try { float a = Float.parseFloat(cell.getLength_a()); float b = Float.parseFloat(cell.getLength_b()); float c = Float.parseFloat(cell.getLength_c()); float alpha = Float.parseFloat(cell.getAngle_alpha()); float beta = Float.parseFloat(cell.getAngle_beta()); float gamma = Float.parseFloat(cell.getAngle_gamma()); CrystalCell xtalCell = new CrystalCell(); xtalCell.setA(a); xtalCell.setB(b); xtalCell.setC(c); xtalCell.setAlpha(alpha); xtalCell.setBeta(beta); xtalCell.setGamma(gamma); if (!xtalCell.isCellReasonable()) { // If the entry describes a structure determined by a technique other than X-ray crystallography, // cell is (sometimes!) a = b = c = 1.0, alpha = beta = gamma = 90 degrees // if so we don't add and CrystalCell will be null logger.debug("The crystal cell read from file does not have reasonable dimensions (at least one dimension is below {}), discarding it.", CrystalCell.MIN_VALID_CELL_SIZE); return; } structure.getPDBHeader().getCrystallographicInfo().setCrystalCell(xtalCell); } catch (NumberFormatException e){ structure.getPDBHeader().getCrystallographicInfo().setCrystalCell(null); logger.info("could not parse some cell parameters ("+e.getMessage()+"), ignoring _cell "); } }
/** * Display a MultipleAlignment with a JmolPanel. * New structures are downloaded if they were * not cached in the alignment and they are entirely * transformed here with the superposition information * in the Multiple Alignment. * * @param multAln * @return MultipleAlignmentJmol instance * @throws StructureException */ public static MultipleAlignmentJmol display(MultipleAlignment multAln) throws StructureException { List<Atom[]> rotatedAtoms = MultipleAlignmentDisplay.getRotatedAtoms(multAln); MultipleAlignmentJmol jmol = new MultipleAlignmentJmol(multAln, rotatedAtoms); jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle()); return jmol; }
@Override public void setStruct(Struct struct) { PDBHeader header = structure.getPDBHeader(); if ( header == null) header = new PDBHeader(); header.setTitle(struct.getTitle()); header.setIdCode(struct.getEntry_id()); //header.setDescription(struct.getPdbx_descriptor()); //header.setClassification(struct.getPdbx_descriptor()); //header.setDescription(struct.getPdbx_descriptor()); structure.setPDBHeader(header); structure.setPDBCode(struct.getEntry_id()); }
/** * 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; }
s.setPDBHeader(orig.getPDBHeader()); for ( Chain c : orig.getChains()){