## org.biojava.bio.structure
Interface Chain

All Known Implementing Classes:
  ChainImpl

    public interface Chain

Defines the interface for a Chain. A Chain corresponds to a Chain in a PDB file. A chain consists out of a list of `Group` objects. A Group can either be an `AminoAcid`, `Hetatom` or `Nucleotide`.

The BioJava API provides access to both the ATOM and SEQRES records in a PDB file. During parsing of a PDB file it aligns the ATOM and SEQRES groups and joins them. The SEQRES sequence can be accessed via `getSeqResGroups()` and the ATOM groups via `getAtomGroups()`. Groups that have been observed (i.e. they are in the ATOM records) can be detected by `Group`.has3D()

Since:
  1.4
Version:
  %I% %G%
Author:
  Andreas Prlic

Method Summary
`void` `addGroup(Group group)` add a group to the list of ATOM record group of this chain.
`Object` `clone()` returns an identical copy of this Chain.
`Annotation` `getAnnotation()` get/set the Annotation of a Chain.
`Group` `getAtomGroup(int position)` return the Group at position X.
`List<Group>` `getAtomGroups()` Return all groups that have been specified in the ATOM section of this chain .
`List<Group>` `getAtomGroups(String type)` Return a List of all groups of a special type (e.g.
`int` `getAtomLength()` Return the number of Groups in the ATOM records of the chain.
`String` `getAtomSequence()` Return the sequence of amino acids as it has been provided in the ATOM records.
`Sequence` `getBJSequence()` Convert the SEQRES groups of a Chain to a Biojava Sequence object.
`Group` `getGroup(int position)` Deprecated. use getAtomGroup or getSeqResGroup instead
`Group` `getGroupByPDB(String pdbresnum)` get a group by its PDB residue numbering.
`List<Group>` `getGroups()` Deprecated. use getAtomGroups or getSeqResGroups instead
`List<Group>` `getGroups(String type)` Deprecated. use getAtomGroups or getSeqResGroups instead
`Group[]` `getGroupsByPDB(String pdbresnumStart, String pdbresnumEnd)` Get all groups that are located between two PDB residue numbers.
`Group[]` `getGroupsByPDB(String pdbresnumStart, String pdbresnumEnd, boolean ignoreMissing)` Get all groups that are located between two PDB residue numbers.
`Compound` `getHeader()` Returns the Header ( a Compound object) for this chain.
`Long` `getId()` Get the ID used by Hibernate.
`int` `getLength()` Deprecated. please use getAtomLength or getLengthSeqRes instead
`int` `getLengthAminos()` Deprecated. use getAtomGroups("amino").size() instead.
`String` `getName()` get and set the name of this chain (Chain id in PDB file ).
`Structure` `getParent()` Returns the parent Structure of this chain.
`Group` `getSeqResGroup(int position)` return the Group at position X.
`List<Group>` `getSeqResGroups()` Return all groups of this chain.
`List<Group>` `getSeqResGroups(String type)` Return a List of all groups of a special type (e.g.
`int` `getSeqResLength()` Returns the number of groups in the SEQRES records of the chain.
`String` `getSeqResSequence()` Get the sequence for all amino acids as it is specified in the SEQRES residues.
`String` `getSequence()` Deprecated. use getAtomSequence instead
`String` `getSwissprotId()` Get the Swissprot id of this chain.
`void` `setAnnotation(Annotation anno)` get/set the Annotation of a Chain.
`void` `setAtomGroups(List<Group> groups)` Set all groups that have been specified in the ATOM section of this chain .
`void` `setHeader(Compound molId)` Set the Header from the PDB file.
`void` `setId(Long id)` Set the ID used by Hibernate.
`void` `setName(String name)` get and set the name of this chain (Chain id in PDB file ).
`void` `setParent(Structure parent)` Set the back-reference to its parent Structure.
`void` `setSeqResGroups(List<Group> seqResGroups)` Set the list of SeqResGroups for this chain.
`void` `setSwissprotId(String sp_id)` Set the Swissprot id of this chain.
`String` `toString()` string representation.

Method Detail

### clone

    Object clone()

  returns an identical copy of this Chain.

  Returns:
    an identical copy of this Chain

### addGroup

    void addGroup(Group group)

  add a group to the list of ATOM record group of this chain. To add SEQRES records a more complex alignment between ATOM and SEQRES residues is required, please see SeqRes2AtomAligner for more details on that.

  Parameters:
    `group` - a Group object

### getId

    Long getId()

  Get the ID used by Hibernate.

  Returns:
    the ID used by Hibernate
  See Also:
    `setId(Long)`

### setId

    void setId(Long id)

  Set the ID used by Hibernate.

  Parameters:
    `id` - assigned by Hibernate
  See Also:
    `getId()`

### getGroup

    Group getGroup(int position)

  Deprecated. use getAtomGroup or getSeqResGroup instead

  return the amino acid at position X.

  Parameters:
    `position` - an int
  Returns:
    a Group object
  See Also:
    `getAtomGroup(int)`, `getSeqResGroup(int)`

### getAtomGroup

    Group getAtomGroup(int position)

  return the Group at position X.

  Parameters:
    `position` - an int
  Returns:
    a Group object

### getSeqResGroup

    Group getSeqResGroup(int position)

  return the Group at position X.

  Parameters:
    `position` - an int
  Returns:
    a Group object

### getGroups

    List<Group> getGroups(String type)

  Deprecated. use getAtomGroups or getSeqResGroups instead

  return a List of all groups of a special type (e.g. amino, hetatm, nucleotide).

  Parameters:
    `type` - a String
  Returns:
    a List object

### getGroups

    List<Group> getGroups()

  Deprecated. use getAtomGroups or getSeqResGroups instead

  return all groups of this chain.

  Returns:
    a List of all Group objects of this chain

### getAtomGroups

    List<Group> getAtomGroups()

  Return all groups that have been specified in the ATOM section of this chain .

  Returns:
    a List object representing the Groups of this Chain.
  See Also:
    `setAtomGroups(List)`

### setAtomGroups

    void setAtomGroups(List<Group> groups)

  Set all groups that have been specified in the ATOM section of this chain .

  Parameters:
    `groups` - a List object representing the Groups of this Chain.
  See Also:
    `getAtomGroups()`

### getAtomGroups

    List<Group> getAtomGroups(String type)

  Return a List of all groups of a special type (e.g. amino, hetatm, nucleotide).

  Parameters:
    `type` - a String
  Returns:
    a List object
  See Also:
    `setAtomGroups(List)`

### getGroupByPDB

    Group getGroupByPDB(String pdbresnum)
                        throws StructureException

  get a group by its PDB residue numbering. if the PDB residue number is not know, throws a StructureException.

  Parameters:
    `pdbresnum` - the PDB residue number of the group
  Returns:
    the matching group
  Throws:
    `StructureException`

### getGroupsByPDB

    Group[] getGroupsByPDB(String pdbresnumStart,
                           String pdbresnumEnd)
                           throws StructureException

  Get all groups that are located between two PDB residue numbers.

  Parameters:
    `pdbresnumStart` - PDB residue number of start
    `pdbresnumEnd` - PDB residue number of end
  Returns:
    Groups in between. or throws a StructureException if either start or end can not be found,
  Throws:
    `StructureException`

### getGroupsByPDB

    Group[] getGroupsByPDB(String pdbresnumStart,
                           String pdbresnumEnd,
                           boolean ignoreMissing)
                           throws StructureException

  Get all groups that are located between two PDB residue numbers. In contrast to getGroupsByPDB this method call ignores if the exact outer groups are not found. This is useful e.g. when requesting the range of groups as specified by the DBREF records - these frequently are rather inaccurate.

  Parameters:
    `pdbresnumStart` - PDB residue number of start
    `pdbresnumEnd` - PDB residue number of end
    `ignoreMissing` - ignore missing groups in this range.
  Returns:
    Groups in between. or throws a StructureException if either start or end can not be found,
  Throws:
    `StructureException`

### getLength

    int getLength()

  Deprecated. please use getAtomLength or getLengthSeqRes instead

  get total length of chain, including HETATMs..

  Returns:
    an int representing the length of the whole chain including HETATMs
  See Also:
    `getAtomLength()`, `getSeqResLength()`

### getAtomLength

    int getAtomLength()

  Return the number of Groups in the ATOM records of the chain.

  Returns:
    the length

### getSeqResLength

    int getSeqResLength()

  Returns the number of groups in the SEQRES records of the chain.

  Returns:
    the length

### getLengthAminos

    int getLengthAminos()

  Deprecated. use getAtomGroups("amino").size() instead.

  returns the length of the AminoAcids in the ATOM records of this chain. note: not all amino acids need to have 3D coords, in fact in could be that none has!

  Returns:
    an int representing the length of the AminoAcids in the ATOM records of the chain.

### setAnnotation

    void setAnnotation(Annotation anno)

  get/set the Annotation of a Chain. allows to annotate a protein chain, e.g. molecule description "AZURIN" for pdb 1a4a.A

  Parameters:
    `anno` - the Annotation to be provided.
  See Also:
    `getAnnotation()`

### getAnnotation

    Annotation getAnnotation()

  get/set the Annotation of a Chain. allows to annotate a protein chain, e.g. molecule description "AZURIN" for pdb 1a4a.A

  Returns:
    the Annotation of this chain
  See Also:
    `setAnnotation(Annotation)`

### setHeader

    void setHeader(Compound molId)

  Set the Header from the PDB file.

  Parameters:
    `molId` - the Compound that contains the header information for this chain
  See Also:
    `getHeader()`

### getHeader

    Compound getHeader()

  Returns the Header ( a Compound object) for this chain.

  Returns:
    the Compound object that contains the Header information
  See Also:
    `setHeader(Compound)`

### setName

    void setName(String name)

  get and set the name of this chain (Chain id in PDB file ).

  Parameters:
    `name` - a String specifying the name value
  See Also:
    `getName()`

### getName

    String getName()

  get and set the name of this chain (Chain id in PDB file ).

  Returns:
    a String representing the name value
  See Also:
    `setName(java.lang.String)`

### toString

    String toString()

  string representation.

  Overrides:
    `toString` in class `Object`

### getBJSequence

    Sequence getBJSequence()
                           throws IllegalSymbolException

  Convert the SEQRES groups of a Chain to a Biojava Sequence object.

  Returns:
    the SEQRES groups of the Chain as a Sequence object.
  Throws:
    `IllegalSymbolException`

### getSequence

    String getSequence()

  Deprecated. use getAtomSequence instead

  return the amino acid sequence of this chain ( all aminos even if they do not have 3D data ...).

  Returns:
    the sequence as a string
  See Also:
    `getAtomSequence()`

### getAtomSequence

    String getAtomSequence()

  Return the sequence of amino acids as it has been provided in the ATOM records.

  Returns:
    amino acid sequence as string
  See Also:
    `getSeqResSequence()`

### getSeqResSequence

    String getSeqResSequence()

  Get the sequence for all amino acids as it is specified in the SEQRES residues.

  Returns:
    the amino acid sequence of the SEQRES sequence as a string
  See Also:
    `getAtomSequence()`

### setSwissprotId

    void setSwissprotId(String sp_id)

  Set the Swissprot id of this chain.

  Parameters:
    `sp_id` - a String specifying the swissprot id value
  See Also:
    `getSwissprotId()`

### getSwissprotId

    String getSwissprotId()

  Get the Swissprot id of this chain.

  Returns:
    a String representing the swissprot id value
  See Also:
    `setSwissprotId(String sp_id)`

### getSeqResGroups

    List<Group> getSeqResGroups(String type)

  Return a List of all groups of a special type (e.g. amino, hetatm, nucleotide).

  Parameters:
    `type` - a String
  Returns:
    an List object
  See Also:
    `setSeqResGroups(List)`

### getSeqResGroups

    List<Group> getSeqResGroups()

  Return all groups of this chain.

  Returns:
    a List of all Group objects of this chain
  See Also:
    `setSeqResGroups(List)`

### setSeqResGroups

    void setSeqResGroups(List<Group> seqResGroups)

  Set the list of SeqResGroups for this chain.

  Parameters:
    `seqResGroups` - a List of Group objects that from the SEQRES groups of this chain.
  See Also:
    `getSeqResGroups()`

### setParent

    void setParent(Structure parent)

  Set the back-reference to its parent Structure.

  Parameters:
    `parent` - the parent Structure object for this Chain
  See Also:
    `getParent()`

### getParent

    Structure getParent()

  Returns the parent Structure of this chain.

  Returns:
    the parent Structure object
  See Also:
    `setParent(Structure)`