org.biojava.bio.structure.io
Class MMCIFFileReader

java.lang.Object
  extended by org.biojava.bio.structure.io.MMCIFFileReader
All Implemented Interfaces:
StructureIO, StructureIOFile

public class MMCIFFileReader
extends 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

Field Summary
static String lineSplit
           
 
Constructor Summary
MMCIFFileReader()
           
 
Method Summary
 void addExtension(String ext)
          add a known File extension.
 void clearExtensions()
          clear all file extensions
 File downloadPDB(String pdbId)
           
 FileParsingParameters getFileParsingParameters()
          Get the parameters that should be used for file parsing
 String getPath()
          get the directory path to the files
 Structure getStructure(File filename)
          Opens filename, parses it and returns a Structure object.
 Structure getStructure(String filename)
          Opens filename, parses it and returns a Structure object .
 Structure getStructureById(String pdbId)
          Get a structure by PDB code.
 boolean isAutoFetch()
          Fetch files automatically from FTP server.
 boolean isPdbDirectorySplit()
          Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).
static void main(String[] args)
           
 void setAutoFetch(boolean autoFetch)
          Tell the parser to fetch missing PDB files from the FTP server automatically.
 void setFileParsingParameters(FileParsingParameters params)
          Set the parameters that should be used for file parsing
 void setPath(String path)
          Set path to file / connection string to db.
 void setPdbDirectorySplit(boolean pdbDirectorySplit)
          Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSplit

public static final String lineSplit
Constructor Detail

MMCIFFileReader

public MMCIFFileReader()
Method Detail

main

public static void main(String[] args)

addExtension

public void addExtension(String ext)
Description copied from interface: StructureIOFile
add a known File extension.

Specified by:
addExtension in interface StructureIOFile
Parameters:
ext - a String ...

clearExtensions

public void clearExtensions()
Description copied from interface: StructureIOFile
clear all file extensions

Specified by:
clearExtensions in interface StructureIOFile

getStructure

public Structure getStructure(String filename)
                       throws IOException
Opens filename, parses it and returns a Structure object .

Specified by:
getStructure in interface StructureIOFile
Parameters:
filename - a String
Returns:
the Structure object
Throws:
IOException - ...

getStructure

public Structure getStructure(File filename)
                       throws IOException
Opens filename, parses it and returns a Structure object.

Specified by:
getStructure in interface StructureIOFile
Parameters:
filename - a File object
Returns:
the Structure object
Throws:
IOException - ...

setPath

public void setPath(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 interface StructureIOFile
Parameters:
path - a String specifying the path value

getPath

public String getPath()
Description copied from interface: StructureIOFile
get the directory path to the files

Specified by:
getPath in interface StructureIOFile
Returns:
path

getStructureById

public Structure getStructureById(String pdbId)
                           throws 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 interface StructureIO
Specified by:
getStructureById in interface StructureIOFile
Parameters:
pdbId - a 4 letter PDB code.
Returns:
a Structure object
Throws:
IOException - ...

downloadPDB

public File downloadPDB(String pdbId)

isAutoFetch

public boolean isAutoFetch()
Description copied from interface: StructureIOFile
Fetch files automatically from FTP server. Default: false

Specified by:
isAutoFetch in interface StructureIOFile
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 interface StructureIOFile
Parameters:
autoFetch - flag.

isPdbDirectorySplit

public boolean isPdbDirectorySplit()
Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).

Specified by:
isPdbDirectorySplit in interface StructureIOFile
Returns:
boolean. default is false (all files in one directory)

setPdbDirectorySplit

public void setPdbDirectorySplit(boolean pdbDirectorySplit)
Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).

Specified by:
setPdbDirectorySplit in interface StructureIOFile
Parameters:
pdbDirectorySplit - boolean. If set to false all files are in one directory.

getFileParsingParameters

public FileParsingParameters getFileParsingParameters()
Description copied from interface: StructureIOFile
Get the parameters that should be used for file parsing

Specified by:
getFileParsingParameters in interface StructureIOFile
Returns:
the FileParsingParameters that are configuring the behavior of the parser

setFileParsingParameters

public void setFileParsingParameters(FileParsingParameters params)
Description copied from interface: StructureIOFile
Set the parameters that should be used for file parsing

Specified by:
setFileParsingParameters in interface StructureIOFile
Parameters:
params - FileParsingParameters