for (ArgValue av : avm.getArgValueList(Arg.STRUCTURE))
{
String val = av.getValue();
- SubVals subId = new SubVals(val);
+ SubVals subId = av.getSubVals();
SequenceI seq = getSpecifiedSequence(af, subId);
if (seq == null)
{
for (ArgValue av : avm.getArgValueList(Arg.PAEMATRIX))
{
String val = av.getValue();
- SubVals subVals = ArgParser.getSubVals(val);
+ SubVals subVals = av.getSubVals();
String paeLabel = subVals.get("label");
File paeFile = new File(subVals.getContent());
String paePath = null;
Console.warn(
"Problem with the PAE file path: '" + paePath + "'");
}
- String structid = null;
- String structfile = null;
- int seqindex = SubVals.NOTSET;
- if (subVals.notSet())
+ String structid = subVals.get("structid");
+ String structfile = subVals.get("structfile");
+ String seqid = subVals.get("seqid");
+ int seqindex = subVals.getIndex();
+
+ // let's find a structure
+ if (structfile == null && structid == null && seqid == null
+ && seqindex == SubVals.NOTSET)
{
ArgValue likelyStructure = avm
.getClosestPreviousArgValueOfArg(av, Arg.STRUCTURE);
}
}
}
- else if (subVals.has("structfile"))
- {
- structfile = subVals.get("structfile");
- }
- else if (subVals.has("structid"))
- {
- structid = subVals.get("structid");
- }
+
if (structfile != null)
{
- Console.info("##### Attaching paeFile '" + paePath + "' to "
+ Console.debug("##### Attaching paeFile '" + paePath + "' to "
+ "structfile=" + structfile);
EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
paeFile, seqindex, structfile, true, false, paeLabel);
}
else if (structid != null)
{
- Console.info("##### Attaching paeFile '" + paePath + "' to "
+ Console.debug("##### Attaching paeFile '" + paePath + "' to "
+ "structid=" + structid);
EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
- paeFile, seqindex, subVals.get("structid"), true, true,
- paeLabel);
+ paeFile, seqindex, structid, true, true, paeLabel);
}
- else
+ else if (seqid != null)
+ {
+ Console.debug("##### Attaching paeFile '" + paePath + "' to "
+ + "seqid=" + seqid);
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile, seqindex, seqid, false, false, paeLabel);
+ }
+ else if (seqindex >= 0)
{
- seqindex = subVals.getIndex();
Console.debug("##### Attaching paeFile '" + paePath
+ "' to sequence index " + seqindex);
EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
paeFile, seqindex, null, false, false, paeLabel);
- // required to readjust the height and position of the PAE
- // annotation
}
for (AlignmentViewPanel ap : af.getAlignPanels())
{
+ // required to readjust the height and position of the PAE
+ // annotation
ap.adjustAnnotationHeight();
}
}
for (ArgValue av : avm.getArgValueList(Arg.IMAGE))
{
String val = av.getValue();
- SubVals subVal = new SubVals(val);
+ SubVals subVal = av.getSubVals();
String type = "png"; // default
String fileName = subVal.getContent();
File file = new File(fileName);
private int index = NOTSET;
- private Map<String, String> subVals = null;
+ private Map<String, String> subValMap;
private static char SEPARATOR = ';';
private String content = null;
- public SubVals(SubVals sv, String c)
+ protected SubVals(SubVals sv, String c)
{
- if (sv != null)
+ if (sv == null)
{
- this.subVals = sv.getSubValsMap();
+ this.subValMap = new HashMap<>();
+ }
+ else
+ {
+ this.subValMap = sv == null ? new HashMap<>() : sv.getSubValMap();
this.index = sv.getIndex();
}
this.content = c;
}
- public SubVals(String item)
+ protected SubVals(String item)
{
+ if (subValMap == null)
+ subValMap = new HashMap<>();
this.parseVals(item);
}
for (String subvalString : subvalsString
.split(Character.toString(SEPARATOR)))
{
- if (subVals == null)
- subVals = new HashMap<>();
int equals = subvalString.indexOf(EQUALS);
if (equals > -1)
{
} catch (NumberFormatException e)
{
// store this non-numeric key as a "true" value
- subVals.put(subvalString, "true");
+ this.put(subvalString, "true");
}
}
}
protected void put(String key, String val)
{
- if (subVals == null)
- subVals = new HashMap<>();
- subVals.put(key, val);
+ subValMap.put(key, val);
}
public boolean notSet()
{
// notSet is true if content present but nonsensical
- return index == NOTSET && subVals == null;
+ return index == NOTSET && (subValMap == null || subValMap.size() == 0);
}
public String get(String key)
{
- return subVals == null ? null : subVals.get(key);
+ return subValMap.get(key);
}
public boolean has(String key)
{
- return subVals == null ? false : subVals.containsKey(key);
+ return subValMap.containsKey(key);
}
public int getIndex()
return content;
}
- protected Map<String, String> getSubValsMap()
+ protected Map<String, String> getSubValMap()
{
- return subVals;
+ return subValMap;
}
public String toString()
{
- if (subVals == null && getIndex() == NOTSET)
+ if (subValMap == null && getIndex() == NOTSET)
return "";
StringBuilder sb = new StringBuilder();
List<String> entries = new ArrayList<>();
- subVals.entrySet().stream().forEachOrdered(
+ subValMap.entrySet().stream().forEachOrdered(
m -> entries.add(m.getValue().equals("true") ? m.getKey()
: new StringBuilder().append(m.getKey()).append(EQUALS)
.append(m.getValue()).toString()));