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 aMultipleAlignment.- Since:
- 4.1.0
- Author:
- Aleix Lafita
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultipleAlignmentImpl()Default Constructor.MultipleAlignmentImpl(MultipleAlignmentEnsemble ensemble)Constructor linking to an existing ensemble.MultipleAlignmentImpl(MultipleAlignmentImpl ma)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the cached scores.MultipleAlignmentImplclone()Creates and returns an identical copy of this alignment, including a deep copy of all constituent BlockSets.List<Integer>getAlignResCounts()Returns the number of non null positions (residues) of each structure in the alignment.List<Atom[]>getAtomArrays()Returns the array of Atoms for each structure from its parent Ensemble.BlockgetBlock(int index)Returns the Block with the specified index of the MultipleAlignment.List<Block>getBlocks()Convenience method to get a List of all Blocks from all BlockSets.BlockSetgetBlockSet(int index)Returns the BlockSet with the specified index of the MultipleAlignment.List<BlockSet>getBlockSets()Returns the BlockSet List of the multiple structure alignment.intgetCoreLength()Returns the number of aligned residues (columns) without gaps in the alignment: the sum of all BlockSet core lengths.List<Double>getCoverages()Returns the coverage of the alignment for each structure in the alignment as a fraction between 0.0 and 1.0.MultipleAlignmentEnsemblegetEnsemble()Returns the parent Ensemble of the MultipleAlignment.StructureIdentifiergetStructureIdentifier(int index)Returns the StructureIdentifier associated with the structure index from its parent Ensemble.intlength()Returns the total number of aligned residues (columns) in the multiple alignment: the sum of all BlockSet lengths.voidsetBlockSets(List<BlockSet> blockSets)Sets the List of BlockSet List of the specified alignment.voidsetEnsemble(MultipleAlignmentEnsemble parent)Set the back-reference to its parent Ensemble.intsize()Returns the number of aligned structures in the MultipleAlignment.StringtoString()Return a summary of the MultipleAlignment, containing the structures, the lengths and the cached scores.protected voidupdateCache()Updates all cached propertiesprotected voidupdateCoreLength()Force recalculation of the core length (ungapped columns) based on the BlockSet core lengths.protected voidupdateLength()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 Detail
-
MultipleAlignmentImpl
public MultipleAlignmentImpl()
Default Constructor. Empty alignment. No structures assigned.
-
MultipleAlignmentImpl
public MultipleAlignmentImpl(MultipleAlignmentEnsemble ensemble)
Constructor linking to an existing ensemble. Automatically adds this alignment to the parent ensemble.- Parameters:
ensemble- parent MultipleAlignmentEnsemble.
-
MultipleAlignmentImpl
public MultipleAlignmentImpl(MultipleAlignmentImpl ma)
Copy constructor. Recursively copies member BlockSets.- Parameters:
ma- MultipleAlignmentImpl to copy.
-
-
Method Detail
-
clear
public void clear()
Description copied from class:AbstractScoresCacheClear the cached scores. This frees memory after the alignment changed.- Specified by:
clearin interfaceMultipleAlignment- Overrides:
clearin classAbstractScoresCache
-
clone
public MultipleAlignmentImpl clone()
Description copied from interface:MultipleAlignmentCreates and returns an identical copy of this alignment, including a deep copy of all constituent BlockSets.- Specified by:
clonein interfaceMultipleAlignment- Overrides:
clonein classObject- Returns:
- MultipleAlignment identical copy of this object.
-
toString
public String toString()
Description copied from interface:MultipleAlignmentReturn 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:
toStringin interfaceMultipleAlignment- Overrides:
toStringin classObject- Returns:
- String header summary of the MultipleAlignment
-
getBlockSets
public List<BlockSet> getBlockSets()
Description copied from interface:MultipleAlignmentReturns the BlockSet List of the multiple structure alignment. Initializes the variable if it is null.- Specified by:
getBlockSetsin interfaceMultipleAlignment- Returns:
- List of BlockSets that describe the aligned residues of all the structures.
- See Also:
MultipleAlignment.getBlocks(),MultipleAlignment.setBlockSets(List)
-
getBlocks
public List<Block> getBlocks()
Description copied from interface:MultipleAlignmentConvenience 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:
getBlocksin interfaceMultipleAlignment- Returns:
- List of Blocks
- See Also:
MultipleAlignment.getBlockSets()
-
setBlockSets
public void setBlockSets(List<BlockSet> blockSets)
Description copied from interface:MultipleAlignmentSets the List of BlockSet List of the specified alignment.- Specified by:
setBlockSetsin interfaceMultipleAlignment- Parameters:
blockSets- the List of BlockSets that describe the aligned residues.- See Also:
MultipleAlignment.getBlockSets()
-
getBlockSet
public BlockSet getBlockSet(int index)
Description copied from interface:MultipleAlignmentReturns 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:
getBlockSetin interfaceMultipleAlignment- Parameters:
index- of the BlockSet- Returns:
- BlockSets at the specified index
- See Also:
MultipleAlignment.getBlocks(),MultipleAlignment.getBlockSets()
-
getBlock
public Block getBlock(int index)
Description copied from interface:MultipleAlignmentReturns 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:
getBlockin interfaceMultipleAlignment- Parameters:
index- of the BlockSet- Returns:
- Block at the specified index
- See Also:
MultipleAlignment.getBlocks(),MultipleAlignment.getBlockSets()
-
getAtomArrays
public List<Atom[]> getAtomArrays()
Description copied from interface:MultipleAlignmentReturns 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:
getAtomArraysin interfaceMultipleAlignment- Returns:
- List of Atom arrays
- See Also:
MultipleAlignment.getEnsemble()
-
getStructureIdentifier
public StructureIdentifier getStructureIdentifier(int index)
Description copied from interface:MultipleAlignmentReturns 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:
getStructureIdentifierin interfaceMultipleAlignment- Returns:
- StructureIdentifier
- See Also:
MultipleAlignment.getEnsemble()
-
size
public int size()
Description copied from interface:MultipleAlignmentReturns the number of aligned structures in the MultipleAlignment.- Specified by:
sizein interfaceMultipleAlignment- Returns:
- int number of aligned structures
- See Also:
MultipleAlignment.length(),MultipleAlignment.getCoreLength()
-
length
public int length()
Description copied from interface:MultipleAlignmentReturns the total number of aligned residues (columns) in the multiple alignment: the sum of all BlockSet lengths.- Specified by:
lengthin interfaceMultipleAlignment- Returns:
- int the total number of aligned residues in the alignment.
- See Also:
MultipleAlignment.getCoreLength(),MultipleAlignment.size()
-
getCoreLength
public int getCoreLength()
Description copied from interface:MultipleAlignmentReturns the number of aligned residues (columns) without gaps in the alignment: the sum of all BlockSet core lengths.- Specified by:
getCoreLengthin interfaceMultipleAlignment- Returns:
- int the total number of aligned residues.
- See Also:
MultipleAlignment.length(),MultipleAlignment.size()
-
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
public MultipleAlignmentEnsemble getEnsemble()
Description copied from interface:MultipleAlignmentReturns the parent Ensemble of the MultipleAlignment. Returns null if there is no referenced object.- Specified by:
getEnsemblein interfaceMultipleAlignment- Returns:
- MultipleAlignmentEnsemble the parent MultipleAlignment of the BlockSet, or null.
- See Also:
MultipleAlignment.setEnsemble(MultipleAlignmentEnsemble)
-
setEnsemble
public void setEnsemble(MultipleAlignmentEnsemble parent)
Description copied from interface:MultipleAlignmentSet 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:
setEnsemblein interfaceMultipleAlignment- Parameters:
parent- the parent MultipleAlignmentEnsemble.- See Also:
MultipleAlignment.getEnsemble()
-
getAlignResCounts
public List<Integer> getAlignResCounts()
Description copied from interface:MultipleAlignmentReturns the number of non null positions (residues) of each structure in the alignment. The values can be used to compute the coverages.- Specified by:
getAlignResCountsin interfaceMultipleAlignment- Returns:
- List of residue counts for each structure
-
getCoverages
public List<Double> getCoverages()
Description copied from interface:MultipleAlignmentReturns the coverage of the alignment for each structure in the alignment as a fraction between 0.0 and 1.0.- Specified by:
getCoveragesin interfaceMultipleAlignment- Returns:
- List coverage for each structure
-
-