Class StructureIO


  • public class StructureIO
    extends java.lang.Object
    A class that provides static access methods for easy lookup of protein structure related components
    Since:
    3.0.5
    Author:
    Andreas Prlic
    • Constructor Detail

      • StructureIO

        public StructureIO()
    • Method Detail

      • getStructure

        public static Structure getStructure​(java.lang.String name)
                                      throws java.io.IOException,
                                             StructureException
        Loads a structure based on a name. Supported naming conventions are: *
                        Formal specification for how to specify the name:
        
                        name     := pdbID
                                       | pdbID '.' chainID
                                       | pdbID '.' range
                                       | scopID
                                       | biol
                                       | pdp
                        range         := '('? range (',' range)? ')'?
                                       | chainID
                                       | chainID '_' resNum '-' resNum
                        pdbID         := [0-9][a-zA-Z0-9]{3}
                        chainID       := [a-zA-Z0-9]
                        scopID        := 'd' pdbID [a-z_][0-9_]
                        biol              := 'BIOL:' pdbID [:]? [0-9]+
                        pdp                       := 'PDP:' pdbID[A-Za-z0-9_]+
                        resNum        := [-+]?[0-9]+[A-Za-z]?
        
        
                        Example structures:
                        1TIM            #whole structure - asym unit
                        4HHB.C          #single chain
                        4GCR.A_1-83 #one domain, by residue number
                        3AA0.A,B    #two chains treated as one structure
                        d2bq6a1     #scop domain
                        BIOL:1fah   #biological assembly nr 1 for 1fah
                        BIOL:1fah:0 #asym unit for 1fah
                        BIOL:1fah:1 #biological assembly nr 1 for 1fah
                        BIOL:1fah:2 #biological assembly nr 2 for 1fah
        
                        
        With the additional set of rules:
        • If only a PDB code is provided, the whole structure will be return including ligands, but the first model only (for NMR).
        • Chain IDs are case sensitive, PDB ids are not. To specify a particular chain write as: 4hhb.A or 4HHB.A
        • To specify a SCOP domain write a scopId e.g. d2bq6a1. Some flexibility can be allowed in SCOP domain names, see #setStrictSCOP(boolean)
        • URLs are accepted as well
        Parameters:
        name -
        Returns:
        a Structure object, or null if name appears improperly formated (eg too short, etc)
        Throws:
        java.io.IOException - The PDB file cannot be cached due to IO errors
        StructureException - The name appeared valid but did not correspond to a structure. Also thrown by some submethods upon errors, eg for poorly formatted subranges.
      • setAtomCache

        public static void setAtomCache​(AtomCache c)
      • getAtomCache

        public static AtomCache getAtomCache()
      • getBiologicalAssembly

        public static Structure getBiologicalAssembly​(java.lang.String pdbId)
                                               throws java.io.IOException,
                                                      StructureException
        Returns the first biologicalAssembly that is available for a protein structure. For more documentation on quaternary structures see: {@link http://www.pdb.org/pdb/101/static101.do?p=education_discussion/Looking-at-Structures/bioassembly_tutorial.html}
        Parameters:
        pdbId -
        Returns:
        a Structure object or null if that assembly is not available
        Throws:
        StructureException
        java.io.IOException
      • getBiologicalAssembly

        public static Structure getBiologicalAssembly​(java.lang.String pdbId,
                                                      int biolAssemblyNr)
                                               throws java.io.IOException,
                                                      StructureException
        By default the getStructure method loads asym units. This access method allows to recreate the quaternary structure for a protein if it is available.
        Parameters:
        pdbId -
        biolAssemblyNr - - the ith biological assembly that is available for a PDB ID (we start counting at 1, 0 represents the asym unit).
        Returns:
        a Structure object or null if that assembly is not available
        Throws:
        StructureException - if there is no bioassembly available for given biolAssemblyNr or some other problems encountered while loading it
        java.io.IOException
      • hasBiologicalAssembly

        public static boolean hasBiologicalAssembly​(java.lang.String pdbId)
        Does the provider PDB ID have a biological assembly?
        Parameters:
        pdbId -
        Returns:
        flag if one or more biological assemblies are available
      • getNrBiologicalAssemblies

        public static int getNrBiologicalAssemblies​(java.lang.String pdbId)
      • setPdbPath

        public static void setPdbPath​(java.lang.String pathToPDBFiles)
        Utility method to set the location where PDB files can be found
        Parameters:
        pathToPDBFiles -
      • guessFiletype

        public static StructureIO.StructureFiletype guessFiletype​(java.lang.String filename)
        Attempts to guess the type of a structure file based on the extension
        Parameters:
        filename -
        Returns: