+ Arg.STRUCTURE.argString() + "=" + val);
continue;
}
+ String structureFilename = null;
File structureFile = null;
if (subVals.getContent() != null
&& subVals.getContent().length() != 0)
{
- structureFile = new File(subVals.getContent());
+ structureFilename = subVals.getContent();
Console.debug("Using structure file (from argument) '"
- + structureFile.getAbsolutePath() + "'");
+ + structureFilename + "'");
+ structureFile = new File(structureFilename);
}
- // TRY THIS
- /*
- * PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(selectedPdbFileName, DataSourceType.FILE,
- * selectedSequence, true, Desktop.instance);
- *
- * sViewer = launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap, new
- * SequenceI[] { selectedSequence });
- *
- */
/* THIS DOESN'T WORK */
else if (seq.getAllPDBEntries() != null
&& seq.getAllPDBEntries().size() > 0)
{
structureFile = new File(
seq.getAllPDBEntries().elementAt(0).getFile());
- Console.debug("Using structure file (from sequence) '"
- + structureFile.getAbsolutePath() + "'");
+ if (structureFile != null)
+ {
+ Console.debug("Using structure file (from sequence) '"
+ + structureFile.getAbsolutePath() + "'");
+ }
+ structureFilename = structureFile.getAbsolutePath();
}
- if (structureFile == null)
+ if (structureFilename == null || structureFile == null)
{
addWarn("Not provided structure file with '" + val + "'");
continue;
Console.debug("Using structure file "
+ structureFile.getAbsolutePath());
+ argParser.setStructureFilename(structureFilename);
+
// open structure view
AlignmentPanel ap = af.alignPanel;
if (headless)
for (ArgValue structureImageArgValue : avm
.getArgValueList(Arg.STRUCTUREIMAGE))
{
- String structureImageFilename = structureImageArgValue
- .getValue();
+ String structureImageFilename = argParser.makeSubstitutions(
+ structureImageArgValue.getValue(), id, true);
if (structureViewer != null && structureImageFilename != null)
{
SubVals structureImageSubVals = null;
this.colourAlignFrame(af, imageColour);
List<String> extraCommands = new ArrayList<>();
+ // these don't actually do anything to the output image since we
+ // renderScreenImage
+ // extraCommands.add("set antialiasImages on");
+ // extraCommands.add("set antialiasTranslucent on");
String bgcolour = avm.getValueFromSubValOrArg(
structureImageArgValue, Arg.BGCOLOUR,
private static final String LINKEDIDDIRNAME = "{dirname}";
/**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename extension
+ */
+ private static final String STRUCTUREEXTENSION = "{structureextension}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename base
+ */
+ private static final String STRUCTUREBASENAME = "{structurebasename}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename dir path
+ */
+ private static final String STRUCTUREDIRNAME = "{structuredirname}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! increment the
+ * on-the-fly counter and substitute the incremented value
+ */
+ private static final String INCREMENTONTHEFLYCOUNTER = "{++m}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * substitute with the on-the-fly counter
+ */
+ private static final String ONTHEFLYCOUNTER = "{m}";
+
+ /**
+ * the string used for on-the-fly structure filename substitutions
+ */
+ private String currentStructureFilename = null;
+
+ /**
+ * the counter used for on-the-fly {m} substitutions
+ */
+ private int ontheflyCounter = 0;
+
+ /**
* the current argfile
*/
private String argFile = null;
public String makeSubstitutions(String val, String linkedId)
{
+ return makeSubstitutions(val, linkedId, false);
+ }
+
+ public String makeSubstitutions(String val, String linkedId,
+ boolean onthefly)
+ {
if (!this.substitutions || val == null)
return val;
rest = val;
}
if (rest.contains(LINKEDIDAUTOCOUNTER))
+ {
rest = rest.replace(LINKEDIDAUTOCOUNTER,
String.valueOf(linkedIdAutoCounter));
+ }
if (rest.contains(INCREMENTLINKEDIDAUTOCOUNTER))
+ {
rest = rest.replace(INCREMENTLINKEDIDAUTOCOUNTER,
String.valueOf(++linkedIdAutoCounter));
+ }
if (rest.contains(DEFAULTLINKEDIDCOUNTER))
+ {
rest = rest.replace(DEFAULTLINKEDIDCOUNTER,
String.valueOf(defaultLinkedIdCounter));
+ }
ArgValuesMap avm = linkedArgs.get(linkedId);
if (avm != null)
{
FileUtils.getDirname(new File(argFile)));
}
}
+ if (onthefly)
+ {
+ if (rest.contains(ONTHEFLYCOUNTER))
+ {
+ rest = rest.replace(ONTHEFLYCOUNTER,
+ String.valueOf(ontheflyCounter));
+ }
+ if (rest.contains(INCREMENTONTHEFLYCOUNTER))
+ {
+ rest = rest.replace(INCREMENTONTHEFLYCOUNTER,
+ String.valueOf(++ontheflyCounter));
+ }
+ if (currentStructureFilename != null)
+ {
+ if (rest.contains(STRUCTUREBASENAME))
+ {
+ rest = rest.replace(STRUCTUREBASENAME, FileUtils
+ .getBasename(new File(currentStructureFilename)));
+ }
+ if (rest.contains(STRUCTUREDIRNAME))
+ {
+ rest = rest.replace(STRUCTUREDIRNAME,
+ FileUtils.getDirname(new File(currentStructureFilename)));
+ }
+ }
+ }
return new StringBuilder(subvals).append(rest).toString();
}
return mixedExamples;
}
+ public void setStructureFilename(String s)
+ {
+ this.currentStructureFilename = s;
+ }
+
}
\ No newline at end of file