From be47cdd2406f63ccb1fcf424194e82302dfc9360 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 22 Dec 2015 09:14:08 +0000 Subject: [PATCH] JAL-653 AlignedCodonFrame collections changed from Set to List --- src/jalview/analysis/AlignmentUtils.java | 68 +++++++++++------- src/jalview/gui/SplitFrame.java | 10 --- src/jalview/util/MappingUtils.java | 49 +++++++------ test/jalview/analysis/AlignmentUtilsTests.java | 74 +++++++++++++++----- .../structure/StructureSelectionManagerTest.java | 32 ++++----- test/jalview/util/MappingUtilsTest.java | 27 +++---- 6 files changed, 155 insertions(+), 105 deletions(-) diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 719dbfb..0e30d8c 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -45,7 +45,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -338,12 +337,12 @@ public class AlignmentUtils * Answers true if the mappings include one between the given (dataset) * sequences. */ - public static boolean mappingExists(Set set, + public static boolean mappingExists(List mappings, SequenceI aaSeq, SequenceI cdnaSeq) { - if (set != null) + if (mappings != null) { - for (AlignedCodonFrame acf : set) + for (AlignedCodonFrame acf : mappings) { if (cdnaSeq == acf.getDnaForAaSeq(aaSeq)) { @@ -514,8 +513,8 @@ public class AlignmentUtils /* * Locate the aligned source sequence whose dataset sequence is mapped. We - * just take the first match here (as we can't align cDNA like more than one - * protein sequence). + * just take the first match here (as we can't align like more than one + * sequence). */ SequenceI alignFrom = null; AlignedCodonFrame mapping = null; @@ -541,8 +540,8 @@ public class AlignmentUtils /** * Align sequence 'alignTo' the same way as 'alignFrom', using the mapping to * match residues and codons. Flags control whether existing gaps in unmapped - * (intron) and mapped (exon) regions are preserved or not. Gaps linking intro - * and exon are only retained if both flags are set. + * (intron) and mapped (exon) regions are preserved or not. Gaps between + * intron and exon are only retained if both flags are set. * * @param alignTo * @param alignFrom @@ -558,9 +557,6 @@ public class AlignmentUtils boolean preserveUnmappedGaps) { // TODO generalise to work for Protein-Protein, dna-dna, dna-protein - final char[] thisSeq = alignTo.getSequence(); - final char[] thatAligned = alignFrom.getSequence(); - StringBuilder thisAligned = new StringBuilder(2 * thisSeq.length); // aligned and dataset sequence positions, all base zero int thisSeqPos = 0; @@ -570,13 +566,17 @@ public class AlignmentUtils char myGapChar = myGap.charAt(0); int ratio = myGap.length(); - /* - * Traverse the aligned protein sequence. - */ int fromOffset = alignFrom.getStart() - 1; int toOffset = alignTo.getStart() - 1; int sourceGapMappedLength = 0; boolean inExon = false; + final char[] thisSeq = alignTo.getSequence(); + final char[] thatAligned = alignFrom.getSequence(); + StringBuilder thisAligned = new StringBuilder(2 * thisSeq.length); + + /* + * Traverse the 'model' aligned sequence + */ for (char sourceChar : thatAligned) { if (sourceChar == sourceGap) @@ -586,7 +586,7 @@ public class AlignmentUtils } /* - * Found a residue. Locate its mapped codon (start) position. + * Found a non-gap character. Locate its mapped region if any. */ sourceDsPos++; // Note mapping positions are base 1, our sequence positions base 0 @@ -595,11 +595,13 @@ public class AlignmentUtils if (mappedPos == null) { /* - * Abort realignment if unmapped protein. Or could ignore it?? + * unmapped position; treat like a gap */ - System.err.println("Can't align: no codon mapping to residue " - + sourceDsPos + "(" + sourceChar + ")"); - return; + sourceGapMappedLength += ratio; + // System.err.println("Can't align: no codon mapping to residue " + // + sourceDsPos + "(" + sourceChar + ")"); + // return; + continue; } int mappedCodonStart = mappedPos[0]; // position (1...) of codon start @@ -669,8 +671,8 @@ public class AlignmentUtils } /* - * At end of protein sequence. Copy any remaining dna sequence, optionally - * including (intron) gaps. We do not copy trailing gaps in protein. + * At end of model aligned sequence. Copy any remaining target sequence, optionally + * including (intron) gaps. */ while (thisSeqPos < thisSeq.length) { @@ -679,6 +681,20 @@ public class AlignmentUtils { thisAligned.append(c); } + sourceGapMappedLength--; + } + + /* + * finally add gaps to pad for any trailing source gaps or + * unmapped characters + */ + if (preserveUnmappedGaps) + { + while (sourceGapMappedLength > 0) + { + thisAligned.append(myGapChar); + sourceGapMappedLength--; + } } /* @@ -909,7 +925,7 @@ public class AlignmentUtils List unmappedProtein = new ArrayList(); unmappedProtein.addAll(protein.getSequences()); - Set mappings = protein.getCodonFrames(); + List mappings = protein.getCodonFrames(); /* * Map will hold, for each aligned codon position e.g. [3, 5, 6], a map of @@ -1048,7 +1064,7 @@ public class AlignmentUtils } AlignmentI dna = al1.isNucleotide() ? al1 : al2; AlignmentI protein = dna == al1 ? al2 : al1; - Set mappings = protein.getCodonFrames(); + List mappings = protein.getCodonFrames(); for (SequenceI dnaSeq : dna.getSequences()) { for (SequenceI proteinSeq : protein.getSequences()) @@ -1072,7 +1088,7 @@ public class AlignmentUtils * @return */ protected static boolean isMappable(SequenceI dnaSeq, - SequenceI proteinSeq, Set mappings) + SequenceI proteinSeq, List mappings) { if (dnaSeq == null || proteinSeq == null) { @@ -1312,9 +1328,9 @@ public class AlignmentUtils * sequences (or null if no exons are found) */ public static AlignmentI makeExonAlignment(SequenceI[] dna, - Set mappings) + List mappings) { - Set newMappings = new LinkedHashSet(); + List newMappings = new ArrayList(); List exonSequences = new ArrayList(); for (SequenceI dnaSeq : dna) diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index 3a6d266..083c7ec 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -38,15 +38,12 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.beans.PropertyVetoException; import java.util.Map.Entry; -import java.util.Set; import javax.swing.AbstractAction; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.KeyStroke; -import javax.swing.UIDefaults; -import javax.swing.UIManager; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; @@ -89,13 +86,6 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI * estimate width and height of SplitFrame; this.getInsets() doesn't seem to * give the full additional size (a few pixels short) */ - UIDefaults defaults = UIManager.getDefaults(); - Set keySet = defaults.keySet(); - for (Object key : keySet) - { - System.out.println(key.toString() + " = " - + UIManager.get(key).toString()); - } int widthFudge = Platform.isAMac() ? 28 : 28; // Windows tbc int heightFudge = Platform.isAMac() ? 50 : 50; // tbc int width = ((AlignFrame) getTopFrame()).getWidth() + widthFudge; diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java index 11597eb..22714b8 100644 --- a/src/jalview/util/MappingUtils.java +++ b/src/jalview/util/MappingUtils.java @@ -38,12 +38,11 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import java.util.ArrayList; -import java.util.Collections; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; /** * Helper methods for manipulations involving sequence mappings. @@ -69,7 +68,7 @@ public final class MappingUtils */ protected static void mapCutOrPaste(Edit edit, boolean undo, List targetSeqs, EditCommand result, - Set mappings) + List mappings) { Action action = edit.getAction(); if (undo) @@ -93,7 +92,7 @@ public final class MappingUtils */ public static EditCommand mapEditCommand(EditCommand command, boolean undo, final AlignmentI mapTo, char gapChar, - Set mappings) + List mappings) { /* * For now, only support mapping from protein edits to cDna @@ -165,7 +164,7 @@ public final class MappingUtils Map originalSequences, final List targetSeqs, Map targetCopies, char gapChar, - EditCommand result, Set mappings) + EditCommand result, List mappings) { Action action = edit.getAction(); @@ -268,7 +267,7 @@ public final class MappingUtils * @return */ public static SearchResults buildSearchResults(SequenceI seq, int index, - Set seqmappings) + List seqmappings) { SearchResults results = new SearchResults(); addSearchResults(results, seq, index, seqmappings); @@ -285,7 +284,7 @@ public final class MappingUtils * @param seqmappings */ public static void addSearchResults(SearchResults results, SequenceI seq, - int index, Set seqmappings) + int index, List seqmappings) { if (index >= seq.getStart() && index <= seq.getEnd()) { @@ -314,7 +313,7 @@ public final class MappingUtils */ boolean targetIsNucleotide = mapTo.isNucleotide(); AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo; - Set codonFrames = protein.getAlignment() + List codonFrames = protein.getAlignment() .getCodonFrames(); /* * Copy group name, colours etc, but not sequences or sequence colour scheme @@ -375,15 +374,15 @@ public final class MappingUtils /* * Found a sequence mapping. Locate the start/end mapped residues. */ + List mapping = Arrays.asList(new AlignedCodonFrame[] { acf }); SearchResults sr = buildSearchResults(selected, - startResiduePos, Collections.singleton(acf)); + startResiduePos, mapping); for (Match m : sr.getResults()) { mappedStartResidue = m.getStart(); mappedEndResidue = m.getEnd(); } - sr = buildSearchResults(selected, endResiduePos, - Collections.singleton(acf)); + sr = buildSearchResults(selected, endResiduePos, mapping); for (Match m : sr.getResults()) { mappedStartResidue = Math.min(mappedStartResidue, @@ -428,7 +427,7 @@ public final class MappingUtils * @return */ public static CommandI mapOrderCommand(OrderCommand command, - boolean undo, AlignmentI mapTo, Set mappings) + boolean undo, AlignmentI mapTo, List mappings) { SequenceI[] sortOrder = command.getSequenceOrder(undo); List mappedOrder = new ArrayList(); @@ -512,7 +511,7 @@ public final class MappingUtils { boolean targetIsNucleotide = mapTo.isNucleotide(); AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo; - Set codonFrames = protein.getAlignment() + List codonFrames = protein.getAlignment() .getCodonFrames(); ColumnSelection mappedColumns = new ColumnSelection(); @@ -594,8 +593,8 @@ public final class MappingUtils } /** - * Returns the mapped codon for a given aligned sequence column position (base - * 0). + * Returns the mapped codon or codons for a given aligned sequence column + * position (base 0). * * @param seq * an aligned peptide sequence @@ -603,21 +602,27 @@ public final class MappingUtils * an aligned column position (base 0) * @param mappings * a set of codon mappings - * @return the bases of the mapped codon in the cDNA dataset sequence, or null - * if not found + * @return the bases of the mapped codon(s) in the cDNA dataset sequence(s), + * or an empty list if none found */ - public static char[] findCodonFor(SequenceI seq, int col, - Set mappings) + public static List findCodonsFor(SequenceI seq, int col, + List mappings) { + List result = new ArrayList(); int dsPos = seq.findPosition(col); for (AlignedCodonFrame mapping : mappings) { if (mapping.involvesSequence(seq)) { - return mapping.getMappedCodon(seq.getDatasetSequence(), dsPos); + List codons = mapping.getMappedCodons( + seq.getDatasetSequence(), dsPos); + if (codons != null) + { + result.addAll(codons); + } } } - return null; + return result; } /** @@ -663,7 +668,7 @@ public final class MappingUtils * @return */ public static List findMappingsForSequence( - SequenceI sequence, Set mappings) + SequenceI sequence, List mappings) { List result = new ArrayList(); if (sequence == null || mappings == null) diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 84b9817..dd99bc2 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -45,10 +45,8 @@ import jalview.util.MappingUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -439,7 +437,6 @@ public class AlignmentUtilsTests @Test(groups = { "Functional" }) public void testAlignSequenceAs_withMapping_withUnmappedProtein() { - /* * Exons at codon 2 (AAA) and 4 (TTT) mapped to A and P */ @@ -450,35 +447,37 @@ public class AlignmentUtilsTests * Expect alignment does nothing (aborts realignment). Change this test * first if different behaviour wanted. */ - checkAlignSequenceAs("GGGAAACCCTTTGGG", "-A-L-P-", false, false, map, - "GGGAAACCCTTTGGG"); + checkAlignSequenceAs("gggAAAcccTTTggg", "-A-L-P-", false, false, map, + "gggAAAccc---TTTggg"); } /** * Helper method that performs and verifies the method under test. * - * @param dnaSeq - * @param proteinSeq + * @param alignee + * the sequence to be realigned + * @param alignModel + * the sequence whose alignment is to be copied * @param preserveMappedGaps * @param preserveUnmappedGaps * @param map * @param expected */ - protected void checkAlignSequenceAs(final String dnaSeq, - final String proteinSeq, final boolean preserveMappedGaps, + protected void checkAlignSequenceAs(final String alignee, + final String alignModel, final boolean preserveMappedGaps, final boolean preserveUnmappedGaps, MapList map, final String expected) { - SequenceI dna = new Sequence("Seq1", dnaSeq); - dna.createDatasetSequence(); - SequenceI protein = new Sequence("Seq1", proteinSeq); - protein.createDatasetSequence(); + SequenceI alignMe = new Sequence("Seq1", alignee); + alignMe.createDatasetSequence(); + SequenceI alignFrom = new Sequence("Seq2", alignModel); + alignFrom.createDatasetSequence(); AlignedCodonFrame acf = new AlignedCodonFrame(); - acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map); + acf.addMap(alignMe.getDatasetSequence(), alignFrom.getDatasetSequence(), map); - AlignmentUtils.alignSequenceAs(dna, protein, acf, "---", '-', + AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "---", '-', preserveMappedGaps, preserveUnmappedGaps); - assertEquals(expected, dna.getSequenceAsString()); + assertEquals(expected, alignMe.getSequenceAsString()); } /** @@ -550,7 +549,7 @@ public class AlignmentUtilsTests acf.addMap(dna1.getDatasetSequence(), prot1.getDatasetSequence(), map); acf.addMap(dna2.getDatasetSequence(), prot2.getDatasetSequence(), map); acf.addMap(dna3.getDatasetSequence(), prot3.getDatasetSequence(), map); - protein.setCodonFrames(Collections.singleton(acf)); + protein.setCodonFrames(new ArrayList()); /* * Translated codon order is [1,2,3] [1,3,4] [4,5,6] [4,5,7] [5,6,7] [7,8,9] @@ -1014,7 +1013,7 @@ public class AlignmentUtilsTests pep1.createDatasetSequence(); pep2.createDatasetSequence(); - Set mappings = new HashSet(); + List mappings = new ArrayList(); MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 2 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); @@ -1159,7 +1158,7 @@ public class AlignmentUtilsTests * convenience so results are in the input order. There is no assertion that * the generated exon sequences are in any particular order. */ - Set mappings = new LinkedHashSet(); + List mappings = new ArrayList(); // map ...GGG...TTT to GF MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 2 }, 3, 1); @@ -1303,4 +1302,41 @@ public class AlignmentUtilsTests assertEquals(40, map.getFromLowest()); assertEquals(48, map.getFromHighest()); } + + /** + * Test for the alignSequenceAs method where we have protein mapped to protein + */ + @Test(groups = { "Functional" }) + public void testAlignSequenceAs_mappedProteinProtein() + { + + SequenceI alignMe = new Sequence("Match", "MGAASEV"); + alignMe.createDatasetSequence(); + SequenceI alignFrom = new Sequence("Query", "LQTGYMGAASEVMFSPTRR"); + alignFrom.createDatasetSequence(); + + AlignedCodonFrame acf = new AlignedCodonFrame(); + // this is like a domain or motif match of part of a peptide sequence + MapList map = new MapList(new int[] { 6, 12 }, new int[] { 1, 7 }, 1, 1); + acf.addMap(alignFrom.getDatasetSequence(), + alignMe.getDatasetSequence(), map); + + AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "-", '-', true, + true); + assertEquals("-----MGAASEV-------", alignMe.getSequenceAsString()); + } + + /** + * Test for the alignSequenceAs method where there are trailing unmapped + * residues in the model sequence + */ + @Test(groups = { "Functional" }) + public void testAlignSequenceAs_withTrailingPeptide() + { + // map first 3 codons to KPF; G is a trailing unmapped residue + MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1); + + checkAlignSequenceAs("AAACCCTTT", "K-PFG", true, true, map, + "AAA---CCCTTT---"); + } } diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index e9fa336..ddee3ac 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -29,8 +29,8 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.io.FormatAdapter; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -54,21 +54,21 @@ public class StructureSelectionManagerTest AlignedCodonFrame acf2 = new AlignedCodonFrame(); ssm.registerMapping(acf1); - assertEquals(1, ssm.seqmappings.size()); - assertTrue(ssm.seqmappings.contains(acf1)); + assertEquals(1, ssm.getSequenceMappings().size()); + assertTrue(ssm.getSequenceMappings().contains(acf1)); ssm.registerMapping(acf2); - assertEquals(2, ssm.seqmappings.size()); - assertTrue(ssm.seqmappings.contains(acf1)); - assertTrue(ssm.seqmappings.contains(acf2)); + assertEquals(2, ssm.getSequenceMappings().size()); + assertTrue(ssm.getSequenceMappings().contains(acf1)); + assertTrue(ssm.getSequenceMappings().contains(acf2)); /* * Re-adding the first mapping does nothing */ ssm.registerMapping(acf1); - assertEquals(2, ssm.seqmappings.size()); - assertTrue(ssm.seqmappings.contains(acf1)); - assertTrue(ssm.seqmappings.contains(acf2)); + assertEquals(2, ssm.getSequenceMappings().size()); + assertTrue(ssm.getSequenceMappings().contains(acf1)); + assertTrue(ssm.getSequenceMappings().contains(acf2)); } @Test(groups = { "Functional" }) @@ -78,10 +78,10 @@ public class StructureSelectionManagerTest AlignedCodonFrame acf2 = new AlignedCodonFrame(); AlignedCodonFrame acf3 = new AlignedCodonFrame(); - Set set1 = new HashSet(); + List set1 = new ArrayList(); set1.add(acf1); set1.add(acf2); - Set set2 = new HashSet(); + List set2 = new ArrayList(); set2.add(acf2); set2.add(acf3); @@ -93,10 +93,10 @@ public class StructureSelectionManagerTest ssm.registerMappings(set2); ssm.registerMappings(set2); - assertEquals(3, ssm.seqmappings.size()); - assertTrue(ssm.seqmappings.contains(acf1)); - assertTrue(ssm.seqmappings.contains(acf2)); - assertTrue(ssm.seqmappings.contains(acf3)); + assertEquals(3, ssm.getSequenceMappings().size()); + assertTrue(ssm.getSequenceMappings().contains(acf1)); + assertTrue(ssm.getSequenceMappings().contains(acf2)); + assertTrue(ssm.getSequenceMappings().contains(acf3)); } /** diff --git a/test/jalview/util/MappingUtilsTest.java b/test/jalview/util/MappingUtilsTest.java index 758694a..b3a1d8a 100644 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@ -43,12 +43,9 @@ import jalview.io.FormatAdapter; import java.awt.Color; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; import org.testng.annotations.Test; @@ -77,7 +74,8 @@ public class MappingUtilsTest MapList map = new MapList(new int[] { 5, 10 }, new int[] { 12, 13 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); /* * Check protein residue 12 maps to codon 5-7, 13 to codon 8-10 @@ -129,7 +127,8 @@ public class MappingUtilsTest MapList map = new MapList(new int[] { 6, 6, 8, 9, 11, 11, 13, 13, 15, 15 }, new int[] { 8, 9 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); /* * Check protein residue 8 maps to [6, 8, 9] @@ -209,7 +208,8 @@ public class MappingUtilsTest acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein .getSequenceAt(seq).getDatasetSequence(), map); } - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); AlignViewportI dnaView = new AlignViewport(cdna); AlignViewportI proteinView = new AlignViewport(protein); @@ -373,7 +373,8 @@ public class MappingUtilsTest 61 }, 3, 1); acf.addMap(cdna.getSequenceAt(2).getDatasetSequence(), protein .getSequenceAt(2).getDatasetSequence(), map); - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); dnaView = new AlignViewport(cdna); proteinView = new AlignViewport(protein); @@ -474,7 +475,8 @@ public class MappingUtilsTest acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein .getSequenceAt(seq).getDatasetSequence(), map); } - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); AlignViewportI dnaView = new AlignViewport(cdna); AlignViewportI proteinView = new AlignViewport(protein); @@ -556,7 +558,8 @@ public class MappingUtilsTest acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein .getSequenceAt(seq).getDatasetSequence(), map); } - Set acfList = Collections.singleton(acf); + List acfList = Arrays.asList(new AlignedCodonFrame[] + { acf }); AlignViewportI dnaView = new AlignViewport(cdna); AlignViewportI proteinView = new AlignViewport(protein); @@ -651,7 +654,7 @@ public class MappingUtilsTest AlignedCodonFrame acf3 = new AlignedCodonFrame(); acf3.addMap(seq3.getDatasetSequence(), seq1.getDatasetSequence(), map); - Set mappings = new HashSet(); + List mappings = new ArrayList(); mappings.add(acf1); mappings.add(acf2); mappings.add(acf3); @@ -707,7 +710,7 @@ public class MappingUtilsTest AlignedCodonFrame acf = new AlignedCodonFrame(); MapList map = new MapList(new int[] { 8, 16 }, new int[] { 5, 7 }, 3, 1); acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map); - Set mappings = new LinkedHashSet(); + List mappings = new ArrayList(); mappings.add(acf); AlignmentI prot = new Alignment(new SequenceI[] { protein }); -- 1.7.10.2