import jalview.bin.ArgParser.SubVals;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder;
import jalview.gui.AlignFrame;
import jalview.gui.AlignmentPanel;
+import jalview.gui.AssociatePdbFileWithSeq;
import jalview.gui.Desktop;
+import jalview.gui.Preferences;
import jalview.gui.StructureChooser;
+import jalview.gui.StructureViewer;
import jalview.io.AppletFormatAdapter;
import jalview.io.DataSourceType;
import jalview.io.FileFormatException;
private Map<String, AlignFrame> afMap;
+ private static boolean commandArgsProvided = false;
+
+ public static boolean commandArgsProvided()
+ {
+ return commandArgsProvided;
+ }
+
public static boolean processArgs(ArgParser ap, boolean h)
{
argParser = ap;
headless = h;
- boolean argsWereParsed = false;
+ boolean argsWereParsed = true;
if (headless)
{
System.setProperty("java.awt.headless", "true");
if (id == null)
{
cmds.processUnlinked(id);
+ argsWereParsed &= cmds.wereParsed();
}
else
{
cmds.processLinked(id);
+ argsWereParsed &= cmds.wereParsed();
}
cmds.processImages(id);
- argsWereParsed |= cmds.wereParsed();
+ argsWereParsed &= cmds.wereParsed();
}
}
return argsWereParsed;
}
- boolean argsWereParsed = false;
+ boolean argsWereParsed = true; // set false as soon as an arg is found
private boolean wereParsed()
{
protected void processUnlinked(String id)
{
- ArgValuesMap avm = new ArgValuesMap(argParser.linkedArgs(id));
-
processLinked(id);
}
protected void processLinked(String id)
{
- ArgValuesMap avm = new ArgValuesMap(argParser.linkedArgs(id));
+ ArgValuesMap avm = argParser.linkedArgs(id);
+ if (avm == null)
+ return;
+ else
+ argsWereParsed = false;
/*
// script to execute after all loading is completed one way or another
FileFormatI format = null;
DataSourceType protocol = null;
*/
- if (avm.hasValue(Arg.OPEN))
+ if (avm.containsArg(Arg.OPEN))
{
+ commandArgsProvided = true;
long progress = -1;
boolean first = true;
+ boolean progressBarSet = false;
AlignFrame af;
for (ArgValue av : avm.getArgValueList(Arg.OPEN))
{
if (first)
{
first = false;
- if (!headless)
+ if (!headless && desktop != null)
{
desktop.setProgressBar(
MessageManager.getString(
"status.processing_commandline_args"),
progress = System.currentTimeMillis());
+ progressBarSet = true;
}
}
// get kind of temperature factor annotation
StructureImportSettings.TFType tempfacType = TFType.DEFAULT;
- if ((!avm.getBoolean(Arg.NOTEMPFAC)) && avm.hasValue(Arg.TEMPFAC))
+ if ((!avm.getBoolean(Arg.NOTEMPFAC))
+ && avm.containsArg(Arg.TEMPFAC))
{
try
{
}
// colour aligment?
- if (avm.hasValue(Arg.COLOUR))
+ if (avm.containsArg(Arg.COLOUR))
{
af.changeColour_actionPerformed(avm.getValue(Arg.COLOUR));
}
// change alignment frame title
- if (avm.hasValue(Arg.TITLE))
+ if (avm.containsArg(Arg.TITLE))
af.setTitle(avm.getValue(Arg.TITLE));
/* hacky approach to hiding the annotations */
if (showTemperatureFactor)
*/
{
- if (avm.hasValue(Arg.TEMPFAC_LABEL))
+ if (avm.containsArg(Arg.TEMPFAC_LABEL))
{
AlignmentAnnotation aa = AlignmentUtils
.getFirstSequenceAnnotationOfType(
.getStructureSelectionManager(Desktop.instance);
SequenceI seq = af.alignPanel.getAlignment().getSequenceAt(0);
ssm.computeMapping(false, new SequenceI[] { seq }, null,
- openFile, DataSourceType.FILE, null);
+ openFile, DataSourceType.FILE, null, null, null);
}
}
else
else
{
Console.warn("No more files to open");
- if (desktop != null)
- desktop.setProgressBar(null, progress);
}
}
+ if (progressBarSet && desktop != null)
+ desktop.setProgressBar(null, progress);
}
if (!avm.getBoolean(Arg.NOSTRUCTURE))
{
AlignFrame af = afMap.get(id);
- if (avm.hasValue(Arg.STRUCTURE))
+ if (avm.containsArg(Arg.STRUCTURE))
{
+ commandArgsProvided = true;
for (ArgValue av : avm.getArgValueList(Arg.STRUCTURE))
{
String val = av.getValue();
Console.debug("Using structure file (from argument) '"
+ structureFile.getAbsolutePath() + "'");
}
+
+ // 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)
Console.debug("Using structure file "
+ structureFile.getAbsolutePath());
+ PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(structureFile.getAbsolutePath(),
+ DataSourceType.FILE, seq, true, Desktop.instance);
+
// open structure view
AlignmentPanel ap = af.alignPanel;
- StructureChooser.openStructureFileForSequence(ap, seq,
- structureFile);
+ if (headless)
+ {
+ Cache.setProperty(Preferences.STRUCTURE_DISPLAY,
+ StructureViewer.ViewerType.JMOL.toString());
+ }
+
+ // get tft, paeFilename, label?
+ /*
+ ArgValue tftAv = avm.getArgValuesReferringTo("structid", structId,
+ Arg.TEMPFAC);
+ */
+ StructureChooser.openStructureFileForSequence(null, null, ap, seq,
+ false, structureFile.getAbsolutePath(), null, null); // tft,
+ // paeFilename);
}
}
}
// load a pAE file if given
- if (avm.hasValue(Arg.PAEMATRIX))
+ if (avm.containsArg(Arg.PAEMATRIX))
{
AlignFrame af = afMap.get(id);
if (af != null)
{
Console.info("***** Attaching paeFile '" + paePath + "' to "
+ "structfile=" + subVals.get("structfile"));
- EBIAlfaFold.addAlphaFoldPAEToStructure(
- af.getCurrentView().getAlignment(), paeFile,
- subVals.getIndex(), subVals.get("structfile"), false);
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile, subVals.getIndex(), subVals.get("structfile"),
+ true, false);
}
else if (subVals.has("structid"))
{
Console.info("***** Attaching paeFile '" + paePath + "' to "
+ "structid=" + subVals.get("structid"));
- EBIAlfaFold.addAlphaFoldPAEToStructure(
- af.getCurrentView().getAlignment(), paeFile,
- subVals.getIndex(), subVals.get("structid"), true);
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile, subVals.getIndex(), subVals.get("structid"),
+ true, true);
}
else
{
Console.debug("***** Attaching paeFile '" + paePath
+ "' to sequence index " + subVals.getIndex());
- EBIAlfaFold.addAlphaFoldPAEToSequence(
- af.getCurrentView().getAlignment(), paeFile,
- subVals.getIndex(), null);
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile, subVals.getIndex(), null, false, false);
// required to readjust the height and position of the pAE
// annotation
}
protected void processImages(String id)
{
- ArgValuesMap avm = new ArgValuesMap(argParser.linkedArgs(id));
+ ArgValuesMap avm = argParser.linkedArgs(id);
AlignFrame af = afMap.get(id);
if (af == null)
return;
}
- if (avm.hasValue(Arg.IMAGE))
+ if (avm.containsArg(Arg.IMAGE))
{
for (ArgValue av : avm.getArgValueList(Arg.IMAGE))
{