public PDBFileParser() { params = new FileParsingParameters(); loadMaxAtoms = params.getMaxAtoms(); atomCAThreshold = params.getAtomCaThreshold();
/** * Handler for MODEL Record Format * <pre> * COLUMNS DATA TYPE FIELD DEFINITION * ---------------------------------------------------------------------- * 1 - 6 Record name "MODEL " * 11 - 14 Integer serial Model serial number. * </pre> */ private void pdb_MODEL_Handler(String line) { if (params.isHeaderOnly()) return; // new model: we start a new molecule startOfMolecule = true; startOfModel = true; }
public void setFileParsingParameters(FileParsingParameters params) { this.params= params; // set the correct max values for parsing... loadMaxAtoms = params.getMaxAtoms(); atomCAThreshold = params.getAtomCaThreshold(); }
loadMaxAtoms = params.getMaxAtoms(); atomCAThreshold = params.getAtomCaThreshold(); parseCAonly = params.isParseCAOnly(); else if (recordName.equals("LINK")) pdb_LINK_Handler(line); else if ( params.isParseSecStruc()) { if ( recordName.equals("HELIX") ) pdb_HELIX_Handler ( line ) ; else if (recordName.equals("SHEET")) pdb_SHEET_Handler(line ) ; if (params.shouldCreateAtomBonds()) { formBonds(); if ( params.shouldCreateAtomCharges()) { addCharges(); if ( params.isParseSecStruc() && !params.isHeaderOnly()) setSecStruc();
currentModel.add(currentChain); } else if (!params.isHeaderOnly()){ logger.warn("current chain is null at end of document."); if ( params.isAlignSeqRes() && !params.isHeaderOnly() ){ logger.debug("Parsing mode align_seqres, will parse SEQRES and align to ATOM sequence"); alignSeqRes(); } else { logger.debug("Parsing mode unalign_seqres, will parse SEQRES but not align it to ATOM sequence"); SeqRes2AtomAligner.storeUnAlignedSeqRes(structure, seqResChains, params.isHeaderOnly()); if (!params.isHeaderOnly()) { if ( params.shouldCreateAtomBonds()) { addBonds(); if ( params.shouldCreateAtomCharges()) { addCharges(); if (!params.isHeaderOnly()) { if (params.isParseBioAssembly()) {
/** * Set up the configuration parameters for BioJava. */ public static AtomCache setUpBioJava() { // Set up the atom cache etc AtomCache cache = new AtomCache(); cache.setUseMmCif(true); FileParsingParameters params = cache.getFileParsingParams(); params.setCreateAtomBonds(true); params.setAlignSeqRes(true); params.setParseBioAssembly(true); DownloadChemCompProvider cc = new DownloadChemCompProvider(); ChemCompGroupFactory.setChemCompProvider(cc); cc.checkDoFirstInstall(); cache.setFileParsingParams(params); StructureIO.setAtomCache(cache); return cache; }
boolean prevIsParseBioAssembly = getFileParsingParams().isParseBioAssembly(); if (!getFileParsingParams().isParseBioAssembly()) { getFileParsingParams().setParseBioAssembly(true); getFileParsingParams().setParseBioAssembly(prevIsParseBioAssembly);
public SimpleMMcifConsumer(){ params = new FileParsingParameters(); documentStart(); }
if ( params.isAlignSeqRes() && !params.isHeaderOnly() && !seqResChains.isEmpty()){ logger.debug("Parsing mode align_seqres, will parse SEQRES and align to ATOM sequence"); SeqRes2AtomAligner aligner = new SeqRes2AtomAligner(); SeqRes2AtomAligner.storeUnAlignedSeqRes(structure, seqResChains, params.isHeaderOnly()); if (!params.isHeaderOnly()) {
if ( params.isHeaderOnly()) return; if ( params.getAcceptedAtomNames() != null) { for (String ok : params.getAcceptedAtomNames()){
@Override public void newAtomSite(AtomSite atom) { if (params.isHeaderOnly()) return; if ( params.isParseCAOnly() ){
private void formDisulfideBond(SSBondImpl disulfideBond) { try { Map<Integer, Atom> a = getAtomFromRecord("SG", "", "CYS", disulfideBond.getChainID1(), disulfideBond.getResnum1(), disulfideBond.getInsCode1()); Map<Integer, Atom> b = getAtomFromRecord("SG", "", "CYS", disulfideBond.getChainID2(), disulfideBond.getResnum2(), disulfideBond.getInsCode2()); for(int i=0; i<structure.nrModels(); i++){ if(a.containsKey(i) && b.containsKey(i)){ // TODO determine what the actual bond order of this bond is; for // now, we're assuming they're single bonds if(!a.get(i).equals(b.get(i))){ Bond ssbond = new BondImpl(a.get(i), b.get(i), 1); structure.addSSBond(ssbond); } } } } catch (StructureException e) { // Note, in Calpha only mode the CYS SG's are not present. if (! params.isParseCAOnly()) { logger.warn("Could not find atoms specified in SSBOND record: {}",disulfideBond.toString()); } else { logger.debug("Could not find atoms specified in SSBOND record while parsing in parseCAonly mode."); } } }
if ( params.isParseBioAssembly()) {
/** * Set up the configuration parameters for BioJava. * @param extraUrl the string describing the URL (or file path) from which * to get missing CCD entries. */ public static AtomCache setUpBioJava(String extraUrl) { // Set up the atom cache etc AtomCache cache = new AtomCache(); cache.setUseMmCif(true); FileParsingParameters params = cache.getFileParsingParams(); params.setCreateAtomBonds(true); params.setAlignSeqRes(true); params.setParseBioAssembly(true); DownloadChemCompProvider.serverBaseUrl = extraUrl; DownloadChemCompProvider.useDefaultUrlLayout = false; DownloadChemCompProvider cc = new DownloadChemCompProvider(); ChemCompGroupFactory.setChemCompProvider(cc); cc.checkDoFirstInstall(); cache.setFileParsingParams(params); StructureIO.setAtomCache(cache); return cache; }
boolean prevIsParseBioAssembly = getFileParsingParams().isParseBioAssembly(); if (!getFileParsingParams().isParseBioAssembly()) { getFileParsingParams().setParseBioAssembly(true); getFileParsingParams().setParseBioAssembly(prevIsParseBioAssembly);
public static void main(String[] args) throws Exception { MMTFFileReader reader = new MMTFFileReader(); FileParsingParameters params = new FileParsingParameters(); reader.setFileParsingParameters(params); Structure struc = reader.getStructureById("1m4x"); System.out.println(struc); }
if (! params.isParseCAOnly()) { logger.warn("Could not find atoms specified in LINK record: {}",linkRecord.toString()); } else {
boolean prevIsParseBioAssembly = getFileParsingParams().isParseBioAssembly(); if (!getFileParsingParams().isParseBioAssembly()) { getFileParsingParams().setParseBioAssembly(true); getFileParsingParams().setParseBioAssembly(prevIsParseBioAssembly);
if (params.isHeaderOnly()) return;
/** * Creates an instance of an AtomCache that is pointed to the a particular path in the file system. * * @param pdbFilePath * a directory in the file system to use as a location to cache files. * @param cachePath */ public AtomCache(String pdbFilePath, String cachePath) { logger.debug("Initialising AtomCache with pdbFilePath={}, cachePath={}",pdbFilePath, cachePath); if (!pdbFilePath.endsWith(FILE_SEPARATOR)) { pdbFilePath += FILE_SEPARATOR; } // we are caching the binary files that contain the PDBs gzipped // that is the most memory efficient way of caching... // set the input stream provider to caching mode System.setProperty(InputStreamProvider.CACHE_PROPERTY, "true"); setPath(pdbFilePath); this.cachePath = cachePath; fetchBehavior = FetchBehavior.DEFAULT; obsoleteBehavior = ObsoleteBehavior.DEFAULT; currentlyLoading.clear(); params = new FileParsingParameters(); setUseMmCif(false); setUseMmtf(true); }