X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;fp=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=4057773aefccaff82cce16f2c15012d22debcce2;hb=b8810711642d8473325c8a3d3e76cc5c3c9b5bbd;hp=b2d4f0fd652b175730375b2d6340cc54baf875bb;hpb=936d4dc095734df2b1e9f3bf9e0bd29b9c86434c;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index b2d4f0f..4057773 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -147,7 +147,9 @@ public class Alignment implements AlignmentI public SequenceI[] getSequencesArray() { if (sequences == null) + { return null; + } synchronized (sequences) { return sequences.toArray(new SequenceI[sequences.size()]); @@ -211,7 +213,9 @@ public class Alignment implements AlignmentI } } if (hiddenSequences != null) + { hiddenSequences.adjustHeightSequenceAdded(); + } } /** @@ -245,7 +249,9 @@ public class Alignment implements AlignmentI public void finalize() { if (getDataset() != null) + { getDataset().removeAlignmentRef(); + } dataset = null; sequences = null; @@ -754,7 +760,9 @@ public class Alignment implements AlignmentI continue; } if (tIndex < temp.length) + { temp[tIndex++] = annotations[i]; + } } if (swap) @@ -950,6 +958,27 @@ public class Alignment implements AlignmentI else if (dataset == null && data != null) { dataset = data; + for (int i = 0; i < getHeight(); i++) + { + SequenceI currentSeq = getSequenceAt(i); + SequenceI dsq = currentSeq.getDatasetSequence(); + if (dsq == null) + { + dsq = currentSeq.createDatasetSequence(); + dataset.addSequence(dsq); + } + else + { + while (dsq.getDatasetSequence() != null) + { + dsq = dsq.getDatasetSequence(); + } + if (dataset.findIndex(dsq) == -1) + { + dataset.addSequence(dsq); + } + } + } } dataset.addAlignmentRef(); } @@ -1150,7 +1179,9 @@ public class Alignment implements AlignmentI public void setProperty(Object key, Object value) { if (alignmentProperties == null) + { alignmentProperties = new Hashtable(); + } alignmentProperties.put(key, value); } @@ -1159,9 +1190,13 @@ public class Alignment implements AlignmentI public Object getProperty(Object key) { if (alignmentProperties != null) + { return alignmentProperties.get(key); + } else + { return null; + } } @Override @@ -1183,7 +1218,9 @@ public class Alignment implements AlignmentI public void addCodonFrame(AlignedCodonFrame codons) { if (codons == null) + { return; + } if (codonFrameList == null) { codonFrameList = new AlignedCodonFrame[] @@ -1217,15 +1254,21 @@ public class Alignment implements AlignmentI public AlignedCodonFrame[] getCodonFrame(SequenceI seq) { if (seq == null || codonFrameList == null) + { return null; + } Vector cframes = new Vector(); for (int f = 0; f < codonFrameList.length; f++) { if (codonFrameList[f].involvesSequence(seq)) + { cframes.addElement(codonFrameList[f]); + } } if (cframes.size() == 0) + { return null; + } AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()]; cframes.copyInto(cfr); return cfr; @@ -1252,7 +1295,9 @@ public class Alignment implements AlignmentI public boolean removeCodonFrame(AlignedCodonFrame codons) { if (codons == null || codonFrameList == null) + { return false; + } boolean removed = false; int i = 0, iSize = codonFrameList.length; while (i < iSize)