Class BlockImpl
- java.lang.Object
-
- org.biojava.nbio.structure.align.multiple.AbstractScoresCache
-
- org.biojava.nbio.structure.align.multiple.BlockImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Block
,ScoresCache
public class BlockImpl extends AbstractScoresCache implements Serializable, Block, Cloneable
General implementation of aBlock
that supports any type of sequential alignment with gaps.- Since:
- 4.1.0
- Author:
- Aleix Lafita
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the cached scores.Block
clone()
Creates and returns an identical copy of this block.List<List<Integer>>
getAlignRes()
Returns the double List containing the aligned residues for each structure.List<Integer>
getAlignResCounts()
Returns the number of non null positions (residues) of each structure in the alignment Block.BlockSet
getBlockSet()
Returns the parent BlockSet of the Block.int
getCoreLength()
Returns the number of aligned positions (columns) without gaps in the Block.int
getFinalIndex(int str)
Calculates and returns the last position of the specified structure in the alignment that is not null.int
getFinalResidue(int str)
Calculates and returns the last residue of the specified structure in the alignment that is not null.int
getStartIndex(int str)
Calculates and returns the first position of the specified structure in the alignment that is not null.int
getStartResidue(int str)
Calculates and returns the first residue of the specified structure in the alignment that is not null.int
length()
Returns the total number of aligned positions (columns) in the Block.void
setAlignRes(List<List<Integer>> alignRes)
Set the double List containing the aligned residues for each structure.void
setBlockSet(BlockSet parent)
Set the back-reference to its parent BlockSet.int
size()
Returns the number of aligned structures (rows) in the Block.String
toString()
protected void
updateCoreLength()
-
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
-
-
-
-
Method Detail
-
clone
public Block clone()
Description copied from interface:Block
Creates and returns an identical copy of this block.
-
clear
public void clear()
Description copied from class:AbstractScoresCache
Clear the cached scores. This frees memory after the alignment changed.- Specified by:
clear
in interfaceBlock
- Overrides:
clear
in classAbstractScoresCache
-
setBlockSet
public void setBlockSet(BlockSet parent)
Description copied from interface:Block
Set the back-reference to its parent BlockSet.- Specified by:
setBlockSet
in interfaceBlock
- Parameters:
parent
- the parent BlockSet.- See Also:
Block.getBlockSet()
-
getBlockSet
public BlockSet getBlockSet()
Description copied from interface:Block
Returns the parent BlockSet of the Block. Returns null if there is no referenced object.- Specified by:
getBlockSet
in interfaceBlock
- Returns:
- BlockSet the parent BlockSet of the Block, or null.
- See Also:
Block.setBlockSet(BlockSet)
-
getAlignRes
public List<List<Integer>> getAlignRes()
Description copied from interface:Block
Returns the double List containing the aligned residues for each structure.alignRes.get(structure).get(residue) = alignRes.get(size).get(length).
- Specified by:
getAlignRes
in interfaceBlock
- Returns:
- List a double List of aligned residues for each structure.
- See Also:
#setAlignRes()
-
setAlignRes
public void setAlignRes(List<List<Integer>> alignRes)
Description copied from interface:Block
Set the double List containing the aligned residues for each structure.- Specified by:
setAlignRes
in interfaceBlock
- Parameters:
alignRes
- a double List of Integers with the aligned residues.- See Also:
Block.getAlignRes()
-
length
public int length()
Description copied from interface:Block
Returns the total number of aligned positions (columns) in the Block.- Specified by:
length
in interfaceBlock
- Returns:
- int number of aligned residues.
- See Also:
Block.size()
-
size
public int size()
Description copied from interface:Block
Returns the number of aligned structures (rows) in the Block.- Specified by:
size
in interfaceBlock
- Returns:
- int number of aligned structures.
- See Also:
Block.length()
,Block.getCoreLength()
-
getCoreLength
public int getCoreLength()
Description copied from interface:Block
Returns the number of aligned positions (columns) without gaps in the Block.- Specified by:
getCoreLength
in interfaceBlock
- Returns:
- int number of aligned residues.
- See Also:
#updateCoreLength()
,Block.length()
,Block.size()
-
updateCoreLength
protected void updateCoreLength()
-
getStartIndex
public int getStartIndex(int str)
Description copied from interface:Block
Calculates and returns the first position of the specified structure in the alignment that is not null. This will return the aligment index, not the reisude aligned in that position.- Specified by:
getStartIndex
in interfaceBlock
- Parameters:
str
- structure index- Returns:
- the first non null aligned position of the structure
-
getStartResidue
public int getStartResidue(int str)
Description copied from interface:Block
Calculates and returns the first residue of the specified structure in the alignment that is not null. This will return the aligned residue, not the alignment index.- Specified by:
getStartResidue
in interfaceBlock
- Parameters:
str
- structure index- Returns:
- the first non null aligned residue of the structure
-
getFinalIndex
public int getFinalIndex(int str)
Description copied from interface:Block
Calculates and returns the last position of the specified structure in the alignment that is not null. This will return the aligment index, not the reisude aligned in that position.- Specified by:
getFinalIndex
in interfaceBlock
- Parameters:
str
- structure index- Returns:
- the last non null aligned position of the structure
-
getFinalResidue
public int getFinalResidue(int str)
Description copied from interface:Block
Calculates and returns the last residue of the specified structure in the alignment that is not null. This will return the aligned residue, not the alignment index.- Specified by:
getFinalResidue
in interfaceBlock
- Parameters:
str
- structure index- Returns:
- the last non null aligned residue of the structure
-
getAlignResCounts
public List<Integer> getAlignResCounts()
Description copied from interface:Block
Returns the number of non null positions (residues) of each structure in the alignment Block. The values can be used to compute the coverages.- Specified by:
getAlignResCounts
in interfaceBlock
- Returns:
- List of residue counts for each structure
-
-