/** * Parse a PDB file and return a datastructure implementing * PDBStructure interface. * * @param inStream an InputStream object * @return a Structure object * @throws IOException */ public Structure parsePDBFile(InputStream inStream) throws IOException { BufferedReader buf = getBufferedReader(inStream); return parsePDBFile(buf); }
@Override public Structure getStructureById(String pdbId) throws IOException,StructureException { if (pdbId == null || pdbId.length()< 4) throw new StructureException("This does not look like a valid PDB ID! (" + pdbId + ")"); pdbId = pdbId.toLowerCase(); String middle = pdbId.substring(1,3).toLowerCase(); File f = new File(path + fileSeparator + middle + fileSeparator + pdbId + fileSeparator + "pdb" + pdbId + ".ent.gz"); if (! f.exists()){ } InputStreamProvider isp = new InputStreamProvider(); InputStream inputStream = isp.getInputStream(f); PDBFileParser pdbpars = new PDBFileParser(); pdbpars.setFileParsingParameters(params); Structure struc = pdbpars.parsePDBFile(inputStream) ; return struc ; // something is wrong with the file! // it probably should be downloaded again... // TODO: add auto-download functionality... }
/** * Opens filename, parses it and returns aStructure object . */ public Structure getStructure(String filename) throws IOException { File file = new File(filename); InputStreamProvider isp = new InputStreamProvider(); InputStream inStream = isp.getInputStream(file); PDBFileParser pdbpars = new PDBFileParser(); pdbpars.setFileParsingParameters(params); Structure struc = pdbpars.parsePDBFile(inStream); inStream.close(); return struc; } }
@Override public Structure getStructure(InputStream inStream) throws IOException { PDBFileParser pdbpars = new PDBFileParser(); pdbpars.setFileParsingParameters(getFileParsingParameters()); Structure struc = pdbpars.parsePDBFile(inStream) ; return struc ; }
return parser.parsePDBFile(inStream); } else { if (cache == null) {