protected Structure loadStructureFromCifByPdbId(String pdbId) throws IOException, StructureException { logger.debug("Loading structure {} from mmCIF file {}.", pdbId, path); Structure s; flagLoading(pdbId); try { MMCIFFileReader reader = new MMCIFFileReader(path); reader.setFetchBehavior(fetchBehavior); reader.setObsoleteBehavior(obsoleteBehavior); reader.setFileParsingParameters(params); s = reader.getStructureById(pdbId.toLowerCase()); } finally { flagLoadingFinished(pdbId); } return s; }
/** * Constructs a new PDBFileReader, initializing the extensions member variable. * The path is initialized to the given path, both autoFetch and splitDir are initialized to false. */ public MMCIFFileReader(String path){ super(path); addExtension(".cif"); addExtension(".mmcif"); addExtension(".cif.gz"); addExtension(".mmcif.gz"); }
public static void main(String[] args) throws Exception { MMCIFFileReader reader = new MMCIFFileReader(); FileParsingParameters params = new FileParsingParameters(); reader.setFileParsingParameters(params); Structure struc = reader.getStructureById("1m4x"); System.out.println(struc); System.out.println(struc.toPDB()); }
public static void main(String[] args){ String file = "/Users/andreas/WORK/PDB/mmCif/a9/1a9n.cif.gz"; //String file = "/Users/andreas/WORK/PDB/MMCIF/1gav.mmcif"; //String file = "/Users/andreas/WORK/PDB/MMCIF/100d.cif"; //String file = "/Users/andreas/WORK/PDB/MMCIF/1a4a.mmcif"; System.out.println("parsing " + file); StructureIOFile pdbreader = new MMCIFFileReader(); try { Structure s = pdbreader.getStructure(file); System.out.println(s); // convert it to a PDB file... System.out.println(s.toPDB()); } catch (IOException e) { e.printStackTrace(); } }
@Override public Structure getStructure(InputStream inStream) throws IOException{ MMcifParser parser = new SimpleMMcifParser(); consumer = new SimpleMMcifConsumer(); consumer.setFileParsingParameters(getFileParsingParameters()); // The Consumer builds up the BioJava - structure object. // you could also hook in your own and build up you own data model. parser.addMMcifConsumer(consumer); parser.parse(new BufferedReader(new InputStreamReader(inStream))); // now get the protein structure. Structure cifStructure = consumer.getStructure(); return cifStructure; }
reader = new PDBFileReader(); } else if ( fileFormat.equals(UserConfiguration.MMCIF_FORMAT)){ reader = new MMCIFFileReader(); } else { throw new StructureException("Unkown file format " + fileFormat);