ANNOTATION2, DISPLAY, GUI, NEWS, NOQUESTIONNAIRE, SORTBYTREE,
USAGESTATS, OPEN, OPEN2, PROPS, QUESTIONNAIRE, SETPROP, TREE, VDOC,
VSESS, OUTPUT, OUTPUTTYPE, SSANNOTATION, NOTEMPFAC, TEMPFAC,
- TEMPFAC_LABEL, TEMPFAC_DESC, TEMPFAC_SHADING, TITLE, PAEMATRIX, WRAP;
+ TEMPFAC_LABEL, TEMPFAC_DESC, TEMPFAC_SHADING, TITLE, PAEMATRIX, WRAP,
+ NOSTRUCTURE, STRUCTURE;
static
{
TEMPFAC_SHADING.setOptions(Opt.STRING, Opt.LINKED);
TITLE.setOptions(Opt.STRING, Opt.LINKED);
PAEMATRIX.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI);
+ NOSTRUCTURE.setOptions(Opt.UNARY, Opt.LINKED);
+ STRUCTURE.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI);
WRAP.setOptions(Opt.BOOLEAN, Opt.LINKED);
}
import jalview.bin.ArgParser.Arg;
import jalview.bin.ArgParser.ArgValues;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
+import jalview.gui.StructureChooser;
import jalview.io.AppletFormatAdapter;
import jalview.io.DataSourceType;
import jalview.io.FileFormatException;
}
}
}
+
+ // open the structure (from same PDB file or given PDBfile)
+ if (m.get(Arg.NOSTRUCTURE) == null
+ || !m.get(Arg.NOQUESTIONNAIRE).getBoolean())
+ {
+ AlignFrame af = afMap.get(id);
+ if (m.get(Arg.STRUCTURE) != null)
+ {
+ STRUCTURE: for (String val : m.get(Arg.STRUCTURE).getValues())
+ {
+ SubId subId = new SubId(val);
+ SequenceI seq = getSpecifiedSequence(af, subId);
+ if (seq == null)
+ {
+ Console.warn("Could not find sequence for argument --"
+ + Arg.STRUCTURE + "=" + val);
+ break STRUCTURE;
+ }
+ File structureFile = null;
+ if (subId.content != null && subId.content.length() != 0)
+ {
+ structureFile = new File(subId.content);
+ Console.debug("Using structure file (from argument) '"
+ + structureFile.getAbsolutePath() + "'");
+ }
+ /* 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.warn("Not provided structure file with '" + val + "'");
+ continue STRUCTURE;
+ }
+
+ if (!structureFile.exists())
+ {
+ Console.warn("Structure file '"
+ + structureFile.getAbsoluteFile() + "' not found.");
+ continue STRUCTURE;
+ }
+
+ Console.debug("Using structure file "
+ + structureFile.getAbsolutePath());
+
+ // open structure view
+ AlignmentPanel ap = af.alignPanel;
+ StructureChooser.openStructureFileForSequence(ap, seq,
+ structureFile);
+ }
+ }
+ }
+ }
+
+ private SequenceI getSpecifiedSequence(AlignFrame af, SubId subId)
+ {
+ SequenceI seq = null;
+ SequenceI[] sequences = af.getCurrentView().getAlignment()
+ .getSequencesArray();
+ if (-1 < subId.index && subId.index < sequences.length)
+ {
+ seq = sequences[subId.index];
+ }
+ else if ("id".equals(subId.keyName))
+ {
+ for (SequenceI s : sequences)
+ {
+ if (s.getDisplayId(false).equals(subId.keyValue))
+ {
+ seq = s;
+ break;
+ }
+ }
+ }
+ return seq;
}
/**
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
List<SequenceI> seqsWithoutSourceDBRef = null;
+ private boolean noChooserGUI = false;
+
private static StructureViewer lastTargetedView = null;
public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
AlignmentPanel ap)
{
+ this(selectedSeqs, selectedSeq, ap, false);
+ }
+
+ public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
+ AlignmentPanel ap, boolean noChooserGUI)
+ {
// which FTS engine to use
data = StructureChooserQuerySource.getQuerySourceFor(selectedSeqs);
initDialog();
this.selectedSequence = selectedSeq;
this.selectedSequences = selectedSeqs;
this.progressIndicator = (ap == null) ? null : ap.alignFrame;
+ this.noChooserGUI = noChooserGUI;
init();
}
populateFilterComboBox(isStructuresDiscovered(), cachedPDBExists);
discoverStructureViews();
updateProgressIndicator(null, startTime);
- mainFrame.setVisible(true);
+ mainFrame.setVisible(noChooserGUI);
updateCurrentView();
}
{
return notQueriedTDBYet;
}
+
+ /**
+ * Open a single structure file for a given sequence
+ */
+ public static void openStructureFileForSequence(AlignmentPanel ap,
+ SequenceI seq, File sFile)
+ {
+ StructureChooser sc = new StructureChooser(new SequenceI[] { seq }, seq,
+ ap, true);
+ StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ PDBEntry fileEntry = null;
+ try
+ {
+ fileEntry = new AssociatePdbFileWithSeq().associatePdbWithSeq(
+ sFile.getAbsolutePath(), DataSourceType.FILE, seq, true,
+ Desktop.instance);
+ } catch (Exception e)
+ {
+ Console.error("Could not open structure file '"
+ + sFile.getAbsolutePath() + "'");
+ return;
+ }
+
+ StructureViewer sViewer = sc.launchStructureViewer(ssm,
+ new PDBEntry[]
+ { fileEntry }, ap, new SequenceI[] { seq });
+
+ sc.mainFrame.dispose();
+ }
}