import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.io.AppletFormatAdapter;
import jalview.io.FormatAdapter;
import jalview.util.MapList;
}
}
}
+ // finally, verify codonmappings involve only dataset sequences.
+ if (alignment.getCodonFrames() != null)
+ {
+ for (AlignedCodonFrame alc : alignment.getCodonFrames())
+ {
+ for (SequenceToSequenceMapping ssm : alc.getMappings())
+ {
+ if (ssm.getFromSeq().getDatasetSequence() != null)
+ {
+ if (raiseAssert)
+ {
+ Assert.fail("CodonFrame-SSM-FromSeq is not a dataset sequence");
+ }
+ return false;
+ }
+ if (alignment.findIndex(ssm.getFromSeq()) == -1)
+ {
+
+ if (raiseAssert)
+ {
+ Assert.fail("CodonFrame-SSM-FromSeq is not contained in dataset");
+ }
+ return false;
+ }
+ if (ssm.getMapping().getTo().getDatasetSequence() != null)
+ {
+ if (raiseAssert)
+ {
+ Assert.fail("CodonFrame-SSM-Mapping-ToSeq is not a dataset sequence");
+ }
+ return false;
+ }
+ if (alignment.findIndex(ssm.getMapping().getTo()) == -1)
+ {
+
+ if (raiseAssert)
+ {
+ Assert.fail("CodonFrame-SSM-Mapping-ToSeq is not contained in dataset");
+ }
+ return false;
+ }
+ }
+ }
+ }
}
return true; // all relationships verified!
}
al,
false,
"verify passed when a dbref with map to sequence outside of dataset was added");
+ // make the verify pass by adding the outsider back in
+ al.getDataset().addSequence(sqout);
+ assertVerifyAlignment(al, true,
+ "verify should have passed after adding dbref->to sequence in to dataset");
+ // and now the same for a codon mapping...
+ SequenceI sqanotherout = new Sequence("sqanotherout",
+ "aggtutaggcagcagcag");
+
+ AlignedCodonFrame alc = new AlignedCodonFrame();
+ alc.addMap(sqanotherout, sqnew, new MapList(new int[] { 1, 6 },
+ new int[] { 1, 18 }, 3, 1));
+
+ al.addCodonFrame(alc);
+ Assert.assertEquals(al.getDataset().getCodonFrames().size(), 1);
+
+ assertVerifyAlignment(
+ al,
+ false,
+ "verify passed when alCodonFrame mapping to sequence outside of dataset was added");
+ // make the verify pass by adding the outsider back in
+ al.getDataset().addSequence(sqanotherout);
+ assertVerifyAlignment(
+ al,
+ true,
+ "verify should have passed once all sequences involved in alCodonFrame were added to dataset");
+
}
/*
* Read in Stockholm format test data including secondary structure