public void basicLoad() { try { PDBFileReader reader = new PDBFileReader(); // the path to the local PDB installation reader.setPath("/tmp"); // are all files in one directory, or are the files split, // as on the PDB ftp servers? reader.setPdbDirectorySplit(true); // should a missing PDB id be fetched automatically from the FTP servers? reader.setAutoFetch(true); // configure the parameters of file parsing FileParsingParameters params = new FileParsingParameters(); // should the ATOM and SEQRES residues be aligned when creating the internal data model? params.setAlignSeqRes(true); // should secondary structure get parsed from the file params.setParseSecStruc(false); reader.setFileParsingParameters(params); Structure structure = reader.getStructureById("4hhb"); System.out.println(structure); Chain c = structure.getChainByPDB("C"); System.out.print(c); System.out.println(c.getHeader()); } catch (Exception e) { e.printStackTrace(); } }
private static void demoAtomCache() { AtomCache cache = new AtomCache(); FileParsingParameters params = cache.getFileParsingParams(); params.setLoadChemCompInfo(false); params.setAlignSeqRes(true); params.setHeaderOnly(false); params.setParseCAOnly(false); params.setParseSecStruc(false); String[] pdbIDs = new String[] {"4hhb", "1cdg", "5pti", "1gav", "WRONGID"}; for (String pdbID : pdbIDs) { try { Structure s = cache.getStructure(pdbID); if (s == null) { System.out.println("could not find structure " + pdbID); continue; } // do something with the structure System.out.println(s); } catch (Exception e) { // something crazy happened... System.err.println("Can't load structure " + pdbID + " reason: " + e.getMessage()); e.printStackTrace(); } } }
public static void main(String[] args) { try { FileParsingParameters params = new FileParsingParameters(); params.setParseSecStruc(true); AtomCache cache = new AtomCache(); cache.setFileParsingParams(params); Structure s = cache.getStructure("4hhb"); for (Chain c : s.getChains()) { for (Group g : c.getAtomGroups()) { if (g instanceof AminoAcid) { AminoAcid aa = (AminoAcid) g; Map<String, String> sec = aa.getSecStruc(); System.out.println( c.getChainID() + " " + g.getResidueNumber() + " " + g.getPDBName() + " " + " " + sec); } } } } catch (Exception e) { e.printStackTrace(); } }