From: Jim Procter Date: Tue, 22 Sep 2020 13:45:11 +0000 (+0100) Subject: JAL-3748 simple test for SeqCigar preservation of start/end and name for different... X-Git-Tag: Release_2_11_1_3~5^2~25 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=73d0b3417c14be3e826826cd7848fc2923332e0e;p=jalview.git JAL-3748 simple test for SeqCigar preservation of start/end and name for different ways of constructing SeqCigar and reconstructing alignment sequences --- diff --git a/test/jalview/datamodel/SeqCigarTest.java b/test/jalview/datamodel/SeqCigarTest.java index 7ec06aa..761835d 100644 --- a/test/jalview/datamodel/SeqCigarTest.java +++ b/test/jalview/datamodel/SeqCigarTest.java @@ -67,6 +67,29 @@ public class SeqCigarTest } } + @Test(groups= {"Functional"}) + public void testReconstructSeq() + { + String o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt"; + SequenceI s = new Sequence("MySeq", o_seq, 39, 80); + String orig_gapped = "----asdf------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhttt"; + // name of sequence in a particular alignment should be recovered + SequenceI s_gapped = new Sequence("MySeqAlign", orig_gapped, 39, 80); + s_gapped.setDatasetSequence(s); + SeqCigar cg_sgapped = new SeqCigar(s_gapped); + assertTrue(testSeqRecovery(cg_sgapped,s_gapped,true)); + SequenceI subseq_gapped = s_gapped.getSubSequence(44, 60); + SeqCigar subseq_cg_range=new SeqCigar(s_gapped,44,59); + assertTrue(testSeqRecovery(subseq_cg_range, subseq_gapped, true),"SeqCigar created on range of sequence failed"); + + // test another way of reconstructing a sequence from seqCigar + SequenceI[] sqs=SeqCigar.createAlignmentSequences(new SeqCigar[] {subseq_cg_range}, '-', new HiddenColumns(), null); + assertTrue(testSeqRecovery(subseq_cg_range, sqs[0], true),"createAlignmentSequences didn't reconstruct same sequence as for SeqCigar created on range of sequence failed (used by AlignmentView for selections)"); + + subseq_gapped.setName("SubSeqMySeqAlign"); // name of sequence in a particular alignment should be recovered + SeqCigar subseq_cg = new SeqCigar(subseq_gapped); + assertTrue(testSeqRecovery(subseq_cg,subseq_gapped,true)); + } /* * refactored 'as is' from main method *