*/
public String getSelectedSequences()
{
- return getSelectedSequences(currentAlignFrame);
+ return getSelectedSequencesFrom(currentAlignFrame);
}
- public String getSelectedSequences(AlignFrame alf)
+ public String getSelectedSequencesFrom(AlignFrame alf)
{
StringBuffer result = new StringBuffer("");
public String getAlignment(String format)
{
- return getAlignment(currentAlignFrame, format, "true");
+ return getAlignmentFrom(currentAlignFrame, format, "true");
}
- public String getAlignment(AlignFrame alf, String format)
+ public String getAlignmentFrom(AlignFrame alf, String format)
{
- return getAlignment(alf, format, "true");
+ return getAlignmentFrom(alf, format, "true");
}
public String getAlignment(String format, String suffix)
{
- return getAlignment(currentAlignFrame, format, suffix);
+ return getAlignmentFrom(currentAlignFrame, format, suffix);
}
- public String getAlignment(AlignFrame alf, String format, String suffix)
+ public String getAlignmentFrom(AlignFrame alf, String format, String suffix)
{
try
{
public void loadAnnotation(String annotation)
{
- loadAnnotation(currentAlignFrame, annotation);
+ loadAnnotationFrom(currentAlignFrame, annotation);
}
- public void loadAnnotation(AlignFrame alf, String annotation)
+ public void loadAnnotationFrom(AlignFrame alf, String annotation)
{
if (new AnnotationFile().readAnnotationFile(
alf.getAlignViewport().getAlignment(), annotation,
public String getFeatures(String format)
{
- return getFeatures(currentAlignFrame, format);
+ return getFeaturesFrom(currentAlignFrame, format);
}
- public String getFeatures(AlignFrame alf, String format)
+ public String getFeaturesFrom(AlignFrame alf, String format)
{
return alf.outputFeatures(false, format);
}
public String getAnnotation()
{
- return getAnnotation(currentAlignFrame);
+ return getAnnotationFrom(currentAlignFrame);
}
- public String getAnnotation(AlignFrame alf)
+ public String getAnnotationFrom(AlignFrame alf)
{
return alf.outputAnnotations(false);
}
public AlignFrame newView()
{
- return newView(currentAlignFrame);
+ return newViewFrom(currentAlignFrame);
}
public AlignFrame newView(String name)
{
- return newView(currentAlignFrame, name);
+ return newViewFrom(currentAlignFrame, name);
}
- public AlignFrame newView(AlignFrame alf)
+ public AlignFrame newViewFrom(AlignFrame alf)
{
return alf.newView(null);
}
- public AlignFrame newView(AlignFrame alf, String name)
+ public AlignFrame newViewFrom(AlignFrame alf, String name)
{
return alf.newView(name);
}
boolean embedded = false;
public boolean jmolAvailable = false;
+ public static boolean debug;
/**
* init method for Jalview Applet
*/
public void init()
{
+ String dbg = getParameter("debug");
+ if (dbg!=null)
+ {
+ debug = dbg.toLowerCase().equals("true");
+ }
+ /**
+ * get the separator parameter if present
+ */
+ String sep = getParameter("separator");
+ if (sep!=null)
+ {
+ if (sep.length()>0)
+ { separator = sep;
+ if (debug)
+ {
+ System.err.println("Separator set to '"+separator+"'");
+ }
+ } else {
+ throw new Error("Invalid separator parameter - must be non-zero length");
+ }
+ }
int r = 255;
int g = 255;
int b = 255;
if (frame instanceof AlignFrame)
{
currentAlignFrame = (AlignFrame) frame;
- System.err.println("Activated window "+frame);
+ if (debug)
+ {
+ System.err.println("Activated window "+frame);
+ }
}
}
public LoadingThread(String _file,
JalviewLite _applet)
{
+ if (applet.debug)
+ {
+ System.err.println("Loading thread started with:\n>>file\n"+_file+">>endfile");
+ }
file = _file;
if (file.startsWith("PASTE"))
{
file = addProtocol(file);
protocol = AppletFormatAdapter.URL;
}
+ if (applet.debug)
+ {
+ System.err.println("Protocol identified as '"+protocol+"'");
+ }
format = new jalview.io.IdentifyFile().Identify(file, protocol);
+ if (applet.debug)
+ {
+ System.err.println("File identified as '"+format+"'");
+ }
applet = _applet;
}
pdbFileCount++;
}
while(pdbFileCount < 10);
-
+
+ /////////////////////////////
+ // modify display of features
+ //
+ // hide specific groups
+ param = getParameter("hidefeaturegroups");
+ if (param != null)
+ {
+ applet.setFeatureGroupState(param, false);
+ }
+ // show specific groups
+ param = getParameter("showfeaturegroups");
+ if (param != null)
+ {
+ applet.setFeatureGroupState(param, true);
+ }
}
else
{
return file;
}
}
-
- public String[] tabbedListToArray(String list)
+ /**
+ * separator used for separatorList
+ */
+ protected String separator = "|"; // this is a safe(ish) separator - tabs don't work for firefox
+ /**
+ * parse the string into a list
+ * @param list
+ * @return elements separated by separator
+ */
+ public String[] separatorListToArray(String list)
{
+ int seplen = separator.length();
if (list==null || list.equals(""))
return null;
java.util.Vector jv = new Vector();
int cp=0,pos;
- while ((pos=list.indexOf("\t",cp))>cp)
+ while ((pos=list.indexOf(separator,cp))>cp)
{
jv.addElement(list.substring(cp,pos));
- cp = pos+1;
+ cp = pos+seplen;
}
if (cp<list.length())
{
}
if (jv.size()>0)
{ String[] v = new String[jv.size()];
- jv.copyInto(v);
+ for (int i=0; i<v.length; i++)
+ {
+ v[i] = (String) jv.elementAt(i);
+ }
jv.removeAllElements();
- System.err.println("Array from Tabbed List:\n"+v.length+"\n"+v.toString());
+ if (debug)
+ {
+ System.err.println("Array from '"+separator+"' separated List:\n"+v.length);
+ for (int i=0; i<v.length;i++)
+ {
+ System.err.println("item "+i+" '"+v[i]+"'");
+ }
+ }
return v;
}
- System.err.println("Empty Array from Tabbed List");
+ if (debug)
+ {
+ System.err.println("Empty Array from '"+separator+"' separated List");
+ }
return null;
}
-
- public String ArraytotabbedList(String[] list)
+ /**
+ * concatenate the list with separator
+ * @param list
+ * @return concatenated string
+ */
+ public String arrayToSeparatorList(String[] list)
{
StringBuffer v = new StringBuffer();
if (list!=null)
{
v.append(list[i]);
}
- v.append("\t");
+ v.append(separator);
}
if (list[list.length-1]!=null)
{ v.append(list[list.length-1]);
}
- System.err.println("Tabbed List:\n"+v.toString());
+ if (debug)
+ {
+ System.err.println("Returning '"+separator+"' separated List:\n");
+ System.err.println(v);
+ }
return v.toString();
}
- System.err.println("Empty Tabbed List\n");
+ if (debug)
+ {
+ System.err.println("Returning empty '"+separator+"' separated List\n");
+ }
return "";
}
/**
*/
public String getFeatureGroups()
{
- String lst = ArraytotabbedList(currentAlignFrame.getFeatureGroups());
+ String lst = arrayToSeparatorList(currentAlignFrame.getFeatureGroups());
+ return lst;
+ }
+ /**
+ * @param alf alignframe to get feature groups on
+ * @return
+ * @see jalview.appletgui.AlignFrame#getFeatureGroups()
+ */
+ public String getFeatureGroupsOn(AlignFrame alf)
+ {
+ String lst = arrayToSeparatorList(alf.getFeatureGroups());
return lst;
}
-
/**
* @param visible
* @return
*/
public String getFeatureGroupsOfState(boolean visible)
{
- return ArraytotabbedList(currentAlignFrame.getFeatureGroupsOfState(visible));
+ return arrayToSeparatorList(currentAlignFrame.getFeatureGroupsOfState(visible));
}
/**
+ * @param alf align frame to get groups of state visible
+ * @param visible
+ * @return
+ * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean)
+ */
+ public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
+ {
+ return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
+ } /**
* @param groups tab separated list of group names
* @param state true or false
* @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[], boolean)
*/
- public void setFeatureGroupState(AlignFrame alf, String groups, boolean state)
+ public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state)
{
boolean st = state;//!(state==null || state.equals("") || state.toLowerCase().equals("false"));
- alf.setFeatureGroupState(tabbedListToArray(groups), st);
+ alf.setFeatureGroupState(separatorListToArray(groups), st);
}
public void setFeatureGroupState(String groups, boolean state)
{
- setFeatureGroupState(currentAlignFrame, groups, state);
+ setFeatureGroupStateOn(currentAlignFrame, groups, state);
+ }
+ /**
+ * List separator string
+ * @return the separator
+ */
+ public String getSeparator()
+ {
+ return separator;
+ }
+ /**
+ * List separator string
+ * @param separator the separator to set
+ */
+ public void setSeparator(String separator)
+ {
+ this.separator = separator;
}
}