Package org.biojava.bio.structure.io
Class MMCIFFileReader
- java.lang.Object
-
- org.biojava.bio.structure.io.MMCIFFileReader
-
- All Implemented Interfaces:
StructureIO,StructureIOFile
public class MMCIFFileReader extends java.lang.Object implements StructureIOFile
How to parse an mmCif file:public static void main(String[] args){ String filename = "/path/to/something.cif.gz" ; StructureIOFile reader = new MMCIFFileReader(); try{ Structure struc = reader.getStructure(filename); System.out.println(struc); } catch (Exception e) { e.printStackTrace(); } }- Since:
- 1.7
- Author:
- Andreas Prlic
-
-
Constructor Summary
Constructors Constructor Description MMCIFFileReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtension(java.lang.String ext)add a known File extension.voidclearExtensions()clear all file extensionsjava.lang.StringgetPath()get the directory path to the filesStructuregetStructure(java.io.File filename)Opens filename, parses it and returns a Structure object.StructuregetStructure(java.lang.String filename)Opens filename, parses it and returns a Structure object .StructuregetStructureById(java.lang.String pdbId)Get a structure by PDB code.booleanisAutoFetch()Fetch files automatically from FTP server.static voidmain(java.lang.String[] args)voidsetAutoFetch(boolean autoFetch)Tell the parser to fetch missing PDB files from the FTP server automatically.voidsetPath(java.lang.String path)Set path to file / connection string to db.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
addExtension
public void addExtension(java.lang.String ext)
Description copied from interface:StructureIOFileadd a known File extension.- Specified by:
addExtensionin interfaceStructureIOFile- Parameters:
ext- a String ...
-
clearExtensions
public void clearExtensions()
Description copied from interface:StructureIOFileclear all file extensions- Specified by:
clearExtensionsin interfaceStructureIOFile
-
getStructure
public Structure getStructure(java.lang.String filename) throws java.io.IOException
Opens filename, parses it and returns a Structure object .- Specified by:
getStructurein interfaceStructureIOFile- Parameters:
filename- a String- Returns:
- the Structure object
- Throws:
java.io.IOException- ...
-
getStructure
public Structure getStructure(java.io.File filename) throws java.io.IOException
Opens filename, parses it and returns a Structure object.- Specified by:
getStructurein interfaceStructureIOFile- Parameters:
filename- a File object- Returns:
- the Structure object
- Throws:
java.io.IOException- ...
-
setPath
public void setPath(java.lang.String path)
Description copied from interface:StructureIOFileSet path to file / connection string to db. This is for installations of PDB/mmCif where all files are located in one directory.- Specified by:
setPathin interfaceStructureIOFile- Parameters:
path- a String specifying the path value
-
getPath
public java.lang.String getPath()
Description copied from interface:StructureIOFileget the directory path to the files- Specified by:
getPathin interfaceStructureIOFile- Returns:
- path
-
getStructureById
public Structure getStructureById(java.lang.String pdbId) throws java.io.IOException
Get a structure by PDB code. This works if a PATH has been set via setPath, or if setAutoFetch has been set to true.- Specified by:
getStructureByIdin interfaceStructureIO- Parameters:
pdbId- a 4 letter PDB code.- Returns:
- a Structure object
- Throws:
java.io.IOException- ...
-
isAutoFetch
public boolean isAutoFetch()
Description copied from interface:StructureIOFileFetch files automatically from FTP server. Default: false- Specified by:
isAutoFetchin interfaceStructureIOFile- Returns:
- flag is true or false.
-
setAutoFetch
public void setAutoFetch(boolean autoFetch)
Description copied from interface:StructureIOFileTell the parser to fetch missing PDB files from the FTP server automatically. default is false. If true, new PDB files will be automatically stored in the Path and gzip compressed.- Specified by:
setAutoFetchin interfaceStructureIOFile- Parameters:
autoFetch- flag.
-
-