package jalview.datamodel;
import jalview.analysis.AlignmentUtils;
+import jalview.analysis.Conservation;
import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.io.FastaFile;
import jalview.util.Comparison;
* @author JimP
*
*/
-public class Alignment implements AlignmentI
+public class Alignment implements AlignmentI, AutoCloseable
{
private Alignment dataset;
private List<AlignedCodonFrame> codonFrameList;
+ private Conservation conservation;
+
+ private ProfilesI consensus;
+
+ private Hashtable[] codonConsensus, rnaStructureConsensus;
+
private void initAlignment(SequenceI[] seqs)
{
groups = Collections.synchronizedList(new ArrayList<SequenceGroup>());
{
synchronized (sequences)
{
+
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
}
@Override
- public void finalize() throws Throwable
+ public void close()
{
if (getDataset() != null)
{
- getDataset().removeAlignmentRef();
+ try
+ {
+ getDataset().removeAlignmentRef();
+ } catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
}
nullReferences();
- super.finalize();
}
/**
int i = 0;
SequenceI sq = null;
String sqname = null;
+ int nseq = sequences.size();
if (startAfter != null)
{
// try to find the sequence in the alignment
boolean matched = false;
- while (i < sequences.size())
+ while (i < nseq)
{
if (getSequenceAt(i++) == startAfter)
{
i = 0;
}
}
- while (i < sequences.size())
+ while (i < nseq)
{
sq = getSequenceAt(i);
sqname = sq.getName();
public int getWidth()
{
int maxLength = -1;
-
+
for (int i = 0; i < sequences.size(); i++)
{
maxLength = Math.max(maxLength, getSequenceAt(i).getLength());
int maxLength = -1;
SequenceI current;
- for (int i = 0; i < sequences.size(); i++)
+ int nseq = sequences.size();
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
for (int j = current.getLength(); j > maxLength; j--)
maxLength++;
int cLength;
- for (int i = 0; i < sequences.size(); i++)
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
cLength = current.getLength();
}
}
+ @Override
+ public Hashtable[] getComplementConsensusHash()
+ {
+ return codonConsensus;
+ }
+
+ @Override
+ public Conservation getConservation()
+ {
+ return conservation;
+ }
+
+ @Override
+ public Hashtable[] getRnaStructureConsensusHash()
+ {
+ return rnaStructureConsensus;
+ }
+
+ @Override
+ public ProfilesI getSequenceConsensusHash()
+ {
+ return consensus;
+ }
+
+ @Override
+ public void setComplementConsensusHash(Hashtable[] hconsensus)
+ {
+ codonConsensus = hconsensus;
+
+ }
+
+ @Override
+ public void setConservation(Conservation cons)
+ {
+ conservation = cons;
+
+ }
+
+ @Override
+ public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+ {
+ rnaStructureConsensus = hStrucConsensus;
+
+ }
+
+ @Override
+ public void setSequenceConsensusHash(ProfilesI hconsensus)
+ {
+ consensus = hconsensus;
+
+ }
}