X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=9c23a0af68dd02273967ac7632163da45ae57925;hb=aa213924876640ba82e866da5a750d9cdaa816d2;hp=52e7408f61710eb29d4bf6c278bbc6a080830243;hpb=a45774ee31d9f35d4eff46d54d7deab719afb092;p=jalview.git diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 52e7408..9c23a0a 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -492,6 +492,8 @@ public class JalviewLite extends Applet implements boolean seqlimits = suffix.equalsIgnoreCase("true"); if (alf.viewport.getSelectionGroup() != null) { + // JBPNote: getSelectionAsNewSequence behaviour has changed - this method now returns a full copy of sequence data + // TODO consider using getSequenceSelection instead here String reply = new AppletFormatAdapter().formatSequences(format, new Alignment(alf.viewport.getSelectionAsNewSequence()), seqlimits); @@ -716,6 +718,29 @@ public class JalviewLite extends Applet implements /* * (non-Javadoc) * + * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) + */ + public void loadFeatures(String features, boolean autoenabledisplay) + { + loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay) + { + return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, autoenabledisplay); + } + + + /* + * (non-Javadoc) + * * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String) */ public String getFeatures(String format) @@ -1798,8 +1823,7 @@ public class JalviewLite extends Applet implements if (protocol == jalview.io.AppletFormatAdapter.PASTE) { - newAlignFrame.setTitle("Sequences from " - + applet.getDocumentBase()); + newAlignFrame.setTitle("Sequences from " + applet.getDocumentBase()); } newAlignFrame.statusBar.setText("Successfully loaded file " + file); @@ -1840,7 +1864,46 @@ public class JalviewLite extends Applet implements } } - String param = applet.getParameter("features"); + + /* + * Try to load T-Coffee score file + */ + String sScoreFile = applet.getParameter("scoreFile"); + if( sScoreFile != null && !"".equals(sScoreFile) ) { + try { + if (debug) { + System.err.println("Attempting to load T-COFFEE score file from the scoreFile parameter"); + } + if (!newAlignFrame.loadScoreFile(sScoreFile)) { + System.err.println("Failed to parse T-COFFEE parameter as a valid score file ('"+sScoreFile+"')"); + } + }catch( Exception e ) { + System.err.printf("Cannot read score file: '%s'. Cause: %s \n", sScoreFile, e.getMessage()); + } + } + + + // /////////////////////////// + // modify display of features + // we do this before any features have been loaded, ensuring any hidden groups are hidden when features first displayed + // + // hide specific groups + // + String param = applet.getParameter("hidefeaturegroups"); + if (param != null) + { + newAlignFrame.setFeatureGroupState(separatorListToArray(param), false); +// applet.setFeatureGroupStateOn(newAlignFrame, param, false); + } + // show specific groups + param = applet.getParameter("showfeaturegroups"); + if (param != null) + { + newAlignFrame.setFeatureGroupState(separatorListToArray(param), true); +// applet.setFeatureGroupStateOn(newAlignFrame, param, true); + } + // and now load features + param = applet.getParameter("features"); if (param != null) { param = setProtocolState(param); @@ -2059,21 +2122,6 @@ public class JalviewLite extends Applet implements protocols); } - // /////////////////////////// - // modify display of features - // - // hide specific groups - param = applet.getParameter("hidefeaturegroups"); - if (param != null) - { - applet.setFeatureGroupStateOn(newAlignFrame, param, false); - } - // show specific groups - param = applet.getParameter("showfeaturegroups"); - if (param != null) - { - applet.setFeatureGroupStateOn(newAlignFrame, param, true); - } } else {