Class MultipleAlignmentImpl
java.lang.Object
org.biojava.nbio.structure.align.multiple.AbstractScoresCache
org.biojava.nbio.structure.align.multiple.MultipleAlignmentImpl
- All Implemented Interfaces:
Serializable
,Cloneable
,MultipleAlignment
,ScoresCache
public class MultipleAlignmentImpl
extends AbstractScoresCache
implements Serializable, MultipleAlignment, Cloneable
A general implementation of a
MultipleAlignment
.- Since:
- 4.1.0
- Author:
- Aleix Lafita
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault Constructor.Constructor linking to an existing ensemble.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the cached scores.clone()
Creates and returns an identical copy of this alignment, including a deep copy of all constituent BlockSets.Returns the number of non null positions (residues) of each structure in the alignment.Returns the array of Atoms for each structure from its parent Ensemble.getBlock
(int index) Returns the Block with the specified index of the MultipleAlignment.Convenience method to get a List of all Blocks from all BlockSets.getBlockSet
(int index) Returns the BlockSet with the specified index of the MultipleAlignment.Returns the BlockSet List of the multiple structure alignment.int
Returns the number of aligned residues (columns) without gaps in the alignment: the sum of all BlockSet core lengths.Returns the coverage of the alignment for each structure in the alignment as a fraction between 0.0 and 1.0.Returns the parent Ensemble of the MultipleAlignment.getStructureIdentifier
(int index) Returns the StructureIdentifier associated with the structure index from its parent Ensemble.int
length()
Returns the total number of aligned residues (columns) in the multiple alignment: the sum of all BlockSet lengths.void
setBlockSets
(List<BlockSet> blockSets) Sets the List of BlockSet List of the specified alignment.void
setEnsemble
(MultipleAlignmentEnsemble parent) Set the back-reference to its parent Ensemble.int
size()
Returns the number of aligned structures in the MultipleAlignment.toString()
Return a summary of the MultipleAlignment, containing the structures, the lengths and the cached scores.protected void
Updates all cached propertiesprotected void
Force recalculation of the core length (ungapped columns) based on the BlockSet core lengths.protected void
Force recalculation of the length (aligned columns) based on the BlockSet lengths.Methods inherited from class org.biojava.nbio.structure.align.multiple.AbstractScoresCache
clone, getScore, getScores, putScore
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.biojava.nbio.structure.align.multiple.ScoresCache
getScore, getScores, putScore
-
Constructor Details
-
MultipleAlignmentImpl
public MultipleAlignmentImpl()Default Constructor. Empty alignment. No structures assigned. -
MultipleAlignmentImpl
Constructor linking to an existing ensemble. Automatically adds this alignment to the parent ensemble.- Parameters:
ensemble
- parent MultipleAlignmentEnsemble.
-
MultipleAlignmentImpl
Copy constructor. Recursively copies member BlockSets.- Parameters:
ma
- MultipleAlignmentImpl to copy.
-
-
Method Details
-
clear
public void clear()Description copied from class:AbstractScoresCache
Clear the cached scores. This frees memory after the alignment changed.- Specified by:
clear
in interfaceMultipleAlignment
- Overrides:
clear
in classAbstractScoresCache
-
clone
Description copied from interface:MultipleAlignment
Creates and returns an identical copy of this alignment, including a deep copy of all constituent BlockSets.- Specified by:
clone
in interfaceMultipleAlignment
- Overrides:
clone
in classObject
- Returns:
- MultipleAlignment identical copy of this object.
-
toString
Description copied from interface:MultipleAlignment
Return a summary of the MultipleAlignment, containing the structures, the lengths and the cached scores. Can be used as a header for the differnt display options.- Specified by:
toString
in interfaceMultipleAlignment
- Overrides:
toString
in classObject
- Returns:
- String header summary of the MultipleAlignment
-
getBlockSets
Description copied from interface:MultipleAlignment
Returns the BlockSet List of the multiple structure alignment. Initializes the variable if it is null.- Specified by:
getBlockSets
in interfaceMultipleAlignment
- Returns:
- List of BlockSets that describe the aligned residues of all the structures.
- See Also:
-
getBlocks
Description copied from interface:MultipleAlignment
Convenience method to get a List of all Blocks from all BlockSets. Modifications of this List will not alter the MultipleAlignment, but modifications to the Blocks will.- Specified by:
getBlocks
in interfaceMultipleAlignment
- Returns:
- List of Blocks
- See Also:
-
setBlockSets
Description copied from interface:MultipleAlignment
Sets the List of BlockSet List of the specified alignment.- Specified by:
setBlockSets
in interfaceMultipleAlignment
- Parameters:
blockSets
- the List of BlockSets that describe the aligned residues.- See Also:
-
getBlockSet
Description copied from interface:MultipleAlignment
Returns the BlockSet with the specified index of the MultipleAlignment. Throws an Exception if the index is out of bounds, like accessing a normal List.- Specified by:
getBlockSet
in interfaceMultipleAlignment
- Parameters:
index
- of the BlockSet- Returns:
- BlockSets at the specified index
- See Also:
-
getBlock
Description copied from interface:MultipleAlignment
Returns the Block with the specified index of the MultipleAlignment. Throws an Exception if the index is out of bounds, like accessing a normal List.- Specified by:
getBlock
in interfaceMultipleAlignment
- Parameters:
index
- of the BlockSet- Returns:
- Block at the specified index
- See Also:
-
getAtomArrays
Description copied from interface:MultipleAlignment
Returns the array of Atoms for each structure from its parent Ensemble. Throws an Exception if the parent ensemble is null or the Atom variables are not previously set.- Specified by:
getAtomArrays
in interfaceMultipleAlignment
- Returns:
- List of Atom arrays
- See Also:
-
getStructureIdentifier
Description copied from interface:MultipleAlignment
Returns the StructureIdentifier associated with the structure index from its parent Ensemble. Throws an Exception if the parent ensemble is null or the StructureIdentifiers are not previously set.- Specified by:
getStructureIdentifier
in interfaceMultipleAlignment
- Returns:
- StructureIdentifier
- See Also:
-
size
public int size()Description copied from interface:MultipleAlignment
Returns the number of aligned structures in the MultipleAlignment.- Specified by:
size
in interfaceMultipleAlignment
- Returns:
- int number of aligned structures
- See Also:
-
length
public int length()Description copied from interface:MultipleAlignment
Returns the total number of aligned residues (columns) in the multiple alignment: the sum of all BlockSet lengths.- Specified by:
length
in interfaceMultipleAlignment
- Returns:
- int the total number of aligned residues in the alignment.
- See Also:
-
getCoreLength
public int getCoreLength()Description copied from interface:MultipleAlignment
Returns the number of aligned residues (columns) without gaps in the alignment: the sum of all BlockSet core lengths.- Specified by:
getCoreLength
in interfaceMultipleAlignment
- Returns:
- int the total number of aligned residues.
- See Also:
-
updateLength
protected void updateLength()Force recalculation of the length (aligned columns) based on the BlockSet lengths. -
updateCoreLength
protected void updateCoreLength()Force recalculation of the core length (ungapped columns) based on the BlockSet core lengths. -
updateCache
protected void updateCache()Updates all cached properties- Throws:
StructureException
-
getEnsemble
Description copied from interface:MultipleAlignment
Returns the parent Ensemble of the MultipleAlignment. Returns null if there is no referenced object.- Specified by:
getEnsemble
in interfaceMultipleAlignment
- Returns:
- MultipleAlignmentEnsemble the parent MultipleAlignment of the BlockSet, or null.
- See Also:
-
setEnsemble
Description copied from interface:MultipleAlignment
Set the back-reference to its parent Ensemble.Neither removes this alignment from its previous ensemble, if any, nor adds it to the new parent. Calling code should assure that links to and from the ensemble are consistent and free of memory leaks.
- Specified by:
setEnsemble
in interfaceMultipleAlignment
- Parameters:
parent
- the parent MultipleAlignmentEnsemble.- See Also:
-
getAlignResCounts
Description copied from interface:MultipleAlignment
Returns the number of non null positions (residues) of each structure in the alignment. The values can be used to compute the coverages.- Specified by:
getAlignResCounts
in interfaceMultipleAlignment
- Returns:
- List of residue counts for each structure
-
getCoverages
Description copied from interface:MultipleAlignment
Returns the coverage of the alignment for each structure in the alignment as a fraction between 0.0 and 1.0.- Specified by:
getCoverages
in interfaceMultipleAlignment
- Returns:
- List coverage for each structure
-