}
return sb.toString();
}
+
+ public static SubId getSubId(String item)
+ {
+ return new SubId(item);
+ }
+
+ /**
+ * A helper class to parse a string of the possible forms "content"
+ * "[index]content", "[keyName=keyValue]content" and return the integer index,
+ * the strings keyName and keyValue, and the content after the square brackets
+ * (if present). Values not set `will be -1 or null.
+ */
+ public static class SubId
+ {
+ protected int index = 0;
+
+ protected String keyName = null;
+
+ protected String keyValue = null;
+
+ protected String content = null;
+
+ public SubId()
+ {
+ }
+
+ public SubId(String item)
+ {
+ this.parseVal(item);
+ }
+
+ public void parseVal(String item)
+ {
+ if (item.indexOf('[') == 0 && item.indexOf(']') > 1)
+ {
+ int openBracket = item.indexOf('[');
+ int closeBracket = item.indexOf(']');
+ String indexString = item.substring(openBracket + 1, closeBracket);
+ this.content = item.substring(closeBracket + 1);
+ int equals = indexString.indexOf('=');
+ if (equals > -1)
+ {
+ this.keyName = indexString.substring(0, equals);
+ this.keyValue = indexString.substring(equals + 1);
+ this.index = -1;
+ }
+ else
+ {
+ try
+ {
+ this.index = Integer.parseInt(indexString);
+ } catch (NumberFormatException e)
+ {
+ Console.warn("Failed to obtain sequenced id or index from '"
+ + item + "'. Setting index=0 and using content='"
+ + content + "'.");
+ }
+ }
+ }
+ else
+ {
+ this.content = item;
+ }
+ }
+ }
}
\ No newline at end of file
import jalview.api.AlignmentViewPanel;
import jalview.bin.ArgParser.Arg;
import jalview.bin.ArgParser.ArgValues;
+import jalview.bin.ArgParser.SubId;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
af = afMap.get(id);
if (af == null)
{
+ /*
+ * this approach isn't working yet
+ // get default annotations before opening AlignFrame
+ if (m.get(Arg.SSANNOTATION) != null)
+ {
+ Console.debug("***** SSANNOTATION="
+ + m.get(Arg.SSANNOTATION).getBoolean());
+ }
+ if (m.get(Arg.NOTEMPFAC) != null)
+ {
+ Console.debug(
+ "***** NOTEMPFAC=" + m.get(Arg.NOTEMPFAC).getBoolean());
+ }
+ boolean showSecondaryStructure = (m.get(Arg.SSANNOTATION) != null)
+ ? m.get(Arg.SSANNOTATION).getBoolean()
+ : false;
+ boolean showTemperatureFactor = (m.get(Arg.NOTEMPFAC) != null)
+ ? !m.get(Arg.NOTEMPFAC).getBoolean()
+ : false;
+ Console.debug("***** tempfac=" + showTemperatureFactor
+ + ", showSS=" + showSecondaryStructure);
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ if (ssm != null)
+ {
+ ssm.setAddTempFacAnnot(showTemperatureFactor);
+ ssm.setProcessSecondaryStructure(showSecondaryStructure);
+ }
+ */
+
// get kind of temperature factor annotation
AlignmentAnnotation.TFType tempfacType = null;
if ((m.get(Arg.NOTEMPFAC) == null
if (m.get(Arg.TITLE) != null)
af.setTitle(m.get(Arg.TITLE).getValue());
+ /* hacky approach to hiding the annotations */
// show secondary structure annotations?
- if (m.get(Arg.SSANNOTATION) != null
- && !m.get(Arg.SSANNOTATION).getBoolean())
+ if (m.get(Arg.SSANNOTATION) != null)
{
+ boolean showSS = m.get(Arg.SSANNOTATION).getBoolean();
// do this better (annotation types?)
AlignmentUtils.showOrHideSequenceAnnotations(
af.getCurrentView().getAlignment(),
false, false);
}
else
+ /* comment out hacky approach up to here and add this line:
+ if (showTemperatureFactor)
+ */
{
if (m.get(Arg.TEMPFAC_LABEL) != null)
{
.getFirstSequenceAnnotationOfType(
af.getCurrentView().getAlignment(),
AlignmentAnnotation.LINE_GRAPH);
+ String label = m.get(Arg.TEMPFAC_LABEL).getValue();
if (aa != null)
{
- aa.label = m.get(Arg.TEMPFAC_LABEL).getValue();
+ aa.label = label;
+ }
+ else
+ {
+ Console.info(
+ "Could not find annotation to apply tempfac_label '"
+ + label);
}
}
}
{
for (String val : m.get(Arg.PAEMATRIX).getValues())
{
- SubId subId = new SubId(val);
+ SubId subId = ArgParser.getSubId(val);
File paeFile = new File(subId.content);
EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
paeFile, subId.index,
}
return seq;
}
-
- /**
- * A helper class to parse a string of the possible forms "content"
- * "[index]content", "[keyName=keyValue]content" and return the integer index,
- * the strings keyName and keyValue, and the content after the square brackets
- * (if present). Values not set will be -1 or null.
- */
- protected class SubId
- {
- protected int index = 0;
-
- protected String keyName = null;
-
- protected String keyValue = null;
-
- protected String content = null;
-
- protected SubId(String item)
- {
- if (item.indexOf('[') == 0 && item.indexOf(']') > 1)
- {
- int openBracket = item.indexOf('[');
- int closeBracket = item.indexOf(']');
- String indexString = item.substring(openBracket + 1, closeBracket);
- this.content = item.substring(closeBracket + 1);
- int equals = indexString.indexOf('=');
- if (equals > -1)
- {
- this.keyName = indexString.substring(0, equals);
- this.keyValue = indexString.substring(equals + 1);
- this.index = -1;
- }
- else
- {
- try
- {
- this.index = Integer.parseInt(indexString);
- } catch (NumberFormatException e)
- {
- Console.warn("Failed to obtain sequenced id or index from '"
- + item + "'. Setting index=0 and using content='"
- + content + "'.");
- }
- }
- }
- else
- {
- this.content = item;
- }
- }
- }
}