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 void
addExtension(java.lang.String ext)
add a known File extension.void
clearExtensions()
clear all file extensionsjava.lang.String
getPath()
get the directory path to the filesStructure
getStructure(java.io.File filename)
Opens filename, parses it and returns a Structure object.Structure
getStructure(java.lang.String filename)
Opens filename, parses it and returns a Structure object .Structure
getStructureById(java.lang.String pdbId)
Get a structure by PDB code.boolean
isAutoFetch()
Fetch files automatically from FTP server.static void
main(java.lang.String[] args)
void
setAutoFetch(boolean autoFetch)
Tell the parser to fetch missing PDB files from the FTP server automatically.void
setPath(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:StructureIOFile
add a known File extension.- Specified by:
addExtension
in interfaceStructureIOFile
- Parameters:
ext
- a String ...
-
clearExtensions
public void clearExtensions()
Description copied from interface:StructureIOFile
clear all file extensions- Specified by:
clearExtensions
in interfaceStructureIOFile
-
getStructure
public Structure getStructure(java.lang.String filename) throws java.io.IOException
Opens filename, parses it and returns a Structure object .- Specified by:
getStructure
in 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:
getStructure
in 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:StructureIOFile
Set path to file / connection string to db. This is for installations of PDB/mmCif where all files are located in one directory.- Specified by:
setPath
in interfaceStructureIOFile
- Parameters:
path
- a String specifying the path value
-
getPath
public java.lang.String getPath()
Description copied from interface:StructureIOFile
get the directory path to the files- Specified by:
getPath
in 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:
getStructureById
in interfaceStructureIO
- Parameters:
pdbId
- a 4 letter PDB code.- Returns:
- a Structure object
- Throws:
java.io.IOException
- ...
-
isAutoFetch
public boolean isAutoFetch()
Description copied from interface:StructureIOFile
Fetch files automatically from FTP server. Default: false- Specified by:
isAutoFetch
in interfaceStructureIOFile
- Returns:
- flag is true or false.
-
setAutoFetch
public void setAutoFetch(boolean autoFetch)
Description copied from interface:StructureIOFile
Tell 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:
setAutoFetch
in interfaceStructureIOFile
- Parameters:
autoFetch
- flag.
-
-