Class 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 extensions
      java.lang.String getPath()
      get the directory path to the files
      Structure 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MMCIFFileReader

        public MMCIFFileReader()
    • 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 interface StructureIOFile
        Parameters:
        ext - a String ...
      • 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 interface StructureIOFile
        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 interface StructureIOFile
        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 interface StructureIOFile
        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 interface StructureIOFile
        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 interface StructureIO
        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 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.