Class StructureImpl

java.lang.Object
org.biojava.nbio.structure.StructureImpl
All Implemented Interfaces:
Serializable, Cloneable, Structure

public class StructureImpl extends Object implements Structure, Serializable
Implementation of a PDB Structure. This class provides the data contained in a PDB file. to get structure objects from different sources see io package.
Since:
1.4
Version:
%I% %G%
Author:
Andreas Prlic, Jules Jacobsen
See Also:
  • Constructor Details

    • StructureImpl

      public StructureImpl()
      Constructs a StructureImpl object.
    • StructureImpl

      public StructureImpl(Group g)
      construct a Structure object that only contains a single group
      Parameters:
      g -
    • StructureImpl

      public StructureImpl(Chain c)
      construct a Structure object that contains a particular chain
      Parameters:
      c -
  • Method Details

    • getId

      public Long getId()
      get the ID used by Hibernate
      Specified by:
      getId in interface Structure
      Returns:
      the ID used by Hibernate
    • setId

      public void setId(Long id)
      set the ID used by Hibernate
      Specified by:
      setId in interface Structure
      Parameters:
      id -
    • clone

      public Structure clone()
      returns an identical copy of this structure .
      Specified by:
      clone in interface Structure
      Overrides:
      clone in class Object
      Returns:
      an identical Structure object
    • findGroup

      public Group findGroup(String chainId, String pdbResnum, int modelnr) throws StructureException
      Request a particular group from a structure. considers only model nr X. count starts with 0.
      Specified by:
      findGroup in interface Structure
      Parameters:
      chainId - the ID of the chain to use
      pdbResnum - the PDB residue number of the requested group
      modelnr - the number of the model to use
      Returns:
      Group the requested Group
      Throws:
      StructureException
    • findGroup

      public Group findGroup(String chainName, String pdbResnum) throws StructureException
      Request a particular group from a structure. by default considers only the first model in the structure.
      Specified by:
      findGroup in interface Structure
      Parameters:
      chainName - the ID of the chain to use
      pdbResnum - the PDB residue number of the requested group
      Returns:
      Group the requested Group
      Throws:
      StructureException
    • findChain

      public Chain findChain(String chainId, int modelnr) throws StructureException
      Request a particular chain from a particular model
      Specified by:
      findChain in interface Structure
      Parameters:
      chainId - the ID of a chain that should be returned
      modelnr - the number of the model to use
      Returns:
      Chain the requested chain
      Throws:
      StructureException
    • findChain

      public Chain findChain(String chainId) throws StructureException
      Request a particular chain from a structure. by default considers only the first model.
      Specified by:
      findChain in interface Structure
      Parameters:
      chainId - the ID of a chain that should be returned
      Returns:
      Chain the requested chain
      Throws:
      StructureException
    • setPDBCode

      public void setPDBCode(String pdb_id_)
      Set PDB code of structure .
      Specified by:
      setPDBCode in interface Structure
      Parameters:
      pdb_id_ - a String specifying the PDBCode
      See Also:
    • getPDBCode

      public String getPDBCode()
      Get PDB code of structure.
      Specified by:
      getPDBCode in interface Structure
      Returns:
      a String representing the PDBCode value
      See Also:
    • setName

      public void setName(String nam)
      Set biological name of Structure .
      Specified by:
      setName in interface Structure
      Parameters:
      nam - a String specifying the biological name of the Structure
      See Also:
    • getName

      public String getName()
      Get biological name of Structure.
      Specified by:
      getName in interface Structure
      Returns:
      a String representing the biological name of the Structure
      See Also:
    • getStructureIdentifier

      public StructureIdentifier getStructureIdentifier()
      Description copied from interface: Structure
      Get an identifier corresponding to this structure
      Specified by:
      getStructureIdentifier in interface Structure
      Returns:
      The StructureIdentifier used to create this structure
    • setStructureIdentifier

      public void setStructureIdentifier(StructureIdentifier structureIdentifier)
      Description copied from interface: Structure
      Set the identifier corresponding to this structure
      Specified by:
      setStructureIdentifier in interface Structure
      Parameters:
      structureIdentifier - the structureIdentifier corresponding to this structure
    • setConnections

      public void setConnections(List<Map<String,Integer>> conns)
      sets/gets an List of Maps which corresponds to the CONECT lines in the PDB file:
                 COLUMNS         DATA TYPE        FIELD           DEFINITION
                 ---------------------------------------------------------------------------------
                      1 -  6         Record name      "CONECT"
                      7 - 11         Integer          serial          Atom serial number
                 12 - 16         Integer          serial          Serial number of bonded atom
                 17 - 21         Integer          serial          Serial number of bonded atom
                 22 - 26         Integer          serial          Serial number of bonded atom
                 27 - 31         Integer          serial          Serial number of bonded atom
                 32 - 36         Integer          serial          Serial number of hydrogen bonded
                 atom
                 37 - 41         Integer          serial          Serial number of hydrogen bonded
                 atom
                 42 - 46         Integer          serial          Serial number of salt bridged
                 atom
                 47 - 51         Integer          serial          Serial number of hydrogen bonded
                 atom
                 52 - 56         Integer          serial          Serial number of hydrogen bonded
                 atom
                 57 - 61         Integer          serial          Serial number of salt bridged
                 atom
                 
      the HashMap for a single CONECT line contains the following fields:
    • atomserial (mandatory) : Atom serial number
    • bond1 .. bond4 (optional): Serial number of bonded atom
    • hydrogen1 .. hydrogen4 (optional):Serial number of hydrogen bonded atom
    • salt1 .. salt2 (optional): Serial number of salt bridged atom
    • Specified by:
      setConnections in interface Structure
      Parameters:
      conns - a List object specifying the connections
      See Also:
    • getConnections

      public List<Map<String,Integer>> getConnections()
      Return the connections value.
      Specified by:
      getConnections in interface Structure
      Returns:
      a List object representing the connections value
      See Also:
    • addChain

      public void addChain(Chain chain)
      Add a new chain.
      Specified by:
      addChain in interface Structure
      Parameters:
      chain - a Chain object
    • addChain

      public void addChain(Chain chain, int modelnr)
      Add a new chain, if several models are available.
      Specified by:
      addChain in interface Structure
      Parameters:
      chain - a Chain object
      modelnr - an int specifying to which model the Chain should be added
    • getChain

      public Chain getChain(int number)
      Retrieve a chain by its position within the Structure .
      Specified by:
      getChain in interface Structure
      Parameters:
      number - an int for the position in the List of Chains.
      Returns:
      a Chain object
    • getChain

      public Chain getChain(int modelnr, int number)
      Retrieve a chain by its position within the Structure and model number.
      Specified by:
      getChain in interface Structure
      Parameters:
      modelnr - an int
      number - an int
      Returns:
      a Chain object
    • addModel

      public void addModel(List<Chain> model)
      Add a new model.
      Specified by:
      addModel in interface Structure
      Parameters:
      model - a List object containing the Chains of the new Model
    • setChains

      public void setChains(List<Chain> chains)
      Set the chains of a structure, if this is a NMR structure, this will only set model 0.
      Specified by:
      setChains in interface Structure
      Parameters:
      chains - the list of chains for this structure.
      See Also:
    • setModel

      public void setModel(int position, List<Chain> model)
      A convenience function if one wants to edit and replace the models in a structure. Allows to set (replace) the model at position with the new List of Chains.
      Specified by:
      setModel in interface Structure
      Parameters:
      position - starting at 0
    • toString

      public String toString()
      string representation.
      Specified by:
      toString in interface Structure
      Overrides:
      toString in class Object
    • size

      public int size()
      return number of chains , if NMR return number of chains of first model .
      Specified by:
      size in interface Structure
      Returns:
      an int representing the number of Chains in this Structure
    • size

      public int size(int modelnr)
      return number of chains of model.
      Specified by:
      size in interface Structure
      Parameters:
      modelnr - an int specifying the number of the Model that should be used
      Returns:
      an int representing the number of Chains in this Model
    • nrModels

      public int nrModels()
      return number of models.
      Specified by:
      nrModels in interface Structure
      Returns:
      an int representing the number of models in this Structure
      See Also:
    • isCrystallographic

      public boolean isCrystallographic()
      Whether this Structure is a crystallographic structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of a space group and sensible cell parameters
      Specified by:
      isCrystallographic in interface Structure
      Returns:
      true if crystallographic, false otherwise
    • isNmr

      public boolean isNmr()
      Whether this Structure is a NMR structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of more than 1 model and from b-factors being 0 in first chain of first model
      Specified by:
      isNmr in interface Structure
      Returns:
      true if NMR, false otherwise
      See Also:
    • setNmr

      @Deprecated public void setNmr(boolean nmr)
      Deprecated.
      set NMR flag.
      Specified by:
      setNmr in interface Structure
      Parameters:
      nmr - true to declare that this Structure has been solved by NMR.
    • getChains

      public List<Chain> getChains(int modelnr)
      retrieve all chains of a model.
      Specified by:
      getChains in interface Structure
      Parameters:
      modelnr - an int
      Returns:
      a List object
      See Also:
    • getChains

      public List<Chain> getChains()
      Retrieve all chains - if it is a NMR structure will return the chains of the first model. This is the same as getChains(0);
      Specified by:
      getChains in interface Structure
      Returns:
      a List object containing the Chains of Model nr. modelnr
      See Also:
    • setChains

      public void setChains(int modelnr, List<Chain> chains)
      Set the chains for a model
      Specified by:
      setChains in interface Structure
    • getModel

      public List<Chain> getModel(int modelnr)
      retrieve all Chains belonging to a model .
      Specified by:
      getModel in interface Structure
      Parameters:
      modelnr - an int
      Returns:
      a List object
      See Also:
    • getChainByPDB

      public Chain getChainByPDB(String chainId, int modelnr) throws StructureException
      Request a chain by its PDB code by default takes only the first model
      Specified by:
      getChainByPDB in interface Structure
      Parameters:
      chainId - the chain identifier
      modelnr - request a particular model;
      Returns:
      the Chain that matches the chainID in the model
      Throws:
      StructureException
    • getChainByPDB

      public Chain getChainByPDB(String chainId) throws StructureException
      Request a chain by its PDB code by default takes only the first model
      Specified by:
      getChainByPDB in interface Structure
      Parameters:
      chainId - the chain identifier
      Returns:
      the Chain that matches the chainID
      Throws:
      StructureException
    • toPDB

      public String toPDB()
      Create a String that contains this Structure's contents in PDB file format.
      Specified by:
      toPDB in interface Structure
      Returns:
      a String that looks like a PDB file
      See Also:
    • toMMCIF

      public String toMMCIF()
      Create a String that contains this Structure's contents in MMCIF file format.
      Specified by:
      toMMCIF in interface Structure
      Returns:
    • hasChain

      public boolean hasChain(String chainId)
      Check if a chain with the id chainId is contained in this structure.
      Specified by:
      hasChain in interface Structure
      Parameters:
      chainId - the name of the chain
      Returns:
      true if a chain with the id (name) chainId is found
    • setCompounds

      public void setCompounds(List<Compound> molList)
      Set the Compounds
      Specified by:
      setCompounds in interface Structure
    • addCompound

      public void addCompound(Compound compound)
      Add a Compound to this Structure
      Specified by:
      addCompound in interface Structure
    • getCompounds

      public List<Compound> getCompounds()
      Get all the Compounds for this Structure. Compounds are called Entities in mmCIF dictionary.
      Specified by:
      getCompounds in interface Structure
      Returns:
      a list of Compounds
    • getCompoundById

      public Compound getCompoundById(int molId)
      Request a particular compound by its molId (entity_id in mmCIF dictionary)
      Specified by:
      getCompoundById in interface Structure
      Returns:
      a compound
    • getDBRefs

      public List<DBRef> getDBRefs()
      Get the list of database references
      Specified by:
      getDBRefs in interface Structure
      Returns:
      list of DBRef objects
    • setDBRefs

      public void setDBRefs(List<DBRef> dbrefs)
      Set the list of database references for this structure
      Specified by:
      setDBRefs in interface Structure
      Parameters:
      dbrefs - list of DBRef objects
    • getPDBHeader

      public PDBHeader getPDBHeader()
      Return the header information for this PDB file
      Specified by:
      getPDBHeader in interface Structure
      Returns:
      the PDBHeader object
    • setPDBHeader

      public void setPDBHeader(PDBHeader pdbHeader)
      Set the the header information for this PDB file
      Specified by:
      setPDBHeader in interface Structure
      Parameters:
      pdbHeader - the PDBHeader object
    • getSSBonds

      public List<Bond> getSSBonds()
      Get the list of disulfide Bonds as they have been defined in the PDB files
      Specified by:
      getSSBonds in interface Structure
      Returns:
      a list of Bonds
    • setSSBonds

      public void setSSBonds(List<Bond> ssbonds)
      Set the list of SSBonds for this structure
      Specified by:
      setSSBonds in interface Structure
    • addSSBond

      public void addSSBond(Bond ssbond)
      Adds a single disulfide Bond to this structure
      Specified by:
      addSSBond in interface Structure
      Parameters:
      ssbond - the SSBond.
    • hasJournalArticle

      public boolean hasJournalArticle()
      Return whether or not the entry has an associated journal article or publication. The JRNL section is not mandatory and thus may not be present.
      Specified by:
      hasJournalArticle in interface Structure
      Returns:
      flag if a JournalArticle could be found.
    • getJournalArticle

      public JournalArticle getJournalArticle()
      get the associated publication as defined by the JRNL records in a PDB file.
      Specified by:
      getJournalArticle in interface Structure
      Returns:
      a JournalArticle
    • setJournalArticle

      public void setJournalArticle(JournalArticle journalArticle)
      set the associated publication as defined by the JRNL records in a PDB file.
      Specified by:
      setJournalArticle in interface Structure
      Parameters:
      journalArticle - the article
    • getSites

      public List<Site> getSites()
      Specified by:
      getSites in interface Structure
      Returns:
      the sites contained in this structure
    • setSites

      public void setSites(List<Site> sites)
      Specified by:
      setSites in interface Structure
      Parameters:
      sites - the sites to set in the structure
    • getHetGroups

      public List<Group> getHetGroups()
      Caution: we should probably remove this to avoid confusion. Currently this is always an empty list!
      Specified by:
      getHetGroups in interface Structure
      Returns:
      a list of Groups listed in the HET records - this will not include any waters.
    • setBiologicalAssembly

      public void setBiologicalAssembly(boolean biologicalAssembly)
      Sets a flag to indicate if this structure is a biological assembly
      Specified by:
      setBiologicalAssembly in interface Structure
      Parameters:
      biologicalAssembly - true if biological assembly, otherwise false
      Since:
      3.2
    • isBiologicalAssembly

      public boolean isBiologicalAssembly()
      Gets flag that indicates if this structure is a biological assembly
      Specified by:
      isBiologicalAssembly in interface Structure
      Returns:
      the sites contained in this structure
      Since:
      3.2
    • setCrystallographicInfo

      public void setCrystallographicInfo(PDBCrystallographicInfo crystallographicInfo)
      Sets crystallographic information for this structure
      Specified by:
      setCrystallographicInfo in interface Structure
      Parameters:
      crystallographicInfo - crystallographic information
      Since:
      3.2
    • getCrystallographicInfo

      public PDBCrystallographicInfo getCrystallographicInfo()
      Gets crystallographic information for this structure
      Specified by:
      getCrystallographicInfo in interface Structure
      Returns:
      PDBCrystallographicInfo crystallographic information
      Since:
      3.2
    • getIdentifier

      public String getIdentifier()
      Get a string representing this structure's contents. The following places are searched for a non-null value, with the first being returned:
      1. Structure.getStructureIdentifier().getIdentifier(), which should give the string originally used to create the structure
      2. Structure.getName()
      3. A combination of Structure.getPDBCode() with a heuristic description of the residue ranges, in SubstructureIdentifier format.
      Specified by:
      getIdentifier in interface Structure
      Returns:
      A SubstructureIdentifier-format string describing the residue ranges in this structure
    • getPdbId

      @Deprecated public String getPdbId()
      Deprecated.
      Returns the PDB identifier associated with this StructureIdentifier.
      Specified by:
      getPdbId in interface Structure
    • resetModels

      public void resetModels()
      Resets all models of this Structure
      Specified by:
      resetModels in interface Structure
    • getResidueRanges

      @Deprecated public List<ResidueRange> getResidueRanges()
      Deprecated.
      Returns the list of ResidueRanges that this StructureIdentifier defines. This is a unique representation.
      Specified by:
      getResidueRanges in interface Structure
    • getRanges

      @Deprecated public List<String> getRanges()
      Deprecated.
      Returns a list of residue ranges. For example:
       getRanges().get(0): 'A'
       getRanges().get(1): 'B_5-100'
       
      This is a unique representation.
      Specified by:
      getRanges in interface Structure