From 24c4dce749cbfccc4435e442090d04013e3e1b99 Mon Sep 17 00:00:00 2001 From: Daniel Barton Date: Tue, 27 Aug 2013 16:04:26 +0100 Subject: [PATCH] JAL-1358 RNAStructExportImport test file mirrors DisorderAnnotExportImport file. RNAalifoldClient updated to basic working state. --- examples/unfolded_RF00031.aln | 126 +++++++++++++ src/jalview/ws/jws2/RNAalifoldClient.java | 72 ++++++-- test/jalview/ws/jabaws/RNAStructExportImport.java | 198 +++++++++++++++++++++ 3 files changed, 383 insertions(+), 13 deletions(-) create mode 100644 examples/unfolded_RF00031.aln create mode 100644 test/jalview/ws/jabaws/RNAStructExportImport.java diff --git a/examples/unfolded_RF00031.aln b/examples/unfolded_RF00031.aln new file mode 100644 index 0000000..69a7850 --- /dev/null +++ b/examples/unfolded_RF00031.aln @@ -0,0 +1,126 @@ +CLUSTAL + +B.taurus.1/1-64 C-UUGCGUU--AAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G---------GGU +D.melanogaster.3/1-68 G-UGGCGCU--UAUGACGCAGUUGUCU-UAAA-CUCGAAC--UCGA-GC--------GGG +D.melanogaster.2/1-63 C-AUUCAACU-UAUGAGGAUUAUUUCU-UAAA-GGCCUCU---GGC--U-------CGGA +D.melanogaster.1/1-65 G-AGCC-CU---AUGAUCGAUGAUUGG-CAAA-UCCUCUC--GAGG--A-------ACCG +R.norvegicus.7/1-66 C-CGGCACU--CAUGACGGUCUGCCUG-AAAA-CCAGCCC--GCUG-GU--------GGG +R.norvegicus.6/1-67 G-CCGCUUC---AUGACAGGAAGGACU-GAAA-UGUCUCA-AAGAC--C-----UGUGGU +R.norvegicus.5/1-62 G-UUUUUCC---AUGACGGUGUUUCCUCUAAA--UUUAC----AUG-----------GAG +R.norvegicus.4/1-61 G-UCAGAUG---AUGACGGCCUGUGCA-GAAA-CCCCCAC-GUGGG--C--------UGC +R.norvegicus.3/1-67 U-UUGCAUU--AAUGAGGAUUACACAG-AAAA-CCUUUGU--UAAGGGU--------UUG +R.norvegicus.2/1-64 G-UUACAUU--GAUGAGAACAGAAACA-UAAA--CUAUGA-CCUAG-G---------GGU +R.norvegicus.1/1-61 A-UAUUUGUU-UAUGAUGGUCACAGUG-UAAA--GUUCA----CAC-----------AGC +O.aries.1/1-68 G-ACGCUUC---AUGACAGGAAGGACU-GAAA-UGUCUCU-UGGAC-GC------CUGGU +M.musculus.9/1-66 C-CGGCACU--CAUGAAGGUCUGCUUG-AAAA-CCAGCCU--GCUG-GU--------GGG +M.musculus.8/1-67 U-UUGCAUU--AAUGAGGAUUACACAG-AAAA-CCUUUGU--UAAG-GA-------CUUG +O.niloticus.3/1-65 G-UGUCUCU---GUGAAGUUCGGUUUU-UAAA-AGGGUCA---UCC--A-------GAAA +M.musculus.7/1-64 G-UGUCUCU---AUGAAGGAGGGGCCC-GAAG-CCCUUGU---GGG--C--------GGG +O.niloticus.2/1-61 U-GUUUAUU--AAUGACGGCUACAGAU-UAAA--CCUUU----AGC-----------CUC +M.musculus.6/1-61 G-UCAGAUG---AUGAUGGCCUGGGCA-GAAA-CCCCAUG--UGGG--C--------CGC +O.niloticus.1/1-59 G-UUUCUCA---GUGAAGGCUACAGAU-UAAA--CCUCU----GGC-----------CUC +M.musculus.5/1-66 G-CCGCUUC---AUGACAGGAAGGACU-GAAA-UGUCUUA---GAC--C-----UGUGGU +M.musculus.4/1-65 G-UGUGCGA---AUGAUAACUACUGAC-GAAA-GAGCUGU-CUGCU--C-------AGUC +M.musculus.3/1-64 G-GUUCUUC--CAUGAUGGUGUUUCCUCUAAA--UUUGC----ACG-----------GAG +M.musculus.2/1-64 G-UUACAUU--AAUGAGAACAGAAACA-UAAA--CUAUGA-CCUAG-G---------GGU +M.musculus.1/1-64 G-UCACCGA---AUGAUCUGCUCUGGU-CAAA-UCCUUCU---AUG--C------CAGCC +C.elegans.1/1-64 G-AGGCAGCUUUGUGACGACCUUUGGC-UAAA-CUCCAUC--GUGA-GC--------GCC +H.sapiens.15/1-63 U-UUUCAUC--UAUGAGGGUGUUUCCUCUAAA--CCUACG---AGG-----------GAG +H.sapiens.14/1-62 C-ACUGCUG---AUGACGAACUAUCUC-UAAC-UGGUCUU--GACC--A-------CGAG +H.sapiens.13/1-64 G-UCACUGC---AUGAUCCGCUCUGGU-CAAA-CCCUUCC---AGG--C------CAGCC +H.sapiens.12/1-67 C-UCUGUUA---AUGACGUCUCUCCCUCUAAA-CCCCAUU-AAGGA--C--------UGG +D.rerio.1/1-66 A-UGUGGUCUUUAUGAAGGCAGGUGCA-GAAA-CUAUGCA---CUA-GU--------GGU +H.sapiens.11/1-63 G-CCGGAUG---AUGACGACCUGGGUG-GAAA-CCUACCC-UGUGG--G--------CAC +H.sapiens.10/1-62 C-CGGCACU--CAUGACGGCCUGCCUG-CAAA--CCUGC----UGG--U--------GGG +S.mansoni.1/1-67 C-UCGCUAU---AUGACGAUGGCAAUC-UCAA--AUGUU----CAU--U--------GGU +S.scrofa.4/1-64 C-UGGCACC--CAUGACAGUCUGCCUA-AAAA-CCAGCC----CUG-GU--------GGG +S.scrofa.3/1-63 A-UUUUAUC--CAUGAAAGUGUUUCCUCUAAA--CCUAU----GUG-----------GAG +S.scrofa.2/1-65 C-UGGCACC--CAUGACAGUCUGCCUA-AAAA-CCAGCCC---CUG-GU--------GGG +S.scrofa.1/1-68 G-ACGCUUC---AUGACAGGAAGGACU-GAAA-UGUCUUG-UGGAC-GC------CUGGU +H.sapiens.9/1-58 U-AUUUGUU--UAUGAUGGCCACAGCC-UAAA--GUACA----CAC-----------GGC +H.sapiens.8/1-67 U-UUGCUUU--AAUGAGAAUAGAAACG-UAAA--CUAUGA-CCUAG-G---------GGU +X.laevis.1/1-67 G-UGUUUGCA-AAUGACGACCGAUUUU-GAAA-UGGUCUCACGGCC--A-------AAAA +H.sapiens.7/1-70 U-GGCGUCUU-CAUGAGGGAGGGGCCC--AAA-GCCCUUG--UGGG--C--------GGA +H.sapiens.6/1-66 G-UGUGCGG---AUGAUAACUACUGAC-GAAAGAGUCAUC---GAC--C-----UCAGUU +H.sapiens.5/1-57 U-UCACAGA---AUGAUGGCACCUUCC-UAA---ACCCU----CAU-----------GGG +H.sapiens.4/1-71 G-ACUGACAU-UAUGAAGGCCUGUACU-GAAG-ACAGCAA--GCUG--U-------UAGU +H.sapiens.3/1-68 G-ACGCUUC---AUGAUAGGAAGGACU-GAAA-AGUCUUG-UGGAC--A-----CCUGGU +H.sapiens.2/1-65 G-UGUGCGG---AUGAUAACUACUGAC-GAAA-GAGUCAU-CGACU--C-------AGUU +H.sapiens.1/1-63 G-CCAGAUG---AUGACGACCUGGGUG-GAAA-CCUACCC-UGUGG--G--------CAC +M.musculus.14/1-67 C-UCUGAUA---AUGAUGUCUCUCCCU-CUAA-CUCCCAGUAAGGA--C--------UGG +M.musculus.13/1-60 C-AUGCGUC--CAUGAAGUCACUGGCC-UCAA-GCCCAA----GUG-GU--------GGG +M.musculus.12/1-65 C-UCAGCAG--GAUGAUGAGAAGGGCU-GAAA-UGCUGCC--AAAC--C-------AGGU +M.musculus.11/1-63 U-AUUUGUG--UAUGAUGGUCACAGUG-UAAA--GUUCC----CAC-----------AGC +M.musculus.10/1-66 C-CGGCACU--CAUGAAGGUCUGCCUG-AAAA-CCAGCCU--GCUG-GU--------GGG +B.taurus.7/1-61 U-UUUGCCC---AUGAAGGUGUUCCCUCUAAA--CCUAC----GUG-----------GAG +B.taurus.6/1-67 G-AUGCGUC--CAUGAAGUCACCAGCC-CCAA-GCCCCUC---GUG-GU--------GGG +B.taurus.5/1-61 G-CCAGAUG---AUGAGGACCUGUGCG-GAAA-CCCCCCG--CGGG--C--------UGC +B.taurus.4/1-64 ACUUGCGUU--AAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G---------GGU +G.gallus.3/1-73 U-AUUUCUU--UGUGAUGACCGAUUUU-GAAA-UGGGUUU---CUC--UAAUGCCAGGAA +B.taurus.3/1-66 C-CCGGUGCC-UAUGACGGUCUGUCUG-AAAA-CCAGCCC---CUG-GU--------GGG +G.gallus.2/1-60 U-AUUUGUC---AUGACAGUCACAGCA-UAAA--GCGCA----GAC-----------GGC +B.taurus.2/1-64 C-UUGCGUU--AAUGAGAACAGAAACG-AAAA--CUAUAA-CCUAG-G---------GGU +G.gallus.1/1-63 G-UGUGUUU---AUGAAGAGCACUAAC-AAAA-GAGUAAU-UGACU--C-------AGUU + +B.taurus.1/1-64 UUC-U-G-UUGGAU--GGUUG-------GCAAC +D.melanogaster.3/1-68 CAA-U-U-GCUGAU---UACG---AUUAACCAC +D.melanogaster.2/1-63 AAU-A-G-UCUGAA---CCU--------UAUUG +D.melanogaster.1/1-65 AUC-G-U-UGAGAA--CCCCU-----UUGCCUU +R.norvegicus.7/1-66 GCA-G-U-CCCGAG-GACCUG-------GCGUG +R.norvegicus.6/1-67 CUU-U-C-UUCGAU--GUUCU-------GCGGC +R.norvegicus.5/1-62 AAA-C-A-CCUGAU-UUCCAG------AAAAAU +R.norvegicus.4/1-61 -CA-G-G-UUUGAA---CCC--------CUGGC +R.norvegicus.3/1-67 UGUCG-A-UCUGCU--AAUUG-------GCAAA +R.norvegicus.2/1-64 UUC-U-G-UUGGAU--AGCUC-------GUAAU +R.norvegicus.1/1-61 UGU-G-A-CUUGAU--UUUUA-------AAAAU +O.aries.1/1-68 CCU-U-C-CUUGAU--GUUCU------CACGGC +M.musculus.9/1-66 GCA-G-U-CCUGAG-GACCUG-------GCGUG +M.musculus.8/1-67 UGU-AGA-UCUGAU--AAUUG-------GCAAA +O.niloticus.3/1-65 ACC-G-ACACUGAU--GUUUC------CGACAC +M.musculus.7/1-64 CCU-C-C-CCUGAG---CCCG----UCUGUGGU +O.niloticus.2/1-61 UGG-A-G-CCAGAU--GCAUU------CAAACA +M.musculus.6/1-61 CCA-G-G-UUUGAA---CCC--------CUGGC +O.niloticus.1/1-59 UGG-A-G-CCAGAU--GCAUU-------GAAAC +M.musculus.5/1-66 CUU-U-C-CUCGAU--GUUCC------UGCGGC +M.musculus.4/1-65 UGU-G-G-UUGGAU---GUAG------UCACAC +M.musculus.3/1-64 AAA-C-A-CCUGAU-UUCCAG-----GAAAAUC +M.musculus.2/1-64 UUC-U-G-UUGGAU--AGCUU-------GUAAU +M.musculus.1/1-64 AGG-G-U-GGUGAU--GACCC-------GUGAC +C.elegans.1/1-64 UCU-G-G-UCUGAU---GC---------GCCUC +H.sapiens.15/1-63 GAA-C-A-CCUGAU---CUUA-----CAGAAAA +H.sapiens.14/1-62 CUA-G-U-UCUGAA---UU-G-------CAGGG +H.sapiens.13/1-64 AGA-G-U-GGGGAU--GGUCU-------GUGAC +H.sapiens.12/1-67 GAG-A-G-GCAGAGCAAGCCU-------CAGAG +D.rerio.1/1-66 GUC-U-G-UCUGAU--GUUUG-------GCCAU +H.sapiens.11/1-63 CCA-U-G-UCCGAG---CCCC-------CUGGC +H.sapiens.10/1-62 GCA-G-A-CCCGAA-AAUCCA-------GCGUG +S.mansoni.1/1-67 UGC-C-A-UUUGAU--GAAAUCAGUUUUGUGUG +S.scrofa.4/1-64 GCA-G-A-CUCGAG-AACCUG-------GCGUG +S.scrofa.3/1-63 GAA-C-A-CCUGAU-GUCCAG------GAAAAU +S.scrofa.2/1-65 GCA-G-A-CUCGAG-AACCUG-------GCGUG +S.scrofa.1/1-68 CCU-U-C-CCUGAU--GUUCU------CAUGGC +H.sapiens.9/1-58 UGU-G-A-CUUGAU---UCA--------AAAGA +H.sapiens.8/1-67 UUC-U-G-UUGGAU-AAUUAG-----CAGUUUA +X.laevis.1/1-67 CUC-GUG-UCCGAC---AUC--------AACCC +H.sapiens.7/1-70 CCU-C-C-CCUGAG---CCUGUCUGAGGGGCCA +H.sapiens.6/1-66 AGU-G-G-UUGGAU---GUAG------UCACAU +H.sapiens.5/1-57 UGG-U-G-UCUGAG--AGGC--------GUGAA +H.sapiens.4/1-71 ACA-G-A-CCAGAU--GCUUU--CUUGGCAGGC +H.sapiens.3/1-68 CUU-U-C-CCUGAU--GUUCU------CGUGGC +H.sapiens.2/1-65 AGU-G-G-UUGGAU---GUAG------UCACAU +H.sapiens.1/1-63 CCA-U-G-UCCGAG---CCCC-------CUGGC +M.musculus.14/1-67 GAG-A-G-GCUGAACAAACCU-------CAGAG +M.musculus.13/1-60 CAG-U-G-ACAGAA---GA---------GCUGC +M.musculus.12/1-65 CCU-U-U-UCUGAU--GGUGG-------CUGGG +M.musculus.11/1-63 UGU-G-A-CUUGAU--UUUUA----AAAAUGUC +M.musculus.10/1-66 GCA-G-U-CCUGAG-GACCUG-------GCGUG +B.taurus.7/1-61 GAA-U-G-CCUGAU-GUCCAG-------GAAAA +B.taurus.6/1-67 UGG-U-G-AUGGAA-CCGUCA-----AAGCAGU +B.taurus.5/1-61 CCA-U-G-UCUGAG---CCC--------CUGGC +B.taurus.4/1-64 UUC-U-G-UUGGAU--GGUUG-------GCAA- +G.gallus.3/1-73 AUC-GUG-UCUGAU---GUUG-----UCAAGUA +B.taurus.3/1-66 GCA-G-A-CCUGAG-AACCUG-------GCGUG +G.gallus.2/1-60 UGU-G-A-CCUGAU--UUUAG------AAAAUA +B.taurus.2/1-64 UUC-U-G-UUGGAU--GGUUG-------GCAAC +G.gallus.1/1-63 GGU-G-U-UCAGAU--GCU---------CUCAC + diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index 70ddb7e..9592142 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -4,6 +4,7 @@ import jalview.api.AlignCalcWorkerI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.gui.AlignFrame; +import jalview.schemes.NucleotideColourScheme; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.WsParamSetI; @@ -25,6 +26,8 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements AlignCalcWorkerI { + // test + String methodName; AlignFrame af; @@ -33,37 +36,51 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements WsParamSetI preset, List paramset) { super(sh, alignFrame, preset, paramset); + + if (arguments == null) arguments = new ArrayList(); + arguments.add(sh.getRunnerConfig().getArgumentByOptionName("-p")); af = alignFrame; - methodName = sh.serviceType; - + + // defult false. Which one here? + // submitGaps = true; + nucleotidesAllowed = true; + proteinAllowed = false; + + arguments.add(sh.getRunnerConfig().getArgumentByOptionName("-p")); } @Override public String getServiceActionText() { - return "Submitting RNA alignment for Secondary Structure prediction using" + return "Submitting RNA alignment for Secondary Structure prediction using " + "RNAalifold Service"; } @Override public void updateResultAnnotation(boolean immediate) { + if (immediate || !calcMan.isWorking(this) && scoremanager != null) { - - List ourAnnot = new ArrayList(); -// ourAnnots = new ArrayList(); + // ourAnnots = new ArrayList(); // So I don't have to do any more casting List structs = ((RNAStructScoreManager) scoremanager).getStructs(); List> data = ((RNAStructScoreManager) scoremanager).getData(); + + // I think this will never find an annotation at the moment. It will always create... + AlignmentAnnotation annotation = alignViewport.getAlignment() + .findOrCreateAnnotation("Consensus Structure", getCalcId(), false, null , null); + + // construct Annotation from scoremanager + // Deal with the consensus structure and (?)BasePair Probabilities Annotation[] anns = new Annotation[structs.get(1).length()]; @@ -84,7 +101,7 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements } // ignoring the Consensus alignemnt for now, get the Structure and make an AlignmentAnnotation - String struct = structs.get(1); + String struct = structs.get(1); // get(1) for (int i = 0; i < struct.length(); i++) { if (BPScores) { @@ -96,14 +113,14 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements } else if (contacts.size() == 1) { // There is only one contact associated with this base - float prob = basePairs.get(contacts.get(i)); + float prob = basePairs.get(contacts.get(0)); anns[i] = new Annotation(struct.substring(i, i+1), "", struct.charAt(i), prob); } else if (contacts.size() > 1) { // For now we will simply deal with alternate contact information by mentioning its // existance in the description - float prob = basePairs.get(contacts.get(i)); - anns[i] = new Annotation(struct.substring(i, i+1), "This base has alternate contact(s)", + float prob = basePairs.get(contacts.get(0)); + anns[i] = new Annotation(struct.substring(i, i+1), "This base has alternate contacts", struct.charAt(i), prob); } } @@ -112,14 +129,37 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements anns[i] = new Annotation(struct.substring(i, i+1), "", struct.charAt(i), 0f); } } + + System.out.println("size of anns: " + anns.length); + + // Set the annotation to the AlignmentAnnotation object + annotation.annotations = anns; + + // Set the probability + annotation.setScore(data.get(1).first().getScores().get(0)); - AlignmentAnnotation annot = new AlignmentAnnotation("Consensus Structure", "Free Energy", anns); - annot.setScore(data.get(1).first().getScores().get(0)); + + + // old +// AlignmentAnnotation annot = new AlignmentAnnotation("Consensus Structure", "Free Energy", anns); + + + + + System.out.println("RNAalifoldClient - annotation:\n"); + for (Annotation ann : annotation.annotations) { + System.out.print(ann.toString()+"|"); + } + System.out.println(); + // Instead of this look at existing methods for creating annotations + ourAnnot.add(annotation); + + if (ourAnnot.size() > 0) { updateOurAnnots(ourAnnot); } - + } } @@ -137,4 +177,10 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements return contacts; } + + public String getCalcId() + { + return SequenceAnnotationWSClient.AAConCalcId; + } + } diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java new file mode 100644 index 0000000..510b913 --- /dev/null +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -0,0 +1,198 @@ +package jalview.ws.jabaws; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Vector; + +import jalview.api.AlignCalcManagerI; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.io.AnnotationFile; +import jalview.io.FormatAdapter; +import jalview.io.StockholmFileTest; +import jalview.ws.jws2.AADisorderClient; +import jalview.ws.jws2.Jws2Discoverer; +import jalview.ws.jws2.RNAalifoldClient; +import jalview.ws.jws2.jabaws2.Jws2Instance; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class RNAStructExportImport +{ + public static String testseqs = "examples/unfolded_RF00031.aln"; + + public static Jws2Discoverer disc; + + public static Jws2Instance rnaalifoldws; + + jalview.ws.jws2.RNAalifoldClient alifoldClient; + + public static jalview.gui.AlignFrame af = null; + + @BeforeClass + public static void setUpBeforeClass() throws Exception + { + + + System.out.println("test1"); + + jalview.bin.Cache.initLogger(); + disc = JalviewJabawsTestUtils.getJabawsDiscoverer(); + + System.out.println("test2"); + + for (Jws2Instance svc : disc.getServices()) + { + + System.out.println("Service type: " + svc.serviceType); + + if (svc.getServiceTypeURI().toLowerCase().contains("rnaalifoldws")) + { + rnaalifoldws = svc; + } + } + + System.out.println("State of rnaalifoldws: " + rnaalifoldws); + + if (rnaalifoldws == null) System.exit(0); + + System.out.println("test3"); + + jalview.io.FileLoader fl = new jalview.io.FileLoader(false); + + // Following this method a long way we find some (probably important!) + // code that I have just commented out! + af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.FormatAdapter.FILE); + + assertNotNull("Couldn't load test data ('" + testseqs + "')", af); + + System.out.println("test5"); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception + { + if (af != null) + { + af.setVisible(false); + af.dispose(); + } + } + + /** + * test for patches to JAL-1294 + */ + @Test + public void testRNAStructExport() + { + alifoldClient = new RNAalifoldClient(rnaalifoldws, af, null, null); + + System.out.println("Service action text:\n" + alifoldClient.getServiceActionText()); + + + System.out.println("START FOLDING"); + af.getViewport().getCalcManager().startWorker(alifoldClient); + + + do + { + try + { + Thread.sleep(50); + } catch (InterruptedException x) + { + } + ; + } while (af.getViewport().getCalcManager().isWorking()); + + System.out.println("END FOLDING"); + + // ALL FOR TESTING + AlignCalcManagerI test = af.getViewport().getCalcManager(); + RNAalifoldClient testWorker = ((RNAalifoldClient)test.getRegisteredWorkersOfClass(RNAalifoldClient.class).get(0)); + testWorker.updateResultAnnotation(true); + System.out.println("Annotation from RNAalifoldclient"); + for (Annotation ann : testWorker.ourAnnots.get(0).annotations) { + System.out.print(ann.toString()+"|"); + } + System.out.println(); + + + // Why are the AlignViewport.alignment and the RNAalifoldClient alignment + // Annotations different + AlignmentI orig_alig = af.getViewport().getAlignment(); + + System.out.println("orig_alig has class: " + orig_alig.getClass()); + + // some time before here but after the RNAalifoldClient Update method + // the alignment annotation is replaced.... + + System.out.println("orig_alig annotation:\n"); + for (AlignmentAnnotation an : orig_alig.getAlignmentAnnotation()) { + for (Annotation ann : an.annotations) { + System.out.print(ann.toString()+"|"); + } + System.out.println(); + } + + + testAnnotationFileIO("Testing RNAalifold Annotation IO", orig_alig); + + } + + public static void testAnnotationFileIO(String testname, AlignmentI al) + { + try + { + String aligfileout = new FormatAdapter().formatSequences("CLUSTAL", + al.getSequencesArray()); + + // test +// System.out.println("aligfileout:\n" + aligfileout); + + String anfileout = new AnnotationFile().printAnnotations( + al.getAlignmentAnnotation(), al.getGroups(), + al.getProperties()); + assertTrue( + "Test " + + testname + + "\nAlignment annotation file was not regenerated. Null string", + anfileout != null); + assertTrue( + "Test " + + testname + + "\nAlignment annotation file was not regenerated. Empty string", + anfileout.length() > "JALVIEW_ANNOTATION".length()); + + System.out.println("Output annotation file:\n" + anfileout + + "\n<