public class StructureTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
backboneAtomNames
The names of the Atoms that form the backbone.
|
static java.lang.String |
caAtomName
The Atom name of C-alpha atoms.
|
static java.lang.String |
cbAtomName |
static java.util.logging.Logger |
logger |
static java.lang.String |
nAtomName |
static java.lang.String |
oAtomName |
static java.util.regex.Pattern |
pdbNumRangeRegex
Pattern to describe subranges.
|
static java.lang.Character |
UNKNOWN_GROUP_LABEL |
Constructor and Description |
---|
StructureTools() |
Modifier and Type | Method and Description |
---|---|
static Atom[] |
cloneCAArray(Atom[] ca)
Provides an equivalent copy of Atoms in a new array.
|
static Group[] |
cloneGroups(Atom[] ca)
Clone a set of CA Atoms, but returns the parent groups
|
static java.lang.Character |
convert_3code_1code(java.lang.String code3)
convert three character amino acid codes into single character
e.g.
|
static java.lang.String |
convertAtomsToSeq(Atom[] atoms) |
static Atom[] |
duplicateCA2(Atom[] ca2)
Utility method for working with circular permutations.
|
static java.util.List<Group> |
filterLigands(java.util.List<Group> allGroups)
Removes all polymeric and solvent groups from a list of groups
|
static java.lang.Character |
get1LetterCode(java.lang.String groupCode3)
convert a three letter code into single character.
|
static Atom[] |
getAllAtomArray(Structure s)
Convert all atoms of the structure (first model) into an Atom array
|
static Atom[] |
getAtomArray(Chain c,
java.lang.String[] atomNames)
Returns an array of the requested Atoms from the Structure object.
|
static Atom[] |
getAtomArray(Structure s,
java.lang.String[] atomNames)
Returns an array of the requested Atoms from the Structure object.
|
static Atom[] |
getAtomArrayAllModels(Structure s,
java.lang.String[] atomNames)
Returns an array of the requested Atoms from the Structure object.
|
static Atom[] |
getAtomCAArray(Chain c)
Returns an Atom array of the CA atoms.
|
static Atom[] |
getAtomCAArray(Structure s)
Returns an Atom array of the CA atoms.
|
static Atom[] |
getBackboneAtomArray(Structure s)
Returns an Atom array of the MainChain atoms.
|
static Group |
getGroupByPDBResidueNumber(Structure struc,
ResidueNumber pdbResNum)
Get a group represented by a ResidueNumber.
|
static java.util.Map<Group,java.lang.Double> |
getGroupDistancesWithinShell(Structure structure,
Atom centroid,
java.util.Set<ResidueNumber> excludeResidues,
double radius,
boolean includeWater,
boolean useAverageDistance)
Finds Groups in
structure that contain at least one Atom that is within radius Angstroms of centroid . |
static java.util.Set<Group> |
getGroupsWithinShell(Structure structure,
Atom atom,
java.util.Set<ResidueNumber> excludeResidues,
double distance,
boolean includeWater) |
static java.util.List<Group> |
getGroupsWithinShell(Structure structure,
Group group,
double distance,
boolean includeWater) |
static int |
getNrAtoms(Structure s)
Count how many number of Atoms are contained within a Structure object.
|
static int |
getNrGroups(Structure s)
Count how many groups are contained within a structure object.
|
static ResidueNumber |
getPDBResidueNumber(Group g)
Deprecated.
replaced by Group.getResidueNumber()
|
static Structure |
getReducedStructure(Structure s,
int chainNr)
Reduce a structure to provide a smaller representation.
|
static Structure |
getReducedStructure(Structure s,
java.lang.String chainId)
Reduce a structure to provide a smaller representation .
|
static Structure |
getStructure(java.lang.String name)
Short version of
getStructure(String, PDBFileParser, AtomCache)
which creates new parsers when needed |
static Structure |
getStructure(java.lang.String name,
PDBFileParser parser,
AtomCache cache)
Flexibly get a structure from an input String.
|
static Structure |
getSubRanges(Structure s,
java.lang.String ranges)
In addition to the functionality provided by getReducedStructure also provides a way to specify sub-regions of a structure with the following
specification:
ranges can be surrounded by ( and ).
|
static boolean |
isNucleotide(java.lang.String groupCode3) |
static Structure |
removeModels(Structure s)
Remove all models from a Structure and keep only the first
|
public static final java.lang.String caAtomName
public static final java.lang.String nAtomName
public static final java.lang.String oAtomName
public static final java.lang.String cbAtomName
public static final java.lang.String[] backboneAtomNames
public static final java.lang.Character UNKNOWN_GROUP_LABEL
public static java.util.logging.Logger logger
public static final java.util.regex.Pattern pdbNumRangeRegex
getSubRanges(Structure, String)
public static final int getNrAtoms(Structure s)
s
- the structure objectpublic static final int getNrGroups(Structure s)
s
- the structure objectpublic static final Atom[] getAtomArray(Structure s, java.lang.String[] atomNames)
AminoAcid
or HetatomImpl
group.
For structures with more than one model, only model 0 will be used.s
- the structure to get the atoms fromatomNames
- contains the atom names to be used.public static final Atom[] getAtomArrayAllModels(Structure s, java.lang.String[] atomNames)
getAtomArray(Structure, String[])
this method iterates over all chains.
Iterates over all chains and groups
and checks if the requested atoms are in this group, no matter if this is a AminoAcid
or HetatomImpl
group.
For structures with more than one model, only model 0 will be used.s
- the structure to get the atoms fromatomNames
- contains the atom names to be used.public static final Atom[] getAllAtomArray(Structure s)
s
- input structurepublic static final Atom[] getAtomArray(Chain c, java.lang.String[] atomNames)
c
- the Chain to get the atoms fromatomNames
- contains the atom names to be used.public static final Atom[] getAtomCAArray(Chain c)
c
- the structure objectpublic static final Atom[] cloneCAArray(Atom[] ca) throws StructureException
ca
- array of CA atomsStructureException
public static Group[] cloneGroups(Atom[] ca)
ca
- Atom arraypublic static Atom[] duplicateCA2(Atom[] ca2) throws StructureException
ca2
- atom arrayStructureException
public static Atom[] getAtomCAArray(Structure s)
s
- the structure objectpublic static Atom[] getBackboneAtomArray(Structure s)
s
- the structure objectpublic static final java.lang.Character convert_3code_1code(java.lang.String code3) throws UnknownPdbAminoAcidException
code3
- a three character amino acid representation StringIllegalSymbolException
UnknownPdbAminoAcidException
public static final java.lang.Character get1LetterCode(java.lang.String groupCode3)
groupCode3
- three letter representationpublic static final boolean isNucleotide(java.lang.String groupCode3)
public static final Structure getReducedStructure(Structure s, java.lang.String chainId) throws StructureException
s
- chainId
- StructureException
public static final Structure getReducedStructure(Structure s, int chainNr) throws StructureException
s
- chainNr
- can be -1 to request all chains of model 0, otherwise will only add chain at this positionStructureException
public static final Structure getSubRanges(Structure s, java.lang.String ranges) throws StructureException
s
- The full structureranges
- A comma-seperated list of ranges, optionally surrounded by parenthesesStructureException
public static final java.lang.String convertAtomsToSeq(Atom[] atoms)
public static final ResidueNumber getPDBResidueNumber(Group g)
g
- Group objectpublic static final Group getGroupByPDBResidueNumber(Structure struc, ResidueNumber pdbResNum) throws StructureException
struc
- a Structure
pdbResNum
- a ResidueNumber
StructureException
- if the group cannot be found.public static java.util.Map<Group,java.lang.Double> getGroupDistancesWithinShell(Structure structure, Atom centroid, java.util.Set<ResidueNumber> excludeResidues, double radius, boolean includeWater, boolean useAverageDistance)
structure
that contain at least one Atom that is within radius
Angstroms of centroid
.structure
- The structure from which to find Groupscentroid
- The centroid of the shellexcludeResidues
- A list of ResidueNumbers to excluderadius
- The radius from centroid
, in AngstromsincludeWater
- Whether to include Groups whose only atoms are wateruseAverageDistance
- When set to true, distances are the arithmetic mean (1-norm) of the distances of atoms that belong to the group and that are within the shell; otherwise, distances are the minimum of these valuespublic static java.util.Set<Group> getGroupsWithinShell(Structure structure, Atom atom, java.util.Set<ResidueNumber> excludeResidues, double distance, boolean includeWater)
public static java.util.List<Group> getGroupsWithinShell(Structure structure, Group group, double distance, boolean includeWater)
public static Structure removeModels(Structure s)
s
- original Structurepublic static java.util.List<Group> filterLigands(java.util.List<Group> allGroups)
public static Structure getStructure(java.lang.String name) throws java.io.IOException, StructureException
getStructure(String, PDBFileParser, AtomCache)
which creates new parsers when neededname
- java.io.IOException
StructureException
public static Structure getStructure(java.lang.String name, PDBFileParser parser, AtomCache cache) throws java.io.IOException, StructureException
name
- Some reference to the protein structureparser
- A clean PDBFileParser to use if it is a file. If null,
a PDBFileParser will be instantiated if needed.cache
- An AtomCache to use if the structure can be fetched from the
PDB. If null, a AtomCache will be instantiated if needed.java.io.IOException
- if name is an existing file, but doesn't parse correctlyStructureException
- if the format is unknown, or if AtomCache throws
an exception.