public class AtomPositionMap extends Object
ResidueNumbers
to ATOM record positions in a PDB file.
To use:
Atom[] atoms = new AtomCache().getAtoms("1w0p"); AtomPositionMap map = new AtomPositionMap(atoms); ResidueNumber start = new ResidueNumber("A", 100, null); ResidueNumber end = map.getEnd("A"); int pos = map.getPosition(start); int length = map.calcLength(start, end);
Note: The getLength() methods were introduced in BioJava 4.0.0 to replace the calcLength methods. The new method returns the number of residues between two residues, inclusive, whereas the previous method returned 1 less than that.
Modifier and Type | Class and Description |
---|---|
static interface |
AtomPositionMap.GroupMatcher
Used as a Predicate to indicate whether a particular Atom should be mapped
|
Modifier and Type | Field and Description |
---|---|
static AtomPositionMap.GroupMatcher |
AMINO_ACID_MATCHER
Matches CA atoms of protein groups
|
static AtomPositionMap.GroupMatcher |
ANYTHING_MATCHER
Matches all atoms
|
Constructor and Description |
---|
AtomPositionMap(Atom[] atoms)
Creates a new AtomPositionMap containing peptide alpha-carbon atoms
|
AtomPositionMap(Atom[] atoms,
AtomPositionMap.GroupMatcher matcher)
Creates a new AtomPositionMap containing only atoms matched by
matcher . |
AtomPositionMap(Structure s)
Creates a new AtomPositionMap containing representative atoms
from a structure.
|
Modifier and Type | Method and Description |
---|---|
ResidueNumber |
getFirst() |
ResidueNumber |
getFirst(String chainId) |
ResidueNumber |
getLast() |
ResidueNumber |
getLast(String chainId) |
int |
getLength(int positionA,
int positionB,
String startingChain)
Calculates the number of residues of the specified chain in a given range, inclusive.
|
int |
getLength(ResidueNumber start,
ResidueNumber end)
Calculates the number of atoms between two ResidueNumbers, inclusive.
|
int |
getLengthDirectional(int positionStart,
int positionEnd,
String startingChain)
Calculates the number of residues of the specified chain in a given range.
|
int |
getLengthDirectional(ResidueNumber start,
ResidueNumber end)
Calculates the number of atoms between two ResidueNumbers, inclusive.
|
NavigableMap<ResidueNumber,Integer> |
getNavMap() |
Integer |
getPosition(ResidueNumber residueNumber)
Gets the 0-based index of residueNumber to the matched atoms
|
List<ResidueRangeAndLength> |
getRanges()
Returns a list of
ResidueRanges corresponding to this entire AtomPositionMap. |
ResidueRangeAndLength |
trimToValidResidues(ResidueRange rr)
Trims a residue range so that both endpoints are contained in this map.
|
public static final AtomPositionMap.GroupMatcher AMINO_ACID_MATCHER
public static final AtomPositionMap.GroupMatcher ANYTHING_MATCHER
public AtomPositionMap(Atom[] atoms)
atoms
- public AtomPositionMap(Atom[] atoms, AtomPositionMap.GroupMatcher matcher)
matcher
.
If multiple atoms are present from a group, the first atom encountered will
be used.atoms
- public AtomPositionMap(Structure s)
s
- public int getLength(int positionA, int positionB, String startingChain)
positionA
- index of the first atom to countpositionB
- index of the last atom to countstartingChain
- Case-sensitive chainpublic int getLengthDirectional(int positionStart, int positionEnd, String startingChain)
positionStart
- index of the first atom to countpositionEnd
- index of the last atom to countstartingChain
- Case-sensitive chainpublic int getLength(ResidueNumber start, ResidueNumber end)
start
- First residueend
- Last residueIllegalArgumentException
- if start and end are on different chains,
or if either of the residues doesn't existpublic int getLengthDirectional(ResidueNumber start, ResidueNumber end)
start
- First residueend
- Last residueIllegalArgumentException
- if start and end are on different chains,
or if either of the residues doesn't existpublic NavigableMap<ResidueNumber,Integer> getNavMap()
public Integer getPosition(ResidueNumber residueNumber)
residueNumber
- residueNumber
, or null if the residueNumber was not foundpublic ResidueNumber getFirst(String chainId)
chainId
- ResidueNumber
of the specified chain (the one highest down in the PDB file)public ResidueNumber getLast(String chainId)
chainId
- ResidueNumber
of the specified chain (the one farthest down in the PDB file)public ResidueNumber getFirst()
ResidueNumber
of any chain (the one farthest down in the PDB file)public ResidueNumber getLast()
ResidueNumber
of any chain (the one farthest down in the PDB file)public List<ResidueRangeAndLength> getRanges()
ResidueRanges
corresponding to this entire AtomPositionMap.public ResidueRangeAndLength trimToValidResidues(ResidueRange rr)
rr
- residue rangeCopyright © 2000–2019 BioJava. All rights reserved.