git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1270 test coverage TODO Alignment.append(AlignmentI)
[jalview.git]
/
src
/
jalview
/
datamodel
/
Alignment.java
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
f14539b
..
0ee0344
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-30,7
+30,6
@@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@
-45,7
+44,7
@@
import java.util.Vector;
*/
public class Alignment implements AlignmentI
{
*/
public class Alignment implements AlignmentI
{
- protected Alignment dataset;
+ private Alignment dataset;
protected List<SequenceI> sequences;
protected List<SequenceI> sequences;
@@
-110,7
+109,10
@@
public class Alignment implements AlignmentI
/*
* Share the same dataset sequence mappings (if any).
*/
/*
* Share the same dataset sequence mappings (if any).
*/
- this.setCodonFrames(al.getCodonFrames());
+ if (dataset == null && al.getDataset() == null)
+ {
+ this.setCodonFrames(al.getCodonFrames());
+ }
}
/**
}
/**
@@
-987,7
+989,7
@@
public class Alignment implements AlignmentI
}
@Override
}
@Override
- public void setDataset(Alignment data)
+ public void setDataset(AlignmentI data)
{
if (dataset == null && data == null)
{
{
if (dataset == null && data == null)
{
@@
-995,7
+997,12
@@
public class Alignment implements AlignmentI
}
else if (dataset == null && data != null)
{
}
else if (dataset == null && data != null)
{
- dataset = data;
+ if (!(data instanceof Alignment))
+ {
+ throw new Error(
+ "Implementation Error: jalview.datamodel.Alignment does not yet support other implementations of AlignmentI as its dataset reference");
+ }
+ dataset = (Alignment) data;
for (int i = 0; i < getHeight(); i++)
{
SequenceI currentSeq = getSequenceAt(i);
for (int i = 0; i < getHeight(); i++)
{
SequenceI currentSeq = getSequenceAt(i);
@@
-1288,22
+1295,6
@@
public class Alignment implements AlignmentI
}
}
}
}
- /**
- * adds a set of mappings (while ignoring any duplicates)
- */
- @Override
- public void addCodonFrames(Iterable<AlignedCodonFrame> codons)
- {
- if (codons != null)
- {
- Iterator<AlignedCodonFrame> it = codons.iterator();
- while (it.hasNext())
- {
- addCodonFrame(it.next());
- }
- }
- }
-
/*
* (non-Javadoc)
*
/*
* (non-Javadoc)
*
@@
-1357,6
+1348,10
@@
public class Alignment implements AlignmentI
@Override
public List<AlignedCodonFrame> getCodonFrames()
{
@Override
public List<AlignedCodonFrame> getCodonFrames()
{
+ // TODO: Fix this method to fix failing AlignedCodonFrame tests
+ // this behaviour is currently incorrect. method should return codon frames
+ // for just the alignment,
+ // selected from dataset
return dataset != null ? dataset.getCodonFrames() : codonFrameList;
}
return dataset != null ? dataset.getCodonFrames() : codonFrameList;
}
@@
-1382,7
+1377,7
@@
public class Alignment implements AlignmentI
{
System.err.println("Self append may cause a deadlock.");
}
{
System.err.println("Self append may cause a deadlock.");
}
- // TODO test this method for a future 2.5 release
+ // TODO JAL-1270 needs test coverage
// currently tested for use in jalview.gui.SequenceFetcher
boolean samegap = toappend.getGapCharacter() == getGapCharacter();
char oldc = toappend.getGapCharacter();
// currently tested for use in jalview.gui.SequenceFetcher
boolean samegap = toappend.getGapCharacter() == getGapCharacter();
char oldc = toappend.getGapCharacter();
@@
-1418,6
+1413,7
@@
public class Alignment implements AlignmentI
addAnnotation(alan[a]);
}
addAnnotation(alan[a]);
}
+ // use add method
getCodonFrames().addAll(toappend.getCodonFrames());
List<SequenceGroup> sg = toappend.getGroups();
getCodonFrames().addAll(toappend.getCodonFrames());
List<SequenceGroup> sg = toappend.getGroups();
@@
-1708,9
+1704,11
@@
public class Alignment implements AlignmentI
* Parameters control whether gaps in exon (mapped) and intron (unmapped)
* regions are preserved. Gaps that connect introns to exons are treated
* conservatively, i.e. only preserved if both intron and exon gaps are
* Parameters control whether gaps in exon (mapped) and intron (unmapped)
* regions are preserved. Gaps that connect introns to exons are treated
* conservatively, i.e. only preserved if both intron and exon gaps are
- * preserved.
+ * preserved. TODO: check caveats below where the implementation fails
*
* @param al
*
* @param al
+ * - must have same dataset, and sequences in al must have equivalent
+ * dataset sequence and start/end bounds under given mapping
* @param preserveMappedGaps
* if true, gaps within and between mapped codons are preserved
* @param preserveUnmappedGaps
* @param preserveMappedGaps
* if true, gaps within and between mapped codons are preserved
* @param preserveUnmappedGaps
@@
-1727,6
+1725,10
@@
public class Alignment implements AlignmentI
{
return AlignmentUtils.alignProteinAsDna(this, al);
}
{
return AlignmentUtils.alignProteinAsDna(this, al);
}
+ else if (thatIsProtein && thisIsNucleotide)
+ {
+ return AlignmentUtils.alignCdsAsProtein(this, al);
+ }
return AlignmentUtils.alignAs(this, al);
}
return AlignmentUtils.alignAs(this, al);
}